BusyBox Bug and Patch Tracking
BusyBox
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001098 [BusyBox] Other tweak always 11-21-06 07:47 12-21-06 16:47
Reporter ghost View Status public  
Assigned To BusyBox
Priority normal Resolution unable to reproduce  
Status closed   Product Version svn
Summary 0001098: 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



Additional Information Configured with: /usr/local/src/uclinux-tools/gcc-3.4.3/configure --target=arm-uclinux-elf --prefix=/usr/local/arm-uclinux-tools --enable-languages=c,c++ --enable-multilib --enable-target-optspace --with-gnu-ld --disable-nls --disable-__cxa_atexit --disable-c99 --disable-clocale --disable-c-mbchar --disable-long-long --disable-checking --enable-threads=posix --disable-libstdcxx-pch --enable-cxx-flags=-D_ISOC99_SOURCE -D_BSD_SOURCE
Thread model: posix
gcc version 3.4.3

CROSS_COMPILE=arm-uclinux-elf- ARCH=arm make

I have edited the Makefile (to compile flat binary):

quiet_cmd_busybox__ ?= LINK $@
ifdef CONFIG_STATIC
      cmd_busybox__ ?= $(srctree)/scripts/trylink $(CC) \
      -static \
      -o $@ \
      -Wl,--warn-common -Wl,--sort-common \
      -Wl,--start-group $(busybox-all) -Wl,--end-group \
      -Wl,-elf2flt -march=armv4 -mtune=arm940t
#-Wl,--gc-sections
else
      cmd_busybox__ ?= $(srctree)/scripts/trylink $(CC) -o $@ \
      -Wl,--warn-common -Wl,--sort-common -Wl,--gc-sections \
      -Wl,--start-group $(busybox-all) -Wl,--end-group \
      -Wl,-elf2flt -march=armv4 -mtune=arm940t
endif

------------------- patch (bit ugly):

  static struct dnode **list_dir(const char *path)
  {
        struct dnode *dn, *cur, **dnp;
--- 478,483 ----
*************** static struct dnode **list_dir(const cha
*** 496,504 ****
                status = EXIT_FAILURE;
                return NULL; /* could not open the dir */
        }
! while ((entry = readdir(dir)) != NULL) {
                char *fullname;
!
                /* are we going to list the file- it may be . or .. or a hidden file */
                if (entry->d_name[0] == '.') {
                        if ((entry->d_name[1] == 0 || (
--- 495,514 ----
                status = EXIT_FAILURE;
                return NULL; /* could not open the dir */
        }
! while (1) {
                char *fullname;
! FILE *fd=NULL;
! entry=NULL;
! entry = readdir(dir);
! if(!entry)
! {
! break;
! }
! fd=fopen("/dev/null","r");
! if(fd!=NULL){
! fprintf(fd,"%s",entry->d_name);
! fclose(fd);
! }
                /* are we going to list the file- it may be . or .. or a hidden file */
                if (entry->d_name[0] == '.') {
                        if ((entry->d_name[1] == 0 || (


----
Attached Files  .config [^] (17,309 bytes) 11-21-06 07:47

- Relationships

- Notes
(0001762)
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.
 
(0001766)
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
12-21-06 16:47 vda Resolution open => unable to reproduce


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker