Description of problem: For statvfs command in guestfish, fsid is truncated as an 'int', but actually it is an 'unsigned long'. Thus the fsid value reflected by statvfs command is negative, which is not correct. Version-Release number of selected component (if applicable): major: 1 minor: 2 release: 7 extra: How reproducible: Always Steps to Reproduce: 1. ><fs> statvfs / bsize: 1024 frsize: 1024 blocks: 99150 bfree: 93487 bavail: 88367 files: 25688 ffree: 25677 favail: 25677 fsid: -3268369665409063091 flag: 0 2. 3. Actual results: fsid is not negative. Expected results: Additional info: statvfs structure defined as follows, in which f_fsid is an 'unsigned long': struct statvfs { unsigned long f_bsize; /* file system block size */ unsigned long f_frsize; /* fragment size */ fsblkcnt_t f_blocks; /* size of fs in f_frsize units */ fsblkcnt_t f_bfree; /* # free blocks */ fsblkcnt_t f_bavail; /* # free blocks for non-root */ fsfilcnt_t f_files; /* # inodes */ fsfilcnt_t f_ffree; /* # free inodes */ fsfilcnt_t f_favail; /* # free inodes for non-root */ unsigned long f_fsid; /* file system ID */ unsigned long f_flag; /* mount flags */ unsigned long f_namemax; /* maximum filename length */ }; But actually in guestfish it is represented as follows, in which 'PRIi64'is 'i': printf ("%sfsid: %" PRIi64 "\n", indent, statvfs->fsid);
On 32 bit machines, Linux gives us a 32 bit f_fsid unsigned int from the statvfs system call. On 64 bit machines this field is returned as a 64 bit unsigned long. We pass a 64 bit signed integer over the daemon protocol on all architectures. The only issue I can see would be on a 32 bit machine if a f_fsid value >= 0x80000000 was to be sign- extended when it was passed over the protocol. I have checked and this does not happen. Therefore callers can simply cast the value to uint64_t in order to recover the original f_fsid value (on 32 or 64 bit machines). So although printing a negative number in guestfish doesn't look pretty, I don't think this is an actual bug. Therefore I am closing this as NOTABUG.