xfs-masters
[Top] [All Lists]

[Bug 808] New: For Linux-2.6.28 kernel and XFS filesystem, glibc readdi

To: xfs-masters@xxxxxxxxxxx
Subject: [Bug 808] New: For Linux-2.6.28 kernel and XFS filesystem, glibc readdir misses final file in directory listings
From: bugzilla-daemon@xxxxxxxxxxx
Date: Sat, 27 Dec 2008 03:52:14 -0600
http://oss.sgi.com/bugzilla/show_bug.cgi?id=808

           Summary: For Linux-2.6.28 kernel and XFS filesystem, glibc
                    readdir misses final file in directory listings
           Product: Linux XFS
           Version: Current
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XFS kernel code
        AssignedTo: xfs-masters@xxxxxxxxxxx
        ReportedBy: jpsinthemix@xxxxxxxxxxx


This has occurred on a LFS-like system,using the following: linux-2.6.28,
glibc-2.8_20081222 and binutils-2.19. I first observed the problem when the
xorg-server (X11R7.4) build complained about not finding pixman, even though
pixman-1-0.13.2 was indeed installed. I then issued pkg-config --modversion
pixman-1 which found no package pixman-1, even though
/usr/lib/pkgconfig/pixman-1.pc was indeed present. So, I wrote a simple c
program to test directory listings using glibc readdir and found that it
consistently does not find one file in a directory (if there are enough files
contained in it), giving the error:
 "Value too large for defined data type" (errno: 75). I say, "enough files"
here, because this error does not happen for every directory: for directories
with only a few files, no problem, but for directories such as /usr/bin and
/usr/lib (and /usr/lib/pkgconfig) it does.

The c code to demonstrate this strange behavior is as follows
(build with: cc -o test_readdir test_readdir.c):
-----------------------------------------------------------------------------
// test_readdir.c

#include <sys/types.h>
#include <string.h>
#include <dirent.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>

void list_dir(const char *dir_name) {
    struct dirent *dent;

    DIR *dir = opendir(dir_name);

    if (!dir) {
        printf("Invalid/non-existent directory: %s\n", dir_name, strerror 
(errno));
        return;
    }
    printf("Files in %s:\n", dir_name);

    while ((dent = readdir (dir))) {
        printf("file: %s rc: %s\n", dent->d_name, strerror (errno));
    }
    printf("Finished with rc: %s (%d)\n", strerror (errno), errno);
}
int main(int argc, char *argv[]) {
    char *dir_name;

    if (argc > 1)
        dir_name = (char*) argv[1];
    else
        dir_name = (char*) "/usr/lib/pkgconfig";

    list_dir(dir_name);

    return(0);
}

----------------------------------------------------------------------------
Now, if I create a directory and create a whole bunch of empty files as follows:

mkdir ttt
for n in {1..168}; do touch ttt/$n;done

and issue test_readdir ttt, for {1..N}, N=1,2,..167, it works fine, but for
N=168, file "ttt/168" is not found and errno=75 is set. Delete ttt/168 and it
works again, add once more an arbitrary file and it fails.

I have done the above test on XFS file systems under linux-2.6.27.6/8/10 and the
problem does not occur--so it appears to have appeared with linux-2.6.28.

Also, under linux-2.6.28, the proble does not occur for ext2/ext3 partitions.

-- 
Configure bugmail: http://oss.sgi.com/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

<Prev in Thread] Current Thread [Next in Thread>
  • [Bug 808] New: For Linux-2.6.28 kernel and XFS filesystem, glibc readdir misses final file in directory listings, bugzilla-daemon <=