[BusyBox] Bug in strings.c bb_unstable

Tito farmatito at tiscali.it
Sat Jan 4 06:18:03 UTC 2003


Hi and HAPPY NEW YEAR,

I've found a little bug in strings.c of bb_unstable:
if you do a: 

./busybox strings -fo chroot

you get:

chroot:-000004 /lib/ld-linux.so.2
chroot:-000004 libc.so.6
chroot:-000004 chroot
chroot:-000004 printf
chroot:-000004 getenv
chroot:-000004 puts
 
etc.

fix is trivial and patch is attached.

chroot:    244 /lib/ld-linux.so.2
chroot:    522 libc.so.6
chroot:    526 chroot
chroot:    530 printf
chroot:    534 getenv
chroot:    538 puts

I've changed to output formatting also to be the same as that of
GNU strings 2.12.90.0.15 20020717
and I've done a change in the getopts parsing.

BTW gcc reports:
/rep/busybox/miscutils/strings.c: In function `strings_main':
/rep/busybox/miscutils/strings.c:46: warning: `C' might be used uninitialized 
in this function

but I don't know whether this have to be fixed or not.

I've found another little problem while trying to compile bb-unstable snapshot  
with following options

# BusyBox general settings
#
# CONFIG_FEATURE_BUFFERS_USE_MALLOC is not set
CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y
# CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set
# CONFIG_FEATURE_VERBOSE_USAGE is not set
# CONFIG_FEATURE_INSTALLER is not set
# CONFIG_LOCALE_SUPPORT is not set
# CONFIG_FEATURE_DEVFS is not set
CONFIG_FEATURE_DEVPTS=y
# CONFIG_FEATURE_CLEAN_UP is not set
# CONFIG_FEATURE_SUID is not set
snip
#
# Login/Password Management Utilities
#
CONFIG_USE_BB_PWD_GRP=y
CONFIG_ADDGROUP=y
CONFIG_DELGROUP=y
CONFIG_ADDUSER=y
# CONFIG_DELUSER is not set
# CONFIG_GETTY is not set
# CONFIG_LOGIN is not set
# CONFIG_PASSWD is not set
CONFIG_SU=y
# CONFIG_FEATURE_SHADOWPASSWDS is not set
# CONFIG_SULOGIN is not set
# CONFIG_VLOCK is not set
 
but compiler says

/rep/busybox/applets/applets.a(applets.o)(.rodata+0xb8): undefined reference 
to `delgroup_main'
collect2: ld returned 1 exit status
make: *** [busybox] Error 1

maybe this has something to do with the fact  delgroup applet is in deluser.c 
file?
On the other hand if you do a first compile with

CONFIG_USE_BB_PWD_GRP=y
CONFIG_ADDGROUP=y
CONFIG_DELGROUP=y
CONFIG_ADDUSER=y
CONFIG_DELUSER=y

then remove deluser and recompile without doing a make clean
everything works fine and busybox correctly reports

root at localhost.localdomain:/dev/pts/1:/rep/busybox# ./busybox
BusyBox v0.61.pre (2002.11.25-13:35+0000) multi-call binary

Usage: busybox [function] [arguments]...
   or: [function] [arguments]...

        addgroup, adduser, ar, busybox, chgrp, chmod, chown, chroot, clear,
        cmp, cp, cpio, cut, date, dd, delgroup, df, dmesg, du, expr, false,
        find, freeramdisk, head, id, length, logname, logread, makedevs,
        md5sum, mkdir, mkfifo, mknod, mktemp, mv, readlink, renice, reset,
        sleep, sort, stty, su, sync, syslogd, tail, tee, touch, true,
        tty, uniq, unzip, update, wc, which

I can't figure out what is going on here so maybe the gurus will take a look
at it  ;-)

Bye, 
Tito

-------------- next part --------------
A non-text attachment was scrubbed...
Name: strings.c.diff
Type: text/x-diff
Size: 194 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20030104/102b68d6/attachment.bin 


More information about the busybox mailing list