NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/48798: /bin/ls -i shows 32 bit rollover with inode numbers

>Number:         48798
>Category:       bin
>Synopsis:       /bin/ls -i shows 32 bit rollover with inode numbers
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 10 09:15:00 +0000 2014
>Originator:     Thomas Schmitt
>Release:        6.1.3
NetBSD netbsd 6.1.3 NetBSD 6.1.3 (GENERIC) i386
After fixing kern/48787, the test image there exposes ino_t values
above (2 exp 32 - 1).
But /bin/ls -li shows only their lowest 32 bits:
  netbsd# /bin/ls -li /mnt
  total 4 
  34578432 drwxr-xr-x  1 thomas  dbus  2048 May  6 15:30 my
  34574670 -rw-r--r--  1 thomas  dbus     6 May  6 15:34 small_file

  struct stat stbuf;
    printf("sizeof(ino_t) = %d\n", (int) sizeof(ino_t));
    ret = stat("/mnt/small_file", &stbuf);
    printf("/mnt/small_file , ino = %.f\n", (double) stbuf.st_ino);
  sizeof(ino_t) = 8
  /mnt/small_file , ino = 4329541966

Inode numbers above the 32 bit limit may be studied with the
test image for kern/48787:

Just 4470 bytes, MD5 7d78dc3efaec8ea3f1801335329f410d.
It inflates to 4,329,897,984 bytes. Provided under BSD license.
(This image also exposes a bug with data files larger than 4 GiB - 1.)

After fix of kern/48787, and assumed the ISO is presented as /dev/cd0a

  mount -t cd9660 /dev/cd0a /mnt
  ls -li /mnt

I found two spots in /usr/src/bin/ls where ino_t is printed by
with conversion specifier "%*lu".

After changing these to "%*llu" and the casts from "(unsigned long)"
to "(unsigned long long)", i get shown by ls the same inode numbers
as by stat(1) and stat(2).

Home | Main Index | Thread Index | Old Index