summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2022-05-06 06:27:39 (GMT)
committerGitHub <noreply@github.com>2022-05-06 06:27:39 (GMT)
commit4f376eb29f2b7e560b62cf05843fe6103a50fa71 (patch)
tree62e54d4932bb82febca5f358b1a52cea48a444bf
parentc78bb5a4604c7d84c00dc94ce723417dcd66fd9f (diff)
downloadhdf5-4f376eb29f2b7e560b62cf05843fe6103a50fa71.zip
hdf5-4f376eb29f2b7e560b62cf05843fe6103a50fa71.tar.gz
hdf5-4f376eb29f2b7e560b62cf05843fe6103a50fa71.tar.bz2
Onion VFD: Removes the user info from the revision entries (#1737)
* Removes the user info from the onion VFD revision entries * Formatted source * Fixed codespell issue
-rw-r--r--src/H5FDonion.c115
-rw-r--r--src/H5FDonion_priv.h7
-rw-r--r--test/onion.c146
-rw-r--r--tools/test/h5diff/testfiles/h5diff_onion_dset_1d.h5bin2112 -> 2112 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_onion_dset_1d.h5.onionbin1321 -> 1270 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_onion_dset_ext.h5bin6064 -> 6064 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_onion_dset_ext.h5.onionbin10353 -> 10319 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_onion_objs.h5bin6064 -> 6064 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_onion_objs.h5.onionbin25097 -> 24995 bytes
-rw-r--r--tools/testfiles/tst_onion_dset_1d.h5bin2112 -> 2112 bytes
-rw-r--r--tools/testfiles/tst_onion_dset_1d.h5.onionbin1321 -> 1270 bytes
-rw-r--r--tools/testfiles/tst_onion_dset_ext.h5bin6064 -> 6064 bytes
-rw-r--r--tools/testfiles/tst_onion_dset_ext.h5.onionbin10353 -> 10319 bytes
-rw-r--r--tools/testfiles/tst_onion_objs.h5bin6064 -> 6064 bytes
-rw-r--r--tools/testfiles/tst_onion_objs.h5.onionbin25097 -> 24995 bytes
15 files changed, 91 insertions, 177 deletions
diff --git a/src/H5FDonion.c b/src/H5FDonion.c
index da06168..ae8483d 100644
--- a/src/H5FDonion.c
+++ b/src/H5FDonion.c
@@ -370,7 +370,7 @@ H5FDonion_get_revision_count(const char *filename, hid_t fapl_id, size_t *revisi
herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "*si*z", filename, fapl_id, revision_count);
+ H5TRACE3("e", "*six", filename, fapl_id, revision_count);
/* Check args */
if (!filename || !HDstrcmp(filename, ""))
@@ -656,7 +656,6 @@ H5FD__onion_commit_new_revision_record(H5FD_onion_t *file)
HGOTO_ERROR(H5E_VFL, H5E_INTERNAL, FAIL, "unable to update index to write")
if (NULL == (buf = H5MM_malloc(H5FD__ONION_ENCODED_SIZE_REVISION_RECORD + (size_t)rec_p->comment_size +
- (size_t)rec_p->username_size +
(H5FD__ONION_ENCODED_SIZE_INDEX_ENTRY * rec_p->archival_index.n_entries))))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer for encoded revision record")
@@ -788,7 +787,6 @@ done:
H5MM_xfree(file->name_recov);
H5MM_xfree(file->summary.record_pointer_list);
- H5MM_xfree(file->rev_record.username);
H5MM_xfree(file->rev_record.comment);
H5MM_xfree(file->rev_record.archival_index.list);
@@ -984,12 +982,12 @@ H5FD_onion_history_header_encode(H5FD_onion_history_header_t *header, unsigned c
* H5FD_onion_revision_record_encode().
*
* MUST BE CALLED TWICE:
- * On the first call, n_entries, comment_size, and username_size
- * in the destination structure must all all be zero, and their
+ * On the first call, n_entries and comment_size in the
+ * destination structure must all all be zero, and their
* respective variable-length components (index_entry_list,
- * comment, username) must all be NULL.
+ * comment) must all be NULL.
*
- * If the buffer is well-formed, the destinatino structure is
+ * If the buffer is well-formed, the destination structure is
* tentatively populated with fixed-size values, and the number of
* bytes read are returned.
*
@@ -997,8 +995,8 @@ H5FD_onion_history_header_encode(H5FD_onion_history_header_t *header, unsigned c
* variable-length components, in accordance with the associated
* indicators (array of index-entry structures for
* index_entry_list, of size n_entries; character arrays for
- * username and comment, allocated with the *_size number of
- * bytes -- space for NULL-terminator is included in _size).
+ * comment, allocated with the *_size number of bytes -- space
+ * for NULL-terminator is included in _size).
*
* Then the decode operation is called a second time, and all
* components will be populated (and again number of bytes read is
@@ -1011,16 +1009,15 @@ H5FD_onion_history_header_encode(H5FD_onion_history_header_t *header, unsigned c
uint64_t
H5FD_onion_revision_record_decode(unsigned char *buf, H5FD_onion_revision_record_t *record)
{
- uint32_t ui32 = 0;
- uint32_t page_size = 0;
- uint32_t sum = 0;
- uint64_t ui64 = 0;
- uint64_t n_entries = 0;
- uint32_t username_size = 0;
- uint32_t comment_size = 0;
- uint8_t * ui8p = NULL;
- unsigned char *ptr = NULL;
- uint64_t ret_value = 0;
+ uint32_t ui32 = 0;
+ uint32_t page_size = 0;
+ uint32_t sum = 0;
+ uint64_t ui64 = 0;
+ uint64_t n_entries = 0;
+ uint32_t comment_size = 0;
+ uint8_t * ui8p = NULL;
+ unsigned char *ptr = NULL;
+ uint64_t ret_value = 0;
FUNC_ENTER_NOAPI_NOINIT;
@@ -1070,11 +1067,6 @@ H5FD_onion_revision_record_decode(unsigned char *buf, H5FD_onion_revision_record
record->archival_index.page_size_log2++)
;
- HDmemcpy(&ui32, ptr, 4);
- ui8p = (uint8_t *)&ui32;
- UINT32DECODE(ui8p, record->user_id);
- ptr += 4;
-
HDmemcpy(&ui64, ptr, 8);
ui8p = (uint8_t *)&ui64;
UINT64DECODE(ui8p, n_entries);
@@ -1082,11 +1074,6 @@ H5FD_onion_revision_record_decode(unsigned char *buf, H5FD_onion_revision_record
HDmemcpy(&ui32, ptr, 4);
ui8p = (uint8_t *)&ui32;
- UINT32DECODE(ui8p, username_size);
- ptr += 4;
-
- HDmemcpy(&ui32, ptr, 4);
- ui8p = (uint8_t *)&ui32;
UINT32DECODE(ui8p, comment_size);
ptr += 4;
@@ -1134,18 +1121,6 @@ H5FD_onion_revision_record_decode(unsigned char *buf, H5FD_onion_revision_record
}
}
- if (record->username_size == 0) {
- if (record->username != NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "username pointer prematurely allocated")
- record->username_size = username_size;
- }
- else {
- if (record->username == NULL)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "no username pointer")
- HDmemcpy(record->username, ptr, username_size);
- }
- ptr += username_size;
-
if (record->comment_size == 0) {
if (record->comment != NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "comment pointer prematurely allocated")
@@ -1186,7 +1161,7 @@ done:
* The destination buffer must be sufficiently large to hold the
* encoded contents.
* (Hint: `sizeof(revision-record-struct) + comment-size +
- * username-size + sizeof(index-entry-struct) * n_entries)`
+ * sizeof(index-entry-struct) * n_entries)`
* guarantees ample/excess space.)
*
* Return: Number of bytes written to buffer.
@@ -1221,9 +1196,7 @@ H5FD_onion_revision_record_encode(H5FD_onion_revision_record_t *record, unsigned
ptr += 16;
UINT64ENCODE(ptr, record->logi_eof);
UINT32ENCODE(ptr, page_size);
- UINT32ENCODE(ptr, record->user_id);
UINT64ENCODE(ptr, record->archival_index.n_entries);
- UINT32ENCODE(ptr, record->username_size);
UINT32ENCODE(ptr, record->comment_size);
if (record->archival_index.n_entries > 0) {
@@ -1246,12 +1219,6 @@ H5FD_onion_revision_record_encode(H5FD_onion_revision_record_t *record, unsigned
}
}
- if (record->username_size > 0) {
- HDassert(record->username != NULL && *record->username != '\0');
- HDmemcpy(ptr, record->username, record->username_size);
- ptr += record->username_size;
- }
-
if (record->comment_size > 0) {
HDassert(record->comment != NULL && *record->comment != '\0');
HDmemcpy(ptr, record->comment, record->comment_size);
@@ -1425,40 +1392,6 @@ H5FD_onion_whole_history_encode(H5FD_onion_whole_history_t *summary, unsigned ch
} /* end H5FD_onion_whole_history_encode() */
/*-----------------------------------------------------------------------------
- * Populate user_id and username (string) in revision record pointer.
- * Assumes that the username string pointer arrives as NULL;
- * Allocated username string must be manually freed when done.
- *-----------------------------------------------------------------------------
- */
-static herr_t
-H5FD__onion_set_userinfo_in_record(H5FD_onion_revision_record_t *rec_p)
-{
- uid_t uid = 0;
- struct passwd *user_info = NULL;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_PACKAGE;
-
- uid = HDgetuid();
-
- HDassert(0 == ((uint64_t)uid & 0xFFFFFFFF00000000)); /* fits uint32_t */
- rec_p->user_id = (uint32_t)uid;
-
- if (NULL == (user_info = HDgetpwuid(uid)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't get user info")
-
- rec_p->username_size = (uint32_t)HDstrlen(user_info->pw_name) + 1;
-
- if (NULL == (rec_p->username = H5MM_malloc(sizeof(char) * rec_p->username_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate space for username string")
-
- HDmemcpy(rec_p->username, user_info->pw_name, rec_p->username_size);
-
-done:
- FUNC_LEAVE_NOAPI(ret_value);
-} /* end H5FD__onion_set_userinfo_in_record() */
-
-/*-----------------------------------------------------------------------------
* Create/truncate HDF5 and onion data for a fresh file.
*
* Special open operation required to instantiate the canonical file and
@@ -1501,9 +1434,6 @@ H5FD__onion_create_truncate_onion(H5FD_onion_t *file, const char *filename, cons
hdr_p->origin_eof = 0;
- if (H5FD__onion_set_userinfo_in_record(rec_p) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Can't record user info")
-
backing_fapl_id = H5FD__onion_get_legit_fapl_id(file->fa.backing_fapl_id);
if (H5I_INVALID_HID == backing_fapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid backing FAPL ID")
@@ -1659,7 +1589,6 @@ H5FD__onion_ingest_revision_record(H5FD_onion_revision_record_t *r_out, H5FD_t *
* of the struct here is completely bananas.
*/
r_out->comment = H5MM_xfree(r_out->comment);
- r_out->username = H5MM_xfree(r_out->username);
r_out->archival_index.list = H5MM_xfree(r_out->archival_index.list);
if (H5FD_get_eof(raw_file, H5FD_MEM_DRAW) < (addr + size))
@@ -1700,7 +1629,6 @@ H5FD__onion_ingest_revision_record(H5FD_onion_revision_record_t *r_out, H5FD_t *
r_out->archival_index.n_entries = 0;
r_out->comment_size = 0;
- r_out->username_size = 0;
if (r_out->revision_num < revision_num)
low = (n == high) ? high : n + 1;
@@ -1732,10 +1660,6 @@ H5FD__onion_ingest_revision_record(H5FD_onion_revision_record_t *r_out, H5FD_t *
"could not find target revision!") /* TODO: corrupted? */
} /* end if revision ID at 'leaf' in binary search */
- if (r_out->username_size > 0)
- if (NULL == (r_out->username = H5MM_malloc(sizeof(char) * r_out->username_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate username space")
-
if (r_out->comment_size > 0)
if (NULL == (r_out->comment = H5MM_malloc(sizeof(char) * r_out->comment_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate comment space")
@@ -1752,7 +1676,6 @@ done:
H5MM_xfree(buf);
if (ret_value == FAIL) {
H5MM_xfree(r_out->comment);
- H5MM_xfree(r_out->username);
H5MM_xfree(r_out->archival_index.list);
}
@@ -1972,9 +1895,6 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma
hdr_p->origin_eof = canon_eof;
file->logi_eof = canon_eof;
- if (H5FD__onion_set_userinfo_in_record(rec_p) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Can't record user info")
-
backing_fapl_id = H5FD__onion_get_legit_fapl_id(file->fa.backing_fapl_id);
if (H5I_INVALID_HID == backing_fapl_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid backing FAPL ID")
@@ -2137,7 +2057,6 @@ done:
H5MM_xfree(file->name_recov);
H5MM_xfree(file->rev_record.comment);
- H5MM_xfree(file->rev_record.username);
H5FL_FREE(H5FD_onion_t, file);
}
diff --git a/src/H5FDonion_priv.h b/src/H5FDonion_priv.h
index 2ec6283..63a7049 100644
--- a/src/H5FDonion_priv.h
+++ b/src/H5FDonion_priv.h
@@ -31,7 +31,7 @@
#define H5FD__ONION_ENCODED_SIZE_HEADER 40
#define H5FD__ONION_ENCODED_SIZE_INDEX_ENTRY 20
#define H5FD__ONION_ENCODED_SIZE_RECORD_POINTER 20
-#define H5FD__ONION_ENCODED_SIZE_REVISION_RECORD 76
+#define H5FD__ONION_ENCODED_SIZE_REVISION_RECORD 68
#define H5FD__ONION_ENCODED_SIZE_WHOLE_HISTORY 20
/* Flags must align exactly one per bit, up to 24 bits */
@@ -143,11 +143,8 @@ typedef struct H5FD_onion_revision_record_t {
uint64_t parent_revision_num;
char time_of_creation[16];
uint64_t logi_eof;
- uint32_t user_id;
- uint32_t username_size;
- uint32_t comment_size;
H5FD_onion_archival_index_t archival_index;
- char * username;
+ uint32_t comment_size;
char * comment;
uint32_t checksum;
} H5FD_onion_revision_record_t;
diff --git a/test/onion.c b/test/onion.c
index c26465c..626f27f 100644
--- a/test/onion.c
+++ b/test/onion.c
@@ -1266,44 +1266,48 @@ error:
static int
test_revision_record_encode_decode(void)
{
- unsigned char *buf = NULL;
- unsigned char exp[189] = {
- 'O', 'R', 'R', 'S', /* signature */
- 1, 0, 0, 0, /* NOTE: update version w/ "current" as needed */
- 5, 0, 0, 0, 0, 0, 0, 0, /* revision ID */
- 2, 0, 0, 0, 0, 0, 0, 0, /* parent revision ID */
- '1', '9', '4', '1', '1', '2', '0', '7', /* Time of Creation */
- 'T', '1', '9', '0', '6', '4', '3', 'Z', /* ... */
- 0x11, 0x00, 0, 0, 0x02, 0, 0, 0, /* logical file size */
- 0, 16, 0, 0, /* page size */
- 143, 25, 0, 0, /* user ID */
- 4, 0, 0, 0, 0, 0, 0, 0, /* n_entries */
- 8, 0, 0, 0, /* username size */
- 25, 0, 0, 0, /* comment size */
- /* entry0 pointer */
- 0, 0xB0, 0x1E, 0, 0, 0, 0, 0, /* logical offset */
- 0x4B, 0x02, 0, 0, 0, 0, 0, 0, /* physical address */
- 0, 0, 0, 0, /* sum populated below */ /* checksum */
- /* entry1 pointer */
- 0, 0xF0, 0x2E, 0, 0, 0, 0, 0, 0xA7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* sum populated below */
- /* entry2 pointer */
- 0, 0x50, 0x15, 0, 0, 0x20, 0, 0, 0x11, 0, 0, 0, 0x02, 0, 0, 0, 0, 0, 0, 0, /* sum populated below */
- /* entry3 pointer */
- 0, 0xE0, 0x24, 0, 0, 0, 0, 0, 0xB1, 0x01, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* sum populated below */
- 'J', 'o', 'h', 'n', 'D', 'o', 'e', '\0', /* username */
- 'E', 'x', 'a', 'm', 'p', 'l', 'e', ' ', /* comment */
- 'c', 'o', 'm', 'm', 'e', 'n', 't', ' ', /* ... */
- 'm', 'e', 's', 's', 'a', 'g', 'e', '.', /* ... */
- '\0', /* ... */
- /* final checksum */
- 0, 0, 0, 0 /* sum populated below */ /* checksum */
+ /* clang-format off */
+ /* Byte array of expected values (FRAGILE!) */
+ unsigned char exp[173] = {
+ 'O', 'R', 'R', 'S', /* Bytes 000-003: signature */
+ 1, 0, 0, 0, /* Bytes 004-007: version */
+ 5, 0, 0, 0, 0, 0, 0, 0, /* Bytes 008-015: revision ID */
+ 2, 0, 0, 0, 0, 0, 0, 0, /* Bytes 016-023: parent revision ID */
+ '1', '9', '4', '1', '1', '2', '0', '7', /* Bytes 024-039: time of creation */
+ 'T', '1', '9', '0', '6', '4', '3', 'Z', /* ... */
+ 0x11, 0x00, 0, 0, 0x02, 0, 0, 0, /* Bytes 040-047: logical file size */
+ 0, 16, 0, 0, /* Bytes 048-051: page size */
+ 4, 0, 0, 0, 0, 0, 0, 0, /* Bytes 052-059: # entries */
+ 25, 0, 0, 0, /* Bytes 060-063: comment size */
+ /* ENTRY 0 */
+ 0, 0xB0, 0x1E, 0, 0, 0, 0, 0, /* Bytes 064-071: entry 0: logical offset */
+ 0x4B, 0x02, 0, 0, 0, 0, 0, 0, /* Bytes 072-079: entry 0: physical address */
+ 0, 0, 0, 0, /* Bytes 080-083: checksum (populated below) */
+ /* ENTRY 1 */
+ 0, 0xF0, 0x2E, 0, 0, 0, 0, 0, /* Bytes 084-091: entry 1: logical offset */
+ 0xA7, 0, 0, 0, 0, 0, 0, 0, /* Bytes 092-099: entry 1: physical address */
+ 0, 0, 0, 0, /* Bytes 100-103: checksum (populated below) */
+ /* ENTRY 2 */
+ 0, 0x50, 0x15, 0, 0, 0x20, 0, 0, /* Bytes 104-111: entry 2: logical offset */
+ 0x11, 0, 0, 0, 0x02, 0, 0, 0, /* Bytes 112-119: entry 2: physical address */
+ 0, 0, 0, 0, /* Bytes 120-123: checksum (populated below) */
+ /* ENTRY 3 */
+ 0, 0xE0, 0x24, 0, 0, 0, 0, 0, /* Bytes 124-131: entry 3: logical offset */
+ 0xB1, 0x01, 0, 0, 0, 0, 0, 0, /* Bytes 132-139: entry 3: physical address */
+ 0, 0, 0, 0, /* Bytes 140-143: checksum (populated below) */
+ 'E', 'x', 'a', 'm', 'p', 'l', 'e', ' ', /* Bytes 144-168: comment */
+ 'c', 'o', 'm', 'm', 'e', 'n', 't', ' ', /* ... */
+ 'm', 'e', 's', 's', 'a', 'g', 'e', '.', /* ... */
+ '\0', /* ... */
+ 0, 0, 0, 0 /* Bytes 169-172: final checksum (populated below) */
};
+ /* clang-format on */
+ unsigned char * buf = NULL;
unsigned char * buf_p = NULL;
size_t i = 0;
uint64_t size_ret;
H5FD_onion_revision_record_t r_out;
uint32_t sum_out = 0;
- char username[8] = "JohnDoe";
char comment[25] = "Example comment message.";
H5FD_onion_revision_record_t record = {
H5FD__ONION_REVISION_RECORD_VERSION_CURR,
@@ -1311,35 +1315,30 @@ test_revision_record_encode_decode(void)
2, /* parent revision ID */
{'\0'}, /* time of creation - populated below */
8589934609ull, /* logical file size */
- 6543, /* user ID */
- 8, /* username size */
- 25, /* comment size */
{
- H5FD__ONION_ARCHIVAL_INDEX_VERSION_CURR, 12, /* page_size_log2 */
- 4, /* n_entries */
- NULL, /* list - populated below */
- }, /* archival index struct */
- username, /* username */
- comment, /* comment */
- 0, /* checksum - computed for us */
+ H5FD__ONION_ARCHIVAL_INDEX_VERSION_CURR, /* version */
+ 12, /* page_size_log2 */
+ 4, /* n_entries */
+ NULL, /* list - populated below */
+ }, /* archival index struct */
+ 25, /* comment size */
+ comment, /* comment */
+ 0, /* checksum (computed later) */
};
uint64_t exp_size = H5FD__ONION_ENCODED_SIZE_REVISION_RECORD +
(H5FD__ONION_ENCODED_SIZE_INDEX_ENTRY * record.archival_index.n_entries) +
- strlen("JohnDoe") + 1 + strlen("Example comment message.") + 1;
+ HDstrlen("Example comment message.") + 1;
r_out.archival_index.list = NULL;
r_out.comment = NULL;
- r_out.username = NULL;
TESTING("encode/decode revision record");
- if (189 != exp_size)
- TEST_ERROR;
-
HDmemcpy(record.time_of_creation, "19411207T190643Z", 16);
record.archival_index.list = HDcalloc(record.archival_index.n_entries, sizeof(H5FD_onion_index_entry_t));
if (NULL == record.archival_index.list)
TEST_ERROR;
+
/* Convert logi_page and should match address in expected buffer */
record.archival_index.list[0].logi_page = 491ull;
record.archival_index.list[0].phys_addr = 587ull;
@@ -1370,9 +1369,7 @@ test_revision_record_encode_decode(void)
/* Required initialization for record-out structure */
r_out.version = H5FD__ONION_REVISION_RECORD_VERSION_CURR;
- r_out.username_size = 0;
r_out.comment_size = 0;
- r_out.username = NULL;
r_out.comment = NULL;
r_out.archival_index.version = H5FD__ONION_ARCHIVAL_INDEX_VERSION_CURR;
r_out.archival_index.n_entries = 0;
@@ -1385,10 +1382,34 @@ test_revision_record_encode_decode(void)
if (H5FD_onion_revision_record_encode(&record, buf, &sum_out) != exp_size)
TEST_ERROR;
+
+ hbool_t badness = FALSE;
for (i = 0; i < exp_size; i++) {
- if (exp[i] != buf[i])
- TEST_ERROR;
+ if (exp[i] != buf[i]) {
+ badness = TRUE;
+ HDprintf("Bad encoded record - Index %zu: expected 0x%02X but got 0x%02X\n", i,
+ (unsigned int)exp[i], (unsigned int)buf[i]);
+ }
+ }
+ if (badness) {
+ /* If this fragile test breaks, this information is helpful... */
+ HDprintf("INDEX\n");
+ for (i = 0; i < exp_size; i++)
+ HDprintf("%4zu ", i);
+ HDprintf("\n");
+
+ HDprintf("EXPECTED\n");
+ for (i = 0; i < exp_size; i++)
+ HDprintf("0x%02X ", (unsigned int)exp[i]);
+ HDprintf("\n");
+
+ HDprintf("ACTUAL\n");
+ for (i = 0; i < exp_size; i++)
+ HDprintf("0x%02X ", (unsigned int)buf[i]);
+ HDprintf("\n");
}
+ if (badness)
+ TEST_ERROR;
if (record.checksum != sum_out)
TEST_ERROR;
@@ -1431,17 +1452,12 @@ test_revision_record_encode_decode(void)
/* Initial decode; get variable-length component sizes */
if (H5FD_onion_revision_record_decode(exp, &r_out) != exp_size)
TEST_ERROR;
- if (record.username_size != r_out.username_size)
- TEST_ERROR;
if (record.comment_size != r_out.comment_size)
TEST_ERROR;
if (record.archival_index.n_entries != r_out.archival_index.n_entries)
TEST_ERROR;
/* Allocate variable-length components */
- r_out.username = HDcalloc(r_out.username_size, sizeof(char));
- if (NULL == r_out.username)
- TEST_ERROR;
r_out.comment = HDcalloc(r_out.comment_size, sizeof(char));
if (NULL == r_out.comment)
TEST_ERROR;
@@ -1454,8 +1470,6 @@ test_revision_record_encode_decode(void)
TEST_ERROR;
if (H5FD__ONION_REVISION_RECORD_VERSION_CURR != r_out.version)
TEST_ERROR;
- if (record.user_id != r_out.user_id)
- TEST_ERROR;
if (record.revision_num != r_out.revision_num)
TEST_ERROR;
if (record.parent_revision_num != r_out.parent_revision_num)
@@ -1466,14 +1480,6 @@ test_revision_record_encode_decode(void)
TEST_ERROR;
if (HDstrncmp(record.time_of_creation, r_out.time_of_creation, 16) != 0)
TEST_ERROR;
- if (record.username_size != r_out.username_size)
- TEST_ERROR;
- if (record.username_size != HDstrlen(r_out.username) + 1)
- TEST_ERROR;
- if (HDstrlen(record.username) != HDstrlen(r_out.username))
- TEST_ERROR;
- if (HDstrcmp(record.username, r_out.username) != 0)
- TEST_ERROR;
if (record.comment_size != r_out.comment_size)
TEST_ERROR;
if (record.comment_size != HDstrlen(r_out.comment) + 1)
@@ -1503,7 +1509,6 @@ test_revision_record_encode_decode(void)
HDfree(r_out.archival_index.list);
HDfree(r_out.comment);
- HDfree(r_out.username);
HDfree(buf);
HDfree(record.archival_index.list);
@@ -1513,7 +1518,6 @@ test_revision_record_encode_decode(void)
error:
HDfree(r_out.archival_index.list);
HDfree(r_out.comment);
- HDfree(r_out.username);
HDfree(buf);
HDfree(record.archival_index.list);
@@ -1685,8 +1689,6 @@ verify_history_as_expected_onion(H5FD_t *raw_file, struct expected_history *filt
rev_out.archival_index.page_size_log2 = 0;
rev_out.comment_size = 0;
rev_out.comment = NULL;
- rev_out.username_size = 0;
- rev_out.username = NULL;
readsize = rpp->record_size;
if (NULL == (buf = HDmalloc((size_t)rpp->record_size)))
@@ -1720,8 +1722,6 @@ verify_history_as_expected_onion(H5FD_t *raw_file, struct expected_history *filt
HDcalloc(rev_out.archival_index.n_entries, sizeof(H5FD_onion_index_entry_t));
if (NULL == rev_out.archival_index.list)
TEST_ERROR;
- if (NULL == (rev_out.username = HDmalloc((size_t)rev_out.username_size)))
- TEST_ERROR;
readsize = H5FD_onion_revision_record_decode(buf, &rev_out);
if (rpp->record_size != readsize)
@@ -1745,7 +1745,6 @@ verify_history_as_expected_onion(H5FD_t *raw_file, struct expected_history *filt
HDfree(buf);
HDfree(rev_out.comment);
HDfree(rev_out.archival_index.list);
- HDfree(rev_out.username);
}
HDfree(whs_out.record_pointer_list);
@@ -1757,7 +1756,6 @@ error:
HDfree(buf);
HDfree(rev_out.comment);
HDfree(rev_out.archival_index.list);
- HDfree(rev_out.username);
HDfree(whs_out.record_pointer_list);
return -1;
diff --git a/tools/test/h5diff/testfiles/h5diff_onion_dset_1d.h5 b/tools/test/h5diff/testfiles/h5diff_onion_dset_1d.h5
index 8526660..5e53fba 100644
--- a/tools/test/h5diff/testfiles/h5diff_onion_dset_1d.h5
+++ b/tools/test/h5diff/testfiles/h5diff_onion_dset_1d.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_onion_dset_1d.h5.onion b/tools/test/h5diff/testfiles/h5diff_onion_dset_1d.h5.onion
index bb4d3e5..95893f2 100644
--- a/tools/test/h5diff/testfiles/h5diff_onion_dset_1d.h5.onion
+++ b/tools/test/h5diff/testfiles/h5diff_onion_dset_1d.h5.onion
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_onion_dset_ext.h5 b/tools/test/h5diff/testfiles/h5diff_onion_dset_ext.h5
index 7d79479..369ace6 100644
--- a/tools/test/h5diff/testfiles/h5diff_onion_dset_ext.h5
+++ b/tools/test/h5diff/testfiles/h5diff_onion_dset_ext.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_onion_dset_ext.h5.onion b/tools/test/h5diff/testfiles/h5diff_onion_dset_ext.h5.onion
index 713b6e8..291f9b3 100644
--- a/tools/test/h5diff/testfiles/h5diff_onion_dset_ext.h5.onion
+++ b/tools/test/h5diff/testfiles/h5diff_onion_dset_ext.h5.onion
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_onion_objs.h5 b/tools/test/h5diff/testfiles/h5diff_onion_objs.h5
index 7d79479..369ace6 100644
--- a/tools/test/h5diff/testfiles/h5diff_onion_objs.h5
+++ b/tools/test/h5diff/testfiles/h5diff_onion_objs.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_onion_objs.h5.onion b/tools/test/h5diff/testfiles/h5diff_onion_objs.h5.onion
index a821ee1..7811f83 100644
--- a/tools/test/h5diff/testfiles/h5diff_onion_objs.h5.onion
+++ b/tools/test/h5diff/testfiles/h5diff_onion_objs.h5.onion
Binary files differ
diff --git a/tools/testfiles/tst_onion_dset_1d.h5 b/tools/testfiles/tst_onion_dset_1d.h5
index 8526660..5042ebf 100644
--- a/tools/testfiles/tst_onion_dset_1d.h5
+++ b/tools/testfiles/tst_onion_dset_1d.h5
Binary files differ
diff --git a/tools/testfiles/tst_onion_dset_1d.h5.onion b/tools/testfiles/tst_onion_dset_1d.h5.onion
index bb4d3e5..a86670e 100644
--- a/tools/testfiles/tst_onion_dset_1d.h5.onion
+++ b/tools/testfiles/tst_onion_dset_1d.h5.onion
Binary files differ
diff --git a/tools/testfiles/tst_onion_dset_ext.h5 b/tools/testfiles/tst_onion_dset_ext.h5
index 7d79479..479aaa8 100644
--- a/tools/testfiles/tst_onion_dset_ext.h5
+++ b/tools/testfiles/tst_onion_dset_ext.h5
Binary files differ
diff --git a/tools/testfiles/tst_onion_dset_ext.h5.onion b/tools/testfiles/tst_onion_dset_ext.h5.onion
index 713b6e8..b5cbdb4 100644
--- a/tools/testfiles/tst_onion_dset_ext.h5.onion
+++ b/tools/testfiles/tst_onion_dset_ext.h5.onion
Binary files differ
diff --git a/tools/testfiles/tst_onion_objs.h5 b/tools/testfiles/tst_onion_objs.h5
index 7d79479..479aaa8 100644
--- a/tools/testfiles/tst_onion_objs.h5
+++ b/tools/testfiles/tst_onion_objs.h5
Binary files differ
diff --git a/tools/testfiles/tst_onion_objs.h5.onion b/tools/testfiles/tst_onion_objs.h5.onion
index a821ee1..4abc174 100644
--- a/tools/testfiles/tst_onion_objs.h5.onion
+++ b/tools/testfiles/tst_onion_objs.h5.onion
Binary files differ