Package: fuseiso
Version: 20070708-6

Hi

fuseiso reports the wrong size for standard ISOs - it considers the sectors to
be blocks. This means everything gets shrunk by a factor of 4 on an ISO9660
image, which has 2048 byte sectors.

Looks like there's no upstream maintainer, so I've attached:

* a one-liner fix
* test data creation script
* test script
* logs of output
* diff of before and after

Thanks

Gareth
(💻) gaz@blade:~/src/tmp/fuseiso$ diff sysmount.log fuseiso.log
1,3c1,3
< 1.0M  medium.bin
< 512   small.txt
< 6.5K  unaligned.txt
---
> 256K  medium.bin
> 0     small.txt
> 1.5K  unaligned.txt
5,6c5,6
<   Size: 1048576       Blocks: 2048       IO Block: 2048   regular file
< Device: 7,30  Inode: 1799        Links: 1
---
>   Size: 1048576       Blocks: 512        IO Block: 2048   regular file
> Device: 0,142 Inode: 4           Links: 1
13,14c13,14
<   Size: 12            Blocks: 1          IO Block: 2048   regular file
< Device: 7,30  Inode: 1803        Links: 1
---
>   Size: 12            Blocks: 0          IO Block: 2048   regular file
> Device: 0,142 Inode: 5           Links: 1
21,22c21,22
<   Size: 6387          Blocks: 13         IO Block: 2048   regular file
< Device: 7,30  Inode: 1807        Links: 1
---
>   Size: 6387          Blocks: 3          IO Block: 2048   regular file
> Device: 0,142 Inode: 6           Links: 1
(💻) gaz@blade:~/src/tmp/fuseiso$ diff sysmount.log patched.log
6c6
< Device: 7,30  Inode: 1799        Links: 1
---
> Device: 0,142 Inode: 4           Links: 1
14c14
< Device: 7,30  Inode: 1803        Links: 1
---
> Device: 0,142 Inode: 5           Links: 1
22c22
< Device: 7,30  Inode: 1807        Links: 1
---
> Device: 0,142 Inode: 6           Links: 1

Attachment: patched.log
Description: Binary data

Attachment: fuseiso.log
Description: Binary data

Attachment: create_testdata.sh
Description: Bourne shell script

Attachment: sysmount.log
Description: Binary data

Attachment: test.sh
Description: Bourne shell script

diff --git a/src/isofs.c b/src/isofs.c
index 64b1e92..d53139c 100644
--- a/src/isofs.c
+++ b/src/isofs.c
@@ -539,7 +539,7 @@ static int isofs_direntry2stat(struct stat *st, isofs_inode *inode) {
         st->st_size = isonum_733(record->size);
     };
     
-    st->st_blocks = st->st_size / context.data_size; // should not be to meaningful even for zisofs compression
+    st->st_blocks = (st->st_size + 511) >> 9; // divide by 512 with ceil
     st->st_blksize = context.data_size;
     st->st_nlink = 1; // always, even if rrip PX entry found
     

Reply via email to