[BusyBox 0001098]: ls cannot list /proc

bugs at busybox.net bugs at busybox.net
Fri Dec 22 00:47:23 UTC 2006


The following issue has been CLOSED 
====================================================================== 
http://busybox.net/bugs/view.php?id=1098 
====================================================================== 
Reported By:                ghost
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   1098
Category:                   Other
Reproducibility:            always
Severity:                   tweak
Priority:                   normal
Status:                     closed
Resolution:                 open
Fixed in Version:           
====================================================================== 
Date Submitted:             11-21-2006 07:47 PST
Last Modified:              12-21-2006 16:47 PST
====================================================================== 
Summary:                    ls cannot list /proc
Description: 
I have compiled the svn version (r16608)
mounted proc and try to list it with ls and with find:
$ cd proc
$ ls
$ 
$ find
.
./ibus
./crypto
./maps
./config.gz
./kallsyms
./iomem
./ioports
./cpu
./cpu/alignment
./scsi
./misc
./bus
./tty
./driver
./fs
./sys




====================================================================== 

---------------------------------------------------------------------- 
 vda - 11-21-06 11:32  
---------------------------------------------------------------------- 
Sorry. Patch is not in diff -u form, but it isn't the biggest problem.
Your code:

        while (1) {
                char *fullname;
                FILE *fd = NULL;
                entry = NULL;
                entry = readdir(dir);
                if(!entry) break;
                fd = fopen("/dev/null", "r");
                if (fd) {
                        fprintf(fd, "%s", entry->d_name);
                        fclose(fd);
                }

I would like to know what are you actually trying to do here? Do you
really need those back-to-back assignments? a=b; a=c; - ??! I find it hard
to believe that you need that.

I would also appreciate strace of the failing ls run, and of patched one. 

---------------------------------------------------------------------- 
 ghost - 11-22-06 02:13  
---------------------------------------------------------------------- 
It's a nommu system. My first fix was only a printf("%s",entry->d_name);
It was good, but the output was a mess. 
I have tried others:
1. printf("\n");
2. char *a;
     ...
     a=entry->d_name;

But non of them was good. 
My idea was to redirect the output to the /dev/null.
And it works for me. I can only guess, but this looks like a memory
handling bug. 
I cannot compile strace. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
11-21-06 07:47  ghost          New Issue                                    
11-21-06 07:47  ghost          Status                   new => assigned     
11-21-06 07:47  ghost          Assigned To               => BusyBox         
11-21-06 07:47  ghost          File Added: .config                          
11-21-06 08:06  ghost          Issue Monitored: ghost                       
11-21-06 11:32  vda            Note Added: 0001762                          
11-22-06 02:13  ghost          Note Added: 0001766                          
12-21-06 16:47  vda            Status                   assigned => closed  
======================================================================




More information about the busybox-cvs mailing list