Ticket #144 (closed bug: fixed)
File size damage by non-unique inode numbers of pre-RRIP 1.12 images
| Reported by: | scdbackup | Owned by: | vreixo |
|---|---|---|---|
| Priority: | blocker | Milestone: | |
| Component: | libisofs | Version: | libisofs-0.6.10 |
| Keywords: | Cc: |
Description
libisofs produces non-unique inode numbers with empty regular files when reading from images which are not marked by ER signature "IEEE_1282".
This confuses file sizes if the files happen to share an inode.
The fallback st_ino generator seems insufficient if zero length files are in the image:
atts.st_ino = (ino_t) iso_read_bb(record->block, 4, NULL);
I examine my damaged image by help of iso_stream_get_id(). A file with righteous size 0:
/stic_dir/this_is_the_stic_main_directory xorriso_debug: iso_ino= 11344
the next file in the directory should be 94 bytes long
/stic_dir/where_to_publish xorriso_debug: iso_ino= 11344
but it now shows the same size 0 as its neighbor.
More:
The inode reader is inconsistent because in fs_image.c there is a test for RR_EXT_112 whereas in rockridge_read.c the length of the PX field decides whether the inode number is read from image.
The bug showed up when i began to write the old "RRIP_1991A" signature rather than "IEEE_1282" into the ER field.
When searching for consequences of RRIP_1991A versus IEEE_1282 i found only this in libisofs/fs_image.c:
if (fsdata->rr != RR_EXT_112) {
/*
* Only RRIP 1.12 provides valid inode numbers. If not, it is not easy
* to generate those serial numbers, and we use extend block instead.
* It BREAKS POSIX SEMANTICS, but its suitable for our needs
*/
atts.st_ino = (ino_t) iso_read_bb(record->block, 4, NULL);
if (fsdata->rr == 0) {
atts.st_nlink = 1;
}
}
If i disable it then the bug is gone.
What data extent block number has a file of size 0 ? What would be the consequence of non-unique inodes ?
But why do they become unique enough in later sessions ? What effect sorts them apart resp makes the ino sharers have the same st_size ? This stays a riddle.
I replaced the ino generator by
{
static ino_t iso_global_inode= 0;
if(iso_global_inode <= 0)
iso_global_inode++;
atts.st_ino = iso_global_inode++;
}
and again the bug is gone.
This is now change "ts A81118" in xorriso-standalone.
