https://bugzilla.novell.com/show_bug.cgi?id=460560 Summary: readline library is not LFS aware, which makes bash completion fail on btrfs Product: openSUSE 11.2 Version: Alpha 0 Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: P5 - None Component: Basesystem AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: devzero@web.de QAContact: qa@suse.de CC: kasievers@novell.com Found By: --- bash completion is missing the last dirent on btrfs, as readdir() in readline lib is not 64bit/largefile aware. this is an exerpt from corresponding bash strace: open(".", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 fstat(3, {st_dev=makedev(0, 18), ... getdents64(3, { {d_ino=260, d_off=2, d_type=DT_DIR, d_reclen=24, d_name="."} {d_ino=256, d_off=2, d_type=DT_DIR, d_reclen=24, d_name=".."} {d_ino=261, d_off=3, d_type=DT_REG, d_reclen=24, d_name="a"} {d_ino=262, d_off=4, d_type=DT_REG, d_reclen=24, d_name="b"} {d_ino=263, d_off=5, d_type=DT_REG, d_reclen=24, d_name="c"} {d_ino=264, d_off=6, d_type=DT_DIR, d_reclen=24, d_name="test"} {d_ino=265, d_off=9223372036854775807, d_type=DT_DIR, d_reclen=32, d_name="linux"} }, 4096) = 176 getdents64(3, {}, 4096) = 0 close(3) mind that large value of d_off (d_name="linux") , this is LLONG_MAX. discussion thread at : http://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg01123.html some more info:
I see the same issue on x86 32 bit, with the additional __llseek() between the getdents64(), and the last entry returned by readdir ignored.
confirmed - it`s readdir which assumes 32bit. attached is a sample program which shows the issue on my system. if compiled with -D_FILE_OFFSET_BITS=64", the problem goes away. old posting from around 2001:
http://sourceware.org/ml/libc-alpha/2001-01/msg00216.html
This is why everybody will have to compile programs with _FILE_OFFSET_BITS=64. Did you ever notice that all GNU programs already do this?
as 32bit systems can use 64bit filesystems, i think btrfs is correct and bash is wrong, as it isn`t LFS aware. i think all 32bit stuff should be LFS aware, nowadays. to be exact, it`s not bash but readline library which comes with bash. bash configure script correctly checks for _FILE_OFFSET_BITS value, but readline configure script doesn`t. this explains why i could not reproduce the issue when i build bash without readline support. does it make sense to file a ticket at novell bugzilla ? regards roland linux:/btrfs # ls -ltr total 13 drwxrwxrwx 1 root root 0 Dec 16 22:44 test drwxrwxrwx 1 root root 1056 Dec 17 01:10 linux-2.6.27.8-1 drwxr-xr-x 1 root root 0 Dec 17 22:53 abc drwxr-xr-x 1 root root 0 Dec 19 00:48 bcd -rw-r--r-- 1 root root 443 Dec 19 01:15 example.c -rwxr-xr-x 1 root root 10962 Dec 19 01:15 a.out linux:/btrfs # ./a.out . . linux-2.6.27.8-1 test abc bcd example.c readdir: Value too large for defined data type regards roland #include <stdio.h> #include <sys/types.h> #include <dirent.h> #include <errno.h> #include <string.h> #include <stdlib.h> int main( int argc, char *argv[] ) { DIR *pDIR; struct dirent *pDirEnt; pDIR = opendir("."); pDirEnt = readdir( pDIR ); while ( pDirEnt != NULL ) { printf( "%s\n", pDirEnt->d_name ); pDirEnt = readdir( pDIR ); if (errno) perror("readdir"); } closedir( pDIR ); } as this problem only happens if bash is build with readline support, would it make sense to add _FILE_OFFSET_BITS=64 for readline lib ? furthermore, would it make sens to add some error handling in readline/complete.c ( if (errno) perror("readdir"); ) ? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.