Bug 125545 - Directory listing under Fedora core 2 is broken
Directory listing under Fedora core 2 is broken
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: kernel (Show other bugs)
2
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Arjan van de Ven
Brian Brock
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-06-08 12:56 EDT by Reiner Jung
Modified: 2007-11-30 17:10 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-06-18 22:09:41 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Reiner Jung 2004-06-08 12:56:00 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; de-DE; rv:1.4.1)
Gecko/20031114

Description of problem:
We test to install additional software on Fedora Core 2. We test it on
2 different installations, different hardware and different CD sets.

The install from the software fails. We found out that the listing in
the filesystem is broken. A normally listing looks like. The software
which we want install was a apache application. 

.
..
one 
two

On FC2 the listing looks like

..
one
two 
.

First we thought it is a PHP problem but then we found out the the bug
can be reproduced with a small C programm also.

Here the PHP script

<?php        
  $d = opendir("/");        
  while (($f = readdir($d))) {                
  echo $f ."\n";        
  }        
  closedir($d);
?>


The C script will follow here

#include <stdio.h>
#include <dirent.h>
#include <sys/types.h>

int main(int argc, char *argv[]){        
   char *path;        
   DIR *d;        
   struct dirent *f;
                if (argc > 1) {
                path = argv[1];
        } else {
                path = ".";
        }
        d = opendir(path);
        if (d) {
                while ((f = readdir(d))) {                           
   printf("%s\n", f->d_name);  
              }                closedir(d);
        } else {
                printf("Failed to open directory '%s'\n", path);     
          return -1;
        }
        return 0;
}

Version-Release number of selected component (if applicable):
We don't know it is real a kernel problem 

How reproducible:
Always

Steps to Reproduce:
1. Copy the php script above to /var/www/html/
2. Open a browser and se the output

3. Compile the c sript and execute it
4. see the result
    

Actual Results:  Directory listing as above

..
one
two 
.


Additional info:

The following output of your script confirms the
problem:-------------- BOO -----------------------------
sys.
proc
boot
sbin
opt
lost+found
etc
mnt
dev
..
tmp
root
.
autofsck
usr
misc
lib
home
initrd
bin
var
selinux
--------------- EOO -----------------------------
Comment 1 Alan Cox 2004-06-18 22:09:41 EDT
This isn't a bug. The order of file names in a directory is undefined.
It used to approximate creation order (unless there were deletions),
but now with the much faster directory hash does not.

If you need a specific order you should be sorting them. 

Note You need to log in before you can comment on or make changes to this bug.