Bug 125545 - Directory listing under Fedora core 2 is broken
Summary: Directory listing under Fedora core 2 is broken
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 2
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Arjan van de Ven
QA Contact: Brian Brock
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-06-08 16:56 UTC by Reiner Jung
Modified: 2007-11-30 22:10 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-06-19 02:09:41 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Reiner Jung 2004-06-08 16:56:00 UTC
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-19 02:09:41 UTC
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.