From vda at busybox.net Sat Dec 1 17:43:23 2007 From: vda at busybox.net (vda at busybox.net) Date: Sat, 1 Dec 2007 17:43:23 -0800 (PST) Subject: svn commit: trunk/busybox/testsuite/dd Message-ID: <20071202014323.3BF9212854B@busybox.net> Author: vda Date: 2007-12-01 17:43:18 -0800 (Sat, 01 Dec 2007) New Revision: 20600 Log: dd: add testsuite entry for write errors Added: trunk/busybox/testsuite/dd/dd-reports-write-errors Changeset: Added: trunk/busybox/testsuite/dd/dd-reports-write-errors =================================================================== --- trunk/busybox/testsuite/dd/dd-reports-write-errors (rev 0) +++ trunk/busybox/testsuite/dd/dd-reports-write-errors 2007-12-02 01:43:18 UTC (rev 20600) @@ -0,0 +1,2 @@ +busybox dd if="$0" of=/dev/full 2>/dev/null || status=$? +test $status = 1 From vda at busybox.net Sat Dec 1 17:44:45 2007 From: vda at busybox.net (vda at busybox.net) Date: Sat, 1 Dec 2007 17:44:45 -0800 (PST) Subject: svn commit: trunk/busybox: coreutils testsuite Message-ID: <20071202014445.589B212854B@busybox.net> Author: vda Date: 2007-12-01 17:44:42 -0800 (Sat, 01 Dec 2007) New Revision: 20601 Log: dd: fix a bug where we don't report write errors testsuite: small cleanup full_write_or_warn 38 40 +2 write_and_stats 66 67 +1 dd_main 1358 1335 -23 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 3/-23) Total: -20 bytes Modified: trunk/busybox/coreutils/dd.c trunk/busybox/testsuite/runtest Changeset: Modified: trunk/busybox/coreutils/dd.c =================================================================== --- trunk/busybox/coreutils/dd.c 2007-12-02 01:43:18 UTC (rev 20600) +++ trunk/busybox/coreutils/dd.c 2007-12-02 01:44:42 UTC (rev 20601) @@ -14,6 +14,11 @@ /* This is a NOEXEC applet. Be very careful! */ +enum { + ifd = STDIN_FILENO, + ofd = STDOUT_FILENO, +}; + static const struct suffix_mult dd_suffixes[] = { { "c", 1 }, { "w", 2 }, @@ -45,19 +50,19 @@ G.out_full, G.out_part); } -static ssize_t full_write_or_warn(int fd, const void *buf, size_t len, +static ssize_t full_write_or_warn(const void *buf, size_t len, const char *const filename) { - ssize_t n = full_write(fd, buf, len); + ssize_t n = full_write(ofd, buf, len); if (n < 0) bb_perror_msg("writing '%s'", filename); return n; } -static bool write_and_stats(int fd, const void *buf, size_t len, size_t obs, +static bool write_and_stats(const void *buf, size_t len, size_t obs, const char *filename) { - ssize_t n = full_write_or_warn(fd, buf, len, filename); + ssize_t n = full_write_or_warn(buf, len, filename); if (n < 0) return 1; if (n == obs) @@ -105,13 +110,13 @@ OP_conv_noerror, #endif }; + int exitcode = EXIT_FAILURE; size_t ibs = 512, obs = 512; ssize_t n, w; char *ibuf, *obuf; /* And these are all zeroed at once! */ struct { int flags; - int ifd, ofd; size_t oc; off_t count; off_t seek, skip; @@ -121,8 +126,6 @@ #endif } Z; #define flags (Z.flags ) -#define ifd (Z.ifd ) -#define ofd (Z.ofd ) #define oc (Z.oc ) #define count (Z.count ) #define seek (Z.seek ) @@ -133,6 +136,7 @@ memset(&Z, 0, sizeof(Z)); INIT_G(); + //fflush(NULL); - is this needed because of NOEXEC? #if ENABLE_FEATURE_DD_SIGNAL_HANDLING sigact.sa_handler = dd_output_status; @@ -227,9 +231,8 @@ obuf = xmalloc(obs); } if (infile != NULL) - ifd = xopen(infile, O_RDONLY); + xmove_fd(xopen(infile, O_RDONLY), ifd); else { - /* ifd = STDIN_FILENO; - it's zero and it's already there */ infile = bb_msg_standard_input; } if (outfile != NULL) { @@ -238,7 +241,7 @@ if (!seek && !(flags & FLAG_NOTRUNC)) oflag |= O_TRUNC; - ofd = xopen(outfile, oflag); + xmove_fd(xopen(outfile, oflag), ofd); if (seek && !(flags & FLAG_NOTRUNC)) { if (ftruncate(ofd, seek * obs) < 0) { @@ -250,7 +253,6 @@ } } } else { - ofd = STDOUT_FILENO; outfile = bb_msg_standard_output; } if (skip) { @@ -276,11 +278,10 @@ if (n == 0) break; if (n < 0) { - if (flags & FLAG_NOERROR) { - n = ibs; - bb_simple_perror_msg(infile); - } else + if (!(flags & FLAG_NOERROR)) goto die_infile; + n = ibs; + bb_simple_perror_msg(infile); } if ((size_t)n == ibs) G.in_full++; @@ -303,17 +304,17 @@ tmp += d; oc += d; if (oc == obs) { - if (write_and_stats(ofd, obuf, obs, obs, outfile)) + if (write_and_stats(obuf, obs, obs, outfile)) goto out_status; oc = 0; } } - } else if (write_and_stats(ofd, ibuf, n, obs, outfile)) + } else if (write_and_stats(ibuf, n, obs, outfile)) goto out_status; } if (ENABLE_FEATURE_DD_IBS_OBS && oc) { - w = full_write_or_warn(ofd, obuf, oc, outfile); + w = full_write_or_warn(obuf, oc, outfile); if (w < 0) goto out_status; if (w > 0) G.out_part++; @@ -327,8 +328,10 @@ die_outfile: bb_simple_perror_msg_and_die(outfile); } + + exitcode = EXIT_SUCCESS; out_status: dd_output_status(0); - return EXIT_SUCCESS; + return exitcode; } Modified: trunk/busybox/testsuite/runtest =================================================================== --- trunk/busybox/testsuite/runtest 2007-12-02 01:43:18 UTC (rev 20600) +++ trunk/busybox/testsuite/runtest 2007-12-02 01:44:42 UTC (rev 20601) @@ -1,20 +1,20 @@ #!/bin/sh -# Run old-style test. - +# Run one old-style test. +# Tests are stored in applet/testcase shell scripts. +# They are run using "sh -x -e applet/testcase". +# Option -e will make testcase stop on the first failed command. run_applet_testcase() { local applet=$1 local testcase=$2 - local status=0 - local RES= - + local status local uc_applet=$(echo $applet | tr a-z A-Z) local testname=$(basename $testcase) if grep -q "^# CONFIG_${uc_applet} is not set$" $bindir/.config; then - echo UNTESTED: $testname + echo "UNTESTED: $testname" return 0 fi @@ -22,72 +22,67 @@ local feature=`sed -ne 's/^# FEATURE: //p' $testcase` if grep -q "^# ${feature} is not set$" $bindir/.config; then - echo UNTESTED: $testname + echo "UNTESTED: $testname" return 0 fi fi - rm -rf tmp - mkdir -p tmp - pushd tmp > /dev/null + rm -rf ".tmpdir.$applet" + mkdir -p ".tmpdir.$applet" + cd ".tmpdir.$applet" || return 1 -# echo Running testcase $testcase - d=$tsdir sh -x -e $testcase >.logfile.txt 2>&1 || status=$? - - if [ $status -ne 0 ]; then - echo FAIL: $testname - if [ $verbose -gt 0 ]; then - cat .logfile.txt +# echo "Running testcase $testcase" + d="$tsdir" sh -x -e "$testcase" >"$testname.stdout.txt" 2>&1 + status=$? + if [ $status != 0 ]; then + echo "FAIL: $testname" + if [ x"$VERBOSE" != x ]; then + cat "$testname.stdout.txt" fi - status=$? else - echo PASS: $testname - rm -f .logfile.txt - status=$? + echo "PASS: $testname" fi - popd > /dev/null - rm -rf tmp + cd .. + rm -rf ".tmpdir.$applet" return $status } +# Run all old-style tests for given applet run_applet_tests() { local applet=$1 - local status=0 - for testcase in $tsdir/$applet/*; do if [ "$testcase" = "$tsdir/$applet/CVS" ]; then continue fi - if ! run_applet_testcase $applet $testcase; then - status=1 - fi + run_applet_testcase $applet $testcase + test $? = 0 || status=1 done - return $status } -status=0 -verbose=0 [ -n "$tsdir" ] || tsdir=$(pwd) [ -n "$bindir" ] || bindir=$(dirname $(pwd)) PATH="$bindir:$PATH" +if [ x"$VERBOSE" = x ]; then + export VERBOSE= +fi + if [ x"$1" = x"-v" ]; then - verbose=1 - export VERBOSE=$verbose + export VERBOSE=1 shift fi implemented=$( $bindir/busybox 2>&1 | while read line; do - if test x"$line" = x"Currently defined functions:"; then + if [ x"$line" = x"Currently defined functions:" ]; then xargs | sed 's/,//g' break fi @@ -109,39 +104,34 @@ done # Set up option flags so tests can be selective. +export OPTIONFLAGS=:$(sed -nr 's/^CONFIG_//p' $bindir/.config | sed 's/=.*//' | xargs | sed 's/ /:/g') -configfile=${bindir}/.config -export OPTIONFLAGS=:$(sed -nr 's/^CONFIG_(.*)=.*/\1/p' $configfile | xargs | sed 's/ /:/g') - +status=0 for applet in $applets; do if [ "$applet" = "links" ]; then continue; fi + + # Any old-style tests for this applet? if [ "$applet" != "CVS" -a -d "$tsdir/$applet" ]; then - if ! run_applet_tests $applet; then - status=1 - fi + run_applet_tests "$applet" + test $? = 0 || status=1 fi # Is this a new-style test? - if [ -f ${applet}.tests ]; then + if [ -f "${applet}.tests" ]; then if [ ! -h "$LINKSDIR/$applet" ] && [ "${applet:0:4}" != "all_" ]; then echo "SKIPPED: $applet (not built)" continue fi - if PATH="$LINKSDIR:$tsdir:$bindir:$PATH" \ - "${tsdir:-.}/$applet".tests - then - : - else - status=1 - fi +# echo "Running test ${tsdir:-.}/${applet}.tests" + PATH="$LINKSDIR:$tsdir:$bindir:$PATH" "${tsdir:-.}/${applet}.tests" + test $? = 0 || status=1 fi - done # Leaving the dir makes it somewhat easier to run failed test by hand #rm -rf "$LINKSDIR" if [ $status != 0 -a x"$VERBOSE" = x ]; then - echo "Failures detected, running with VERBOSE=1 will give more info" + echo "Failures detected, running with -v (verbose) will give more info" fi exit $status From vda at busybox.net Sat Dec 1 19:27:42 2007 From: vda at busybox.net (vda at busybox.net) Date: Sat, 1 Dec 2007 19:27:42 -0800 (PST) Subject: svn commit: trunk/busybox/libbb Message-ID: <20071202032742.AFFBD12AFDB@busybox.net> Author: vda Date: 2007-12-01 19:27:42 -0800 (Sat, 01 Dec 2007) New Revision: 20602 Log: Introduce FEATURE_COPYBUF_KB. People who want smaller stack at any cost may use it to reduce cp's stack usage (FEATURE_COPYBUF_KB=1). Desktop people may get faster copy of big files (FEATURE_COPYBUF_KB=32 is ~30% faster than 4kb) Modified: trunk/busybox/libbb/Config.in trunk/busybox/libbb/copyfd.c Changeset: Modified: trunk/busybox/libbb/Config.in =================================================================== --- trunk/busybox/libbb/Config.in 2007-12-02 01:44:42 UTC (rev 20601) +++ trunk/busybox/libbb/Config.in 2007-12-02 03:27:42 UTC (rev 20602) @@ -110,6 +110,16 @@ Setting this option allows for prompts to use things like \w and \$ and escape codes. +config FEATURE_COPYBUF_KB + int "Copy buffer size, in kilobytes" + range 1 1024 + default 4 + help + Size of buffer used by cp, mv, install etc. + Buffers which are 4 kb or less will be allocated on stack. + Bigger buffers will be allocated with mmap, with fallback to 4 kb + stack buffer if mmap fails. + config MONOTONIC_SYSCALL bool "Use clock_gettime(CLOCK_MONOTONIC) syscall" default y Modified: trunk/busybox/libbb/copyfd.c =================================================================== --- trunk/busybox/libbb/copyfd.c 2007-12-02 01:44:42 UTC (rev 20601) +++ trunk/busybox/libbb/copyfd.c 2007-12-02 03:27:42 UTC (rev 20602) @@ -9,31 +9,42 @@ #include "libbb.h" -#if BUFSIZ < 4096 -#undef BUFSIZ -#define BUFSIZ 4096 -#endif - /* Used by NOFORK applets (e.g. cat) - must not use xmalloc */ static off_t bb_full_fd_action(int src_fd, int dst_fd, off_t size) { int status = -1; off_t total = 0; - char buffer[BUFSIZ]; +#if CONFIG_FEATURE_COPYBUF_KB <= 4 + char buffer[CONFIG_FEATURE_COPYBUF_KB * 1024]; + enum { buffer_size = sizeof(buffer) }; +#else + char *buffer; + int buffer_size; + buffer = mmap(NULL, CONFIG_FEATURE_COPYBUF_KB * 1024, + PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANON, + /* ignored: */ -1, 0); + buffer_size = CONFIG_FEATURE_COPYBUF_KB * 1024; + if (buffer == MAP_FAILED) { + buffer = alloca(4 * 1024); + buffer_size = 4 * 1024; + } +#endif + if (src_fd < 0) goto out; if (!size) { - size = BUFSIZ; + size = buffer_size; status = 1; /* copy until eof */ } while (1) { ssize_t rd; - rd = safe_read(src_fd, buffer, size > BUFSIZ ? BUFSIZ : size); + rd = safe_read(src_fd, buffer, size > buffer_size ? buffer_size : size); if (!rd) { /* eof - all done */ status = 0; @@ -62,6 +73,11 @@ } } out: + +#if CONFIG_FEATURE_COPYBUF_KB > 4 + if (buffer_size != 4 * 1024) + munmap(buffer, buffer_size); +#endif return status ? -1 : total; } From bugs at busybox.net Sat Dec 1 19:41:41 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Sat, 1 Dec 2007 19:41:41 -0800 Subject: [BusyBox 0001619]: BusyBox 1.8.2 fdisk doesn't read from stdin Message-ID: The following issue requires your FEEDBACK. ====================================================================== http://busybox.net/bugs/view.php?id=1619 ====================================================================== Reported By: vicser Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1619 Category: Standards Compliance Reproducibility: always Severity: major Priority: normal Status: feedback ====================================================================== Date Submitted: 11-30-2007 01:53 PST Last Modified: 12-01-2007 19:41 PST ====================================================================== Summary: BusyBox 1.8.2 fdisk doesn't read from stdin Description: busybox is used for unattended Linux installations. During the installation hard drive is partitioned by means of fdisk. fdisk is used in a batch mode. This means text file with fdisk commands is prepared - see attached fdisk-commands file (partition size values are variable, fdisk-commands is used to create 3 partitions -boot root and swap). And then fdisk-commands file is passed to fdisk through the stdin. Somthing like fdisk /dev/hda < fdisk-commands In all busybox till 1.7.3 this works fine But in busybox 1.8.0-1.8.2 fdisk doesn't read commands from stdin. ====================================================================== ---------------------------------------------------------------------- vda - 12-01-07 19:41 ---------------------------------------------------------------------- Just built busybox 1.8.2 and tested it: # echo q >Q # strace -o fdisk.log ./busybox fdisk /dev/sda1 assigned 11-30-07 01:53 vicser Assigned To => BusyBox 11-30-07 01:53 vicser File Added: fdisk-commands 11-30-07 02:04 vicser Issue Monitored: vicser 11-30-07 02:04 vicser Issue End Monitor: vicser 12-01-07 19:41 vda Note Added: 0002994 12-01-07 19:41 vda Status assigned => feedback ====================================================================== From vda at busybox.net Sat Dec 1 21:36:42 2007 From: vda at busybox.net (vda at busybox.net) Date: Sat, 1 Dec 2007 21:36:42 -0800 (PST) Subject: svn commit: trunk/busybox Message-ID: <20071202053642.CD6571285A5@busybox.net> Author: vda Date: 2007-12-01 21:36:37 -0800 (Sat, 01 Dec 2007) New Revision: 20603 Log: Fix minor discrepancy in "make help" Modified: trunk/busybox/Makefile.help Changeset: Modified: trunk/busybox/Makefile.help =================================================================== --- trunk/busybox/Makefile.help 2007-12-02 03:27:42 UTC (rev 20602) +++ trunk/busybox/Makefile.help 2007-12-02 05:36:37 UTC (rev 20603) @@ -24,10 +24,10 @@ @echo ' hosttools - build sed for the host.' @echo ' You can use these commands if the commands on the host' @echo ' is unusable. Afterwards use it like:' - @echo ' make SED="$(objtree)/sed"' + @echo ' make SED="$(objtree)/sed"' @echo @echo 'Installation:' - @echo ' install - install busybox into $(CONFIG_PREFIX)' + @echo ' install - install busybox into CONFIG_PREFIX' @echo ' uninstall' @echo @echo 'Development:' From vda at busybox.net Sat Dec 1 22:30:57 2007 From: vda at busybox.net (vda at busybox.net) Date: Sat, 1 Dec 2007 22:30:57 -0800 (PST) Subject: svn commit: trunk/busybox/networking/libiproute Message-ID: <20071202063057.CDCED12C3E5@busybox.net> Author: vda Date: 2007-12-01 22:30:57 -0800 (Sat, 01 Dec 2007) New Revision: 20604 Log: libnetlink: comment out unused code; don't use 8k stack buffers function old new delta ipaddr_modify 1305 1297 -8 do_iprule 963 955 -8 do_iproute 2193 2169 -24 xrtnl_dump_filter 418 391 -27 rtnl_talk 671 536 -135 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/5 up/down: 0/-202) Total: -202 bytes Modified: trunk/busybox/networking/libiproute/libnetlink.c trunk/busybox/networking/libiproute/libnetlink.h Changeset: Modified: trunk/busybox/networking/libiproute/libnetlink.c =================================================================== --- trunk/busybox/networking/libiproute/libnetlink.c 2007-12-02 05:36:37 UTC (rev 20603) +++ trunk/busybox/networking/libiproute/libnetlink.c 2007-12-02 06:30:57 UTC (rev 20604) @@ -108,9 +108,10 @@ int (*junk)(struct sockaddr_nl *, struct nlmsghdr *n, void *), void *arg2*/) { - char buf[8192]; + int retval = -1; + char *buf = xmalloc(8*1024); /* avoid big stack buffer */ struct sockaddr_nl nladdr; - struct iovec iov = { buf, sizeof(buf) }; + struct iovec iov = { buf, 8*1024 }; while (1) { int status; @@ -133,7 +134,7 @@ } if (status == 0) { bb_error_msg("EOF on netlink"); - return -1; + goto ret; } if (msg.msg_namelen != sizeof(nladdr)) { bb_error_msg_and_die("sender address length == %d", msg.msg_namelen); @@ -146,16 +147,18 @@ if (nladdr.nl_pid != 0 || h->nlmsg_pid != rth->local.nl_pid || h->nlmsg_seq != rth->dump) { -/* if (junk) { - err = junk(&nladdr, h, arg2); - if (err < 0) - return err; - } */ +// if (junk) { +// err = junk(&nladdr, h, arg2); +// if (err < 0) { +// retval = err; +// goto ret; +// } +// } goto skip_it; } if (h->nlmsg_type == NLMSG_DONE) { - return 0; + goto ret_0; } if (h->nlmsg_type == NLMSG_ERROR) { struct nlmsgerr *l_err = (struct nlmsgerr*)NLMSG_DATA(h); @@ -165,13 +168,15 @@ errno = -l_err->error; bb_perror_msg("RTNETLINK answers"); } - return -1; + goto ret; } err = filter(&nladdr, h, arg1); - if (err < 0) - return err; + if (err < 0) { + retval = err; + goto ret; + } -skip_it: + skip_it: h = NLMSG_NEXT(h, status); } if (msg.msg_flags & MSG_TRUNC) { @@ -181,7 +186,12 @@ if (status) { bb_error_msg_and_die("remnant of size %d!", status); } - } + } /* while (1) */ + ret_0: + retval++; /* = 0 */ + ret: + free(buf); + return retval; } int xrtnl_dump_filter(struct rtnl_handle *rth, @@ -194,17 +204,24 @@ return ret; } -int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, - unsigned groups, struct nlmsghdr *answer, - int (*junk)(struct sockaddr_nl *,struct nlmsghdr *n, void *), +int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, + pid_t peer, unsigned groups, + struct nlmsghdr *answer, + int (*junk)(struct sockaddr_nl *, struct nlmsghdr *n, void *), void *jarg) { +/* bbox doesn't use parameters no. 3, 4, 6, 7, they are stubbed out */ +#define peer 0 +#define groups 0 +#define junk NULL +#define jarg NULL + int retval = -1; int status; unsigned seq; struct nlmsghdr *h; struct sockaddr_nl nladdr; struct iovec iov = { (void*)n, n->nlmsg_len }; - char buf[8192]; + char *buf = xmalloc(8*1024); /* avoid big stack buffer */ struct msghdr msg = { (void*)&nladdr, sizeof(nladdr), &iov, 1, @@ -214,8 +231,8 @@ memset(&nladdr, 0, sizeof(nladdr)); nladdr.nl_family = AF_NETLINK; - nladdr.nl_pid = peer; - nladdr.nl_groups = groups; +// nladdr.nl_pid = peer; +// nladdr.nl_groups = groups; n->nlmsg_seq = seq = ++rtnl->seq; if (answer == NULL) { @@ -225,13 +242,13 @@ if (status < 0) { bb_perror_msg("cannot talk to rtnetlink"); - return -1; + goto ret; } iov.iov_base = buf; while (1) { - iov.iov_len = sizeof(buf); + iov.iov_len = 8*1024; status = recvmsg(rtnl->fd, &msg, 0); if (status < 0) { @@ -243,20 +260,20 @@ } if (status == 0) { bb_error_msg("EOF on netlink"); - return -1; + goto ret; } if (msg.msg_namelen != sizeof(nladdr)) { bb_error_msg_and_die("sender address length == %d", msg.msg_namelen); } for (h = (struct nlmsghdr*)buf; status >= sizeof(*h); ) { - int l_err; +// int l_err; int len = h->nlmsg_len; int l = len - sizeof(*h); - if (l<0 || len>status) { + if (l < 0 || len > status) { if (msg.msg_flags & MSG_TRUNC) { bb_error_msg("truncated message"); - return -1; + goto ret; } bb_error_msg_and_die("malformed message: len=%d!", len); } @@ -264,12 +281,13 @@ if (nladdr.nl_pid != peer || h->nlmsg_pid != rtnl->local.nl_pid || h->nlmsg_seq != seq) { - if (junk) { - l_err = junk(&nladdr, h, jarg); - if (l_err < 0) { - return l_err; - } - } +// if (junk) { +// l_err = junk(&nladdr, h, jarg); +// if (l_err < 0) { +// retval = l_err; +// goto ret; +// } +// } continue; } @@ -278,20 +296,20 @@ if (l < sizeof(struct nlmsgerr)) { bb_error_msg("ERROR truncated"); } else { - errno = -err->error; + errno = - err->error; if (errno == 0) { if (answer) { memcpy(answer, h, h->nlmsg_len); } - return 0; + goto ret_0; } bb_perror_msg("RTNETLINK answers"); } - return -1; + goto ret; } if (answer) { memcpy(answer, h, h->nlmsg_len); - return 0; + goto ret_0; } bb_error_msg("unexpected reply!"); @@ -306,7 +324,12 @@ if (status) { bb_error_msg_and_die("remnant of size %d!", status); } - } + } /* while (1) */ + ret_0: + retval++; /* = 0 */ + ret: + free(buf); + return retval; } int addattr32(struct nlmsghdr *n, int maxlen, int type, uint32_t data) Modified: trunk/busybox/networking/libiproute/libnetlink.h =================================================================== --- trunk/busybox/networking/libiproute/libnetlink.h 2007-12-02 05:36:37 UTC (rev 20603) +++ trunk/busybox/networking/libiproute/libnetlink.h 2007-12-02 06:30:57 UTC (rev 20604) @@ -24,10 +24,15 @@ extern int xrtnl_dump_filter(struct rtnl_handle *rth, int (*filter)(struct sockaddr_nl*, struct nlmsghdr *n, void*), void *arg1); + +/* bbox doesn't use parameters no. 3, 4, 6, 7, stub them out */ +#define rtnl_talk(rtnl, n, peer, groups, answer, junk, jarg) \ + rtnl_talk(rtnl, n, answer) extern int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n, pid_t peer, unsigned groups, struct nlmsghdr *answer, int (*junk)(struct sockaddr_nl *,struct nlmsghdr *n, void *), void *jarg); + extern int rtnl_send(struct rtnl_handle *rth, char *buf, int); From vda at busybox.net Sat Dec 1 23:18:32 2007 From: vda at busybox.net (vda at busybox.net) Date: Sat, 1 Dec 2007 23:18:32 -0800 (PST) Subject: svn commit: trunk/busybox/libbb Message-ID: <20071202071832.C973E1285B5@busybox.net> Author: vda Date: 2007-12-01 23:18:29 -0800 (Sat, 01 Dec 2007) New Revision: 20605 Log: explain why we use mmap instead of malloc Modified: trunk/busybox/libbb/copyfd.c Changeset: Modified: trunk/busybox/libbb/copyfd.c =================================================================== --- trunk/busybox/libbb/copyfd.c 2007-12-02 06:30:57 UTC (rev 20604) +++ trunk/busybox/libbb/copyfd.c 2007-12-02 07:18:29 UTC (rev 20605) @@ -22,6 +22,8 @@ char *buffer; int buffer_size; + /* We want page-aligned buffer, just in case kernel is clever + * and can do page-aligned io more efficiently */ buffer = mmap(NULL, CONFIG_FEATURE_COPYBUF_KB * 1024, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, From vda at busybox.net Sun Dec 2 00:35:43 2007 From: vda at busybox.net (vda at busybox.net) Date: Sun, 2 Dec 2007 00:35:43 -0800 (PST) Subject: svn commit: trunk/busybox: archival/bz scripts shell util-linux Message-ID: <20071202083543.B894F12C3E3@busybox.net> Author: vda Date: 2007-12-02 00:35:37 -0800 (Sun, 02 Dec 2007) New Revision: 20606 Log: attack the biggest stack users: -mkfs_minix_main [busybox_unstripped]: 4288 -mkfs_minix_main [busybox_unstripped]: 4276 -grave [busybox_unstripped]: 4260 (bzip2 users too - not listed) price we pay in code size increase: mainSort 2458 2515 +57 grave 1005 1058 +53 sendMTFValues 2177 2195 +18 BZ2_blockSort 122 125 +3 mkfs_minix_main 3070 3022 -48 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/1 up/down: 131/-48) Total: 83 bytes Modified: trunk/busybox/Makefile.custom trunk/busybox/archival/bz/blocksort.c trunk/busybox/archival/bz/bzlib_private.h trunk/busybox/archival/bz/compress.c trunk/busybox/archival/bz/huffman.c trunk/busybox/scripts/checkstack.pl trunk/busybox/shell/msh.c trunk/busybox/util-linux/mkfs_minix.c Changeset: Modified: trunk/busybox/Makefile.custom =================================================================== --- trunk/busybox/Makefile.custom 2007-12-02 07:18:29 UTC (rev 20605) +++ trunk/busybox/Makefile.custom 2007-12-02 08:35:37 UTC (rev 20606) @@ -90,7 +90,7 @@ .PHONY: stksizes stksizes: busybox_unstripped - $(CROSS_COMPILE)objdump -d busybox_unstripped | $(srctree)/scripts/checkstack.pl $(ARCH) + $(CROSS_COMPILE)objdump -d busybox_unstripped | $(srctree)/scripts/checkstack.pl $(ARCH) | uniq .PHONY: bigdata bigdata: busybox_unstripped Modified: trunk/busybox/archival/bz/blocksort.c =================================================================== --- trunk/busybox/archival/bz/blocksort.c 2007-12-02 07:18:29 UTC (rev 20605) +++ trunk/busybox/archival/bz/blocksort.c 2007-12-02 08:35:37 UTC (rev 20606) @@ -721,7 +721,8 @@ #define CLEARMASK (~(SETMASK)) static NOINLINE -void mainSort(uint32_t* ptr, +void mainSort(EState* state, + uint32_t* ptr, uint8_t* block, uint16_t* quadrant, uint32_t* ftab, @@ -729,13 +730,18 @@ int32_t* budget) { int32_t i, j, k, ss, sb; + uint8_t c1; + int32_t numQSorted; + uint16_t s; + Bool bigDone[256]; + /* bbox: moved to EState to save stack int32_t runningOrder[256]; - Bool bigDone[256]; int32_t copyStart[256]; int32_t copyEnd [256]; - uint8_t c1; - int32_t numQSorted; - uint16_t s; + */ +#define runningOrder (state->mainSort__runningOrder) +#define copyStart (state->mainSort__copyStart) +#define copyEnd (state->mainSort__copyEnd) /*-- set up the 2-byte frequency table --*/ /* was: for (i = 65536; i >= 0; i--) ftab[i] = 0; */ @@ -985,6 +991,9 @@ AssertH(((bbSize-1) >> shifts) <= 65535, 1002); } } +#undef runningOrder +#undef copyStart +#undef copyEnd } #undef BIGFREQ @@ -1041,7 +1050,7 @@ */ budget = nblock * ((wfact-1) / 3); - mainSort(ptr, block, quadrant, ftab, nblock, &budget); + mainSort(s, ptr, block, quadrant, ftab, nblock, &budget); if (budget < 0) { fallbackSort(s->arr1, s->arr2, ftab, nblock); } Modified: trunk/busybox/archival/bz/bzlib_private.h =================================================================== --- trunk/busybox/archival/bz/bzlib_private.h 2007-12-02 07:18:29 UTC (rev 20605) +++ trunk/busybox/archival/bz/bzlib_private.h 2007-12-02 08:35:37 UTC (rev 20606) @@ -178,13 +178,22 @@ uint8_t selector [BZ_MAX_SELECTORS]; uint8_t selectorMtf[BZ_MAX_SELECTORS]; - uint8_t len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; - int32_t code [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; - int32_t rfreq[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; + uint8_t len[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; + + /* stack-saving measures: these can be local, but they are too big */ + int32_t sendMTFValues__code [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; + int32_t sendMTFValues__rfreq[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; #if CONFIG_BZIP2_FEATURE_SPEED >= 5 /* second dimension: only 3 needed; 4 makes index calculations faster */ - uint32_t len_pack[BZ_MAX_ALPHA_SIZE][4]; + uint32_t sendMTFValues__len_pack[BZ_MAX_ALPHA_SIZE][4]; #endif + int32_t BZ2_hbMakeCodeLengths__heap [BZ_MAX_ALPHA_SIZE + 2]; + int32_t BZ2_hbMakeCodeLengths__weight[BZ_MAX_ALPHA_SIZE * 2]; + int32_t BZ2_hbMakeCodeLengths__parent[BZ_MAX_ALPHA_SIZE * 2]; + + int32_t mainSort__runningOrder[256]; + int32_t mainSort__copyStart[256]; + int32_t mainSort__copyEnd[256]; } EState; @@ -203,7 +212,7 @@ BZ2_hbAssignCodes(int32_t*, uint8_t*, int32_t, int32_t, int32_t); static void -BZ2_hbMakeCodeLengths(uint8_t*, int32_t*, int32_t, int32_t); +BZ2_hbMakeCodeLengths(EState*, uint8_t*, int32_t*, int32_t, int32_t); /*-------------------------------------------------------------*/ /*--- end bzlib_private.h ---*/ Modified: trunk/busybox/archival/bz/compress.c =================================================================== --- trunk/busybox/archival/bz/compress.c 2007-12-02 07:18:29 UTC (rev 20605) +++ trunk/busybox/archival/bz/compress.c 2007-12-02 08:35:37 UTC (rev 20606) @@ -264,13 +264,16 @@ * are also globals only used in this proc. * Made global to keep stack frame size small. */ +#define code sendMTFValues__code +#define rfreq sendMTFValues__rfreq +#define len_pack sendMTFValues__len_pack uint16_t cost[BZ_N_GROUPS]; int32_t fave[BZ_N_GROUPS]; uint16_t* mtfv = s->mtfv; - alphaSize = s->nInUse+2; + alphaSize = s->nInUse + 2; for (t = 0; t < BZ_N_GROUPS; t++) for (v = 0; v < alphaSize; v++) s->len[t][v] = BZ_GREATER_ICOST; @@ -453,7 +456,7 @@ /* maxLen was changed from 20 to 17 in bzip2-1.0.3. See * comment in huffman.c for details. */ for (t = 0; t < nGroups; t++) - BZ2_hbMakeCodeLengths(&(s->len[t][0]), &(s->rfreq[t][0]), alphaSize, 17 /*20*/); + BZ2_hbMakeCodeLengths(s, &(s->len[t][0]), &(s->rfreq[t][0]), alphaSize, 17 /*20*/); } AssertH(nGroups < 8, 3002); @@ -602,6 +605,9 @@ selCtr++; } AssertH(selCtr == nSelectors, 3007); +#undef code +#undef rfreq +#undef len_pack } Modified: trunk/busybox/archival/bz/huffman.c =================================================================== --- trunk/busybox/archival/bz/huffman.c 2007-12-02 07:18:29 UTC (rev 20605) +++ trunk/busybox/archival/bz/huffman.c 2007-12-02 08:35:37 UTC (rev 20606) @@ -98,7 +98,8 @@ /*---------------------------------------------------*/ static -void BZ2_hbMakeCodeLengths(uint8_t *len, +void BZ2_hbMakeCodeLengths(EState *s, + uint8_t *len, int32_t *freq, int32_t alphaSize, int32_t maxLen) @@ -110,9 +111,14 @@ int32_t nNodes, nHeap, n1, n2, i, j, k; Bool tooLong; + /* bbox: moved to EState to save stack int32_t heap [BZ_MAX_ALPHA_SIZE + 2]; int32_t weight[BZ_MAX_ALPHA_SIZE * 2]; int32_t parent[BZ_MAX_ALPHA_SIZE * 2]; + */ +#define heap (s->BZ2_hbMakeCodeLengths__heap) +#define weight (s->BZ2_hbMakeCodeLengths__weight) +#define parent (s->BZ2_hbMakeCodeLengths__parent) for (i = 0; i < alphaSize; i++) weight[i+1] = (freq[i] == 0 ? 1 : freq[i]) << 8; @@ -189,6 +195,9 @@ weight[i] = j << 8; } } +#undef heap +#undef weight +#undef parent } Modified: trunk/busybox/scripts/checkstack.pl =================================================================== --- trunk/busybox/scripts/checkstack.pl 2007-12-02 07:18:29 UTC (rev 20605) +++ trunk/busybox/scripts/checkstack.pl 2007-12-02 08:35:37 UTC (rev 20606) @@ -126,7 +126,8 @@ $addr =~ s/ /0/g; $addr = "0x$addr"; - my $intro = "$addr $func [$file]:"; + # bbox: was: my $intro = "$addr $func [$file]:"; + my $intro = "$func [$file]:"; my $padlen = 56 - length($intro); while ($padlen > 0) { $intro .= ' '; Modified: trunk/busybox/shell/msh.c =================================================================== --- trunk/busybox/shell/msh.c 2007-12-02 07:18:29 UTC (rev 20605) +++ trunk/busybox/shell/msh.c 2007-12-02 08:35:37 UTC (rev 20606) @@ -735,6 +735,9 @@ char filechar_cmdbuf[BUFSIZ]; char line[LINELIM]; char child_cmd[LINELIM]; + + char grave__var_name[LINELIM]; + char grave__alt_value[LINELIM]; }; #define G (*ptr_to_globals) @@ -746,6 +749,9 @@ #define filechar_cmdbuf (G.filechar_cmdbuf) #define line (G.line ) #define child_cmd (G.child_cmd ) +#define INIT_G() do { \ + PTR_TO_GLOBALS = xzalloc(sizeof(G)); \ +} while (0) #ifdef MSHDEBUG @@ -4042,8 +4048,12 @@ ignore_once = 1; if (*src == '$' && !ignore && !ignore_once) { struct var *vp; + /* moved to G to reduce stack usage char var_name[LINELIM]; char alt_value[LINELIM]; + */ +#define var_name (G.grave__var_name) +#define alt_value (G.grave__alt_value) int var_index = 0; int alt_index = 0; char operator = 0; @@ -4131,6 +4141,8 @@ count++; } } +#undef var_name +#undef alt_value } else { *dest++ = *src++; count++; @@ -5173,7 +5185,8 @@ char *name, **ap; int (*iof) (struct ioarg *); - PTR_TO_GLOBALS = xzalloc(sizeof(G)); + INIT_G(); + sharedbuf.id = AFID_NOBUF; mainbuf.id = AFID_NOBUF; e.linep = line; Modified: trunk/busybox/util-linux/mkfs_minix.c =================================================================== --- trunk/busybox/util-linux/mkfs_minix.c 2007-12-02 07:18:29 UTC (rev 20605) +++ trunk/busybox/util-linux/mkfs_minix.c 2007-12-02 08:35:37 UTC (rev 20606) @@ -109,16 +109,22 @@ unsigned long req_nr_inodes; unsigned currently_testing; - char root_block[BLOCK_SIZE]; char super_block_buffer[BLOCK_SIZE]; char boot_block_buffer[512]; unsigned short good_blocks_table[MAX_GOOD_BLOCKS]; /* check_blocks(): buffer[] was the biggest static in entire bbox */ char check_blocks_buffer[BLOCK_SIZE * TEST_BUFFER_BLOCKS]; + + unsigned short ind_block1[BLOCK_SIZE >> 1]; + unsigned short dind_block1[BLOCK_SIZE >> 1]; + unsigned long ind_block2[BLOCK_SIZE >> 2]; + unsigned long dind_block2[BLOCK_SIZE >> 2]; }; - #define G (*ptr_to_globals) +#define INIT_G() do { \ + PTR_TO_GLOBALS = xzalloc(sizeof(G)); \ +} while (0) static ALWAYS_INLINE unsigned div_roundup(unsigned size, unsigned n) { @@ -306,8 +312,12 @@ struct minix1_inode *inode = &INODE_BUF1[MINIX_BAD_INO]; int i, j, zone; int ind = 0, dind = 0; + /* moved to globals to reduce stack usage unsigned short ind_block[BLOCK_SIZE >> 1]; unsigned short dind_block[BLOCK_SIZE >> 1]; + */ +#define ind_block (G.ind_block1) +#define dind_block (G.dind_block1) #define NEXT_BAD (zone = next(zone)) @@ -351,6 +361,8 @@ write_block(ind, (char *) ind_block); if (dind) write_block(dind, (char *) dind_block); +#undef ind_block +#undef dind_block } #if ENABLE_FEATURE_MINIX2 @@ -359,8 +371,12 @@ struct minix2_inode *inode = &INODE_BUF2[MINIX_BAD_INO]; int i, j, zone; int ind = 0, dind = 0; + /* moved to globals to reduce stack usage unsigned long ind_block[BLOCK_SIZE >> 2]; unsigned long dind_block[BLOCK_SIZE >> 2]; + */ +#define ind_block (G.ind_block2) +#define dind_block (G.dind_block2) if (!G.badblocks) return; @@ -401,6 +417,8 @@ write_block(ind, (char *) ind_block); if (dind) write_block(dind, (char *) dind_block); +#undef ind_block +#undef dind_block } #else void make_bad_inode2(void); @@ -613,7 +631,7 @@ char *str_i, *str_n; char *listfile = NULL; - PTR_TO_GLOBALS = xzalloc(sizeof(G)); + INIT_G(); /* default (changed to 30, per Linus's suggestion, Sun Nov 21 08:05:07 1993) */ G.namelen = 30; G.dirsize = 32; From vda at busybox.net Sun Dec 2 00:55:41 2007 From: vda at busybox.net (vda at busybox.net) Date: Sun, 2 Dec 2007 00:55:41 -0800 (PST) Subject: svn commit: trunk/busybox: testsuite util-linux Message-ID: <20071202085541.527FB12850B@busybox.net> Author: vda Date: 2007-12-02 00:55:34 -0800 (Sun, 02 Dec 2007) New Revision: 20607 Log: mkfs.minix: add testsuite; disable code which makes images variable Added: trunk/busybox/testsuite/mkfs.minix.tests Modified: trunk/busybox/util-linux/mkfs_minix.c Changeset: Added: trunk/busybox/testsuite/mkfs.minix.tests =================================================================== --- trunk/busybox/testsuite/mkfs.minix.tests (rev 0) +++ trunk/busybox/testsuite/mkfs.minix.tests 2007-12-02 08:55:34 UTC (rev 20607) @@ -0,0 +1,22 @@ +#!/bin/sh + +# mkfs.minix tests. +# Copyright 2007 by Denys Vlasenko +# Licensed under GPL v2, see file LICENSE for details. + +. testing.sh + +# testing "test name" "options" "expected result" "file input" "stdin" + +testing "mkfs.minix" \ + "dd if=/dev/zero of=input bs=1k count=1024 2>/dev/null; mkfs.minix input; md5sum Author: vda Date: 2007-12-02 00:56:53 -0800 (Sun, 02 Dec 2007) New Revision: 20608 Log: fix whitespace damage Modified: trunk/busybox/networking/udhcp/Config.in Changeset: Modified: trunk/busybox/networking/udhcp/Config.in =================================================================== --- trunk/busybox/networking/udhcp/Config.in 2007-12-02 08:55:34 UTC (rev 20607) +++ trunk/busybox/networking/udhcp/Config.in 2007-12-02 08:56:53 UTC (rev 20608) @@ -104,4 +104,4 @@ seems to confuse maximum allowed UDP packet size with maximum size of entire IP packet, and sends packets which are 28 bytes too large. - Seednet (ISP) VDSL: sends packets 2 bytes too big. + Seednet (ISP) VDSL: sends packets 2 bytes too big. From bugs at busybox.net Sun Dec 2 20:22:42 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Sun, 2 Dec 2007 20:22:42 -0800 Subject: [BusyBox 0001624]: Help Message-ID: The following issue has been SUBMITTED. ====================================================================== http://busybox.net/bugs/view.php?id=1624 ====================================================================== Reported By: draganmk Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1624 Category: Documentation Reproducibility: always Severity: minor Priority: normal Status: assigned ====================================================================== Date Submitted: 12-02-2007 20:22 PST Last Modified: 12-02-2007 20:22 PST ====================================================================== Summary: Help Description: help ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 12-02-07 20:22 draganmk New Issue 12-02-07 20:22 draganmk Status new => assigned 12-02-07 20:22 draganmk Assigned To => BusyBox ====================================================================== From bugs at busybox.net Mon Dec 3 00:47:14 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Mon, 3 Dec 2007 00:47:14 -0800 Subject: [BusyBox 0001624]: Help Message-ID: <3a8bbf104fa3bc3aef9c181fb339a7be@busybox.net> The following issue has been CLOSED ====================================================================== http://busybox.net/bugs/view.php?id=1624 ====================================================================== Reported By: draganmk Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1624 Category: Documentation Reproducibility: always Severity: minor Priority: normal Status: closed Resolution: open Fixed in Version: ====================================================================== Date Submitted: 12-02-2007 20:22 PST Last Modified: 12-03-2007 00:47 PST ====================================================================== Summary: Help Description: help ====================================================================== ---------------------------------------------------------------------- vda - 12-03-07 00:47 ---------------------------------------------------------------------- Please post your question to busybox mailing list. And also explain what psyBNC is, most people will have no idea what's that. As it is currently written, your question is almost impossible to understand. Issue History Date Modified Username Field Change ====================================================================== 12-02-07 20:22 draganmk New Issue 12-02-07 20:22 draganmk Status new => assigned 12-02-07 20:22 draganmk Assigned To => BusyBox 12-03-07 00:47 vda Status assigned => closed 12-03-07 00:47 vda Note Added: 0002999 ====================================================================== From vda at busybox.net Mon Dec 3 02:45:17 2007 From: vda at busybox.net (vda at busybox.net) Date: Mon, 3 Dec 2007 02:45:17 -0800 (PST) Subject: svn commit: trunk/busybox: libbb networking Message-ID: <20071203104517.A2A5412854B@busybox.net> Author: vda Date: 2007-12-03 02:45:14 -0800 (Mon, 03 Dec 2007) New Revision: 20610 Log: lineedit: reduce stack usage netstat: reduce stack usage; fix handling of NULs in unix socket filenames static.has_inode 1 - -1 do_info 119 116 -3 deinit_S 60 51 -9 unix_do_one 578 451 -127 parse_and_put_prompt 966 825 -141 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 0/4 up/down: 0/-281) Total: -281 bytes Modified: trunk/busybox/libbb/lineedit.c trunk/busybox/networking/netstat.c Changeset: Modified: trunk/busybox/libbb/lineedit.c =================================================================== --- trunk/busybox/libbb/lineedit.c 2007-12-03 08:59:12 UTC (rev 20609) +++ trunk/busybox/libbb/lineedit.c 2007-12-03 10:45:14 UTC (rev 20610) @@ -91,7 +91,6 @@ const char *cmdedit_prompt; #if ENABLE_FEATURE_EDITING_FANCY_PROMPT - char *hostname_buf; int num_ok_lines; /* = 1; */ #endif @@ -136,7 +135,6 @@ #define command_len (S.command_len ) #define command_ps (S.command_ps ) #define cmdedit_prompt (S.cmdedit_prompt ) -#define hostname_buf (S.hostname_buf ) #define num_ok_lines (S.num_ok_lines ) #define user_buf (S.user_buf ) #define home_pwd_buf (S.home_pwd_buf ) @@ -155,7 +153,6 @@ static void deinit_S(void) { #if ENABLE_FEATURE_EDITING_FANCY_PROMPT - free(hostname_buf); /* This one is allocated only if FANCY_PROMPT is on * (otherwise it points to verbatim prompt (NOT malloced) */ free((char*)cmdedit_prompt); @@ -381,14 +378,14 @@ if (with_shash_flg) { /* "~/..." or "~user/..." */ char *sav_ud = ud - 1; char *home = NULL; - char *temp; if (*ud == '/') { /* "~/..." */ home = home_pwd_buf; } else { /* "~user/..." */ + char *temp; temp = strchr(ud, '/'); - *temp = 0; /* ~user\0 */ + *temp = '\0'; /* ~user\0 */ entry = getpwnam(ud); *temp = '/'; /* restore ~user/... */ ud = temp; @@ -1163,21 +1160,23 @@ size_t cur_prmt_len = 0; char flg_not_length = '['; char *prmt_mem_ptr = xzalloc(1); - char *pwd_buf = xrealloc_getcwd_or_warn(NULL); - char buf2[PATH_MAX + 1]; - char buf[2]; + char *cwd_buf = xrealloc_getcwd_or_warn(NULL); + char cbuf[2]; char c; char *pbuf; cmdedit_prmt_len = 0; - if (!pwd_buf) { - pwd_buf = (char *)bb_msg_unknown; + if (!cwd_buf) { + cwd_buf = (char *)bb_msg_unknown; } + cbuf[1] = '\0'; /* never changes */ + while (*prmt_ptr) { - pbuf = buf; - pbuf[1] = 0; + char *free_me = NULL; + + pbuf = cbuf; c = *prmt_ptr++; if (c == '\\') { const char *cp = prmt_ptr; @@ -1188,6 +1187,7 @@ if (*cp == '\0') break; c = *prmt_ptr++; + switch (c) { #if ENABLE_FEATURE_GETUSERNAME_AND_HOMEDIR case 'u': @@ -1195,87 +1195,81 @@ break; #endif case 'h': - pbuf = hostname_buf; - if (!pbuf) { - pbuf = xzalloc(256); - if (gethostname(pbuf, 255) < 0) { - strcpy(pbuf, "?"); - } else { - char *s = strchr(pbuf, '.'); - if (s) - *s = '\0'; - } - hostname_buf = pbuf; + pbuf = free_me = xzalloc(256); + if (gethostname(pbuf, 255) < 0) { + pbuf[0] = '?'; + pbuf[1] = '\0'; } + *strchrnul(pbuf, '.') = '\0'; break; case '$': c = (geteuid() == 0 ? '#' : '$'); break; #if ENABLE_FEATURE_GETUSERNAME_AND_HOMEDIR case 'w': - pbuf = pwd_buf; + /* /home/user[/something] -> ~[/something] */ + pbuf = cwd_buf; l = strlen(home_pwd_buf); if (l != 0 - && strncmp(home_pwd_buf, pbuf, l) == 0 - && (pbuf[l]=='/' || pbuf[l]=='\0') - && strlen(pwd_buf+l) < PATH_MAX + && strncmp(home_pwd_buf, cwd_buf, l) == 0 + && (cwd_buf[l]=='/' || cwd_buf[l]=='\0') + && strlen(cwd_buf + l) < PATH_MAX ) { - pbuf = buf2; - *pbuf = '~'; - strcpy(pbuf+1, pwd_buf+l); + pbuf = free_me = xasprintf("~%s", cwd_buf + l); } break; #endif case 'W': - pbuf = pwd_buf; + pbuf = cwd_buf; cp = strrchr(pbuf, '/'); if (cp != NULL && cp != pbuf) pbuf += (cp-pbuf) + 1; break; case '!': - pbuf = buf2; - snprintf(buf2, sizeof(buf2), "%d", num_ok_lines); + pbuf = free_me = xasprintf("%d", num_ok_lines); break; case 'e': case 'E': /* \e \E = \033 */ c = '\033'; break; - case 'x': case 'X': + case 'x': case 'X': { + char buf2[4]; for (l = 0; l < 3;) { - int h; + unsigned h; buf2[l++] = *prmt_ptr; - buf2[l] = 0; - h = strtol(buf2, &pbuf, 16); + buf2[l] = '\0'; + h = strtoul(buf2, &pbuf, 16); if (h > UCHAR_MAX || (pbuf - buf2) < l) { - l--; + buf2[--l] = '\0'; break; } prmt_ptr++; } - buf2[l] = 0; - c = (char)strtol(buf2, NULL, 16); + c = (char)strtoul(buf2, NULL, 16); if (c == 0) c = '?'; - pbuf = buf; + pbuf = cbuf; break; + } case '[': case ']': if (c == flg_not_length) { flg_not_length = (flg_not_length == '[' ? ']' : '['); continue; } break; - } - } - } - if (pbuf == buf) - *pbuf = c; + } /* switch */ + } /* if */ + } /* if */ + cbuf[0] = c; cur_prmt_len = strlen(pbuf); prmt_len += cur_prmt_len; if (flg_not_length != ']') cmdedit_prmt_len += cur_prmt_len; prmt_mem_ptr = strcat(xrealloc(prmt_mem_ptr, prmt_len+1), pbuf); - } - if (pwd_buf != (char *)bb_msg_unknown) - free(pwd_buf); + free(free_me); + } /* while */ + + if (cwd_buf != (char *)bb_msg_unknown) + free(cwd_buf); cmdedit_prompt = prmt_mem_ptr; put_prompt(); } @@ -1397,7 +1391,6 @@ if (entry) { user_buf = xstrdup(entry->pw_name); home_pwd_buf = xstrdup(entry->pw_dir); - /* They are not freed on exit (too small to bother) */ } } #endif Modified: trunk/busybox/networking/netstat.c =================================================================== --- trunk/busybox/networking/netstat.c 2007-12-03 08:59:12 UTC (rev 20609) +++ trunk/busybox/networking/netstat.c 2007-12-03 10:45:14 UTC (rev 20610) @@ -148,7 +148,7 @@ return host_port; } -static void tcp_do_one(int lnr, const char *line) +static void tcp_do_one(int lnr, char *line) { char local_addr[64], rem_addr[64]; char more[512]; @@ -201,7 +201,7 @@ } } -static void udp_do_one(int lnr, const char *line) +static void udp_do_one(int lnr, char *line) { char local_addr[64], rem_addr[64]; const char *state_str; @@ -283,7 +283,7 @@ } } -static void raw_do_one(int lnr, const char *line) +static void raw_do_one(int lnr, char *line) { char local_addr[64], rem_addr[64]; char more[512]; @@ -339,31 +339,37 @@ } } -static void unix_do_one(int nr, const char *line) +static void unix_do_one(int nr, char *line) { - static smallint has_inode = 0; - - char path[PATH_MAX], ss_flags[32]; + unsigned long refcnt, proto, unix_flags; + unsigned long inode; + int type, state; + int num, path_ofs; + void *d; const char *ss_proto, *ss_state, *ss_type; - int num, state, type, inode; - void *d; - unsigned long refcnt, proto, unix_flags; + char ss_flags[32]; - if (nr == 0) { - if (strstr(line, "Inode")) - has_inode = 1; - return; + if (nr == 0) + return; /* skip header */ + + { + char *last = last_char_is(line, '\n'); + if (last) + *last = '\0'; } - path[0] = '\0'; - num = sscanf(line, "%p: %lX %lX %lX %X %X %d %s", - &d, &refcnt, &proto, &unix_flags, &type, &state, &inode, path); - if (num < 6) { - bb_error_msg("warning, got bogus unix line"); + + /* 2.6.15 may report lines like "... @/tmp/fam-user-^@^@^@^@^@^@^@..." + * (those ^@ are NUL bytes). fgets sees them as tons of empty lines. */ + if (!line[0]) return; + + path_ofs = 0; /* paranoia */ + num = sscanf(line, "%p: %lX %lX %lX %X %X %lu %n", + &d, &refcnt, &proto, &unix_flags, &type, &state, &inode, &path_ofs); + if (num < 7) { + bb_error_msg("got bogus unix line '%s'", line); + return; } - if (!has_inode) - sprintf(path, "%d", inode); - if ((flags & (NETSTAT_LISTENING|NETSTAT_CONNECTED)) != (NETSTAT_LISTENING|NETSTAT_CONNECTED)) { if ((state == SS_UNCONNECTED) && (unix_flags & SO_ACCEPTCON)) { if (!(flags & NETSTAT_LISTENING)) @@ -439,13 +445,9 @@ strcat(ss_flags, "N "); strcat(ss_flags, "]"); - printf("%-5s %-6ld %-11s %-10s %-13s ", - ss_proto, refcnt, ss_flags, ss_type, ss_state); - if (has_inode) - printf("%-6d ", inode); - else - printf("- "); - puts(path); + printf("%-5s %-6ld %-11s %-10s %-13s %6lu %s\n", + ss_proto, refcnt, ss_flags, ss_type, ss_state, inode, + line + path_ofs); } #define _PATH_PROCNET_UDP "/proc/net/udp" @@ -456,10 +458,11 @@ #define _PATH_PROCNET_RAW6 "/proc/net/raw6" #define _PATH_PROCNET_UNIX "/proc/net/unix" -static void do_info(const char *file, const char *name, void (*proc)(int, const char *)) +static void do_info(const char *file, const char *name, void (*proc)(int, char *)) { - int lnr = 0; + int lnr; FILE *procinfo; + char *buffer; procinfo = fopen(file, "r"); if (procinfo == NULL) { @@ -470,13 +473,14 @@ } return; } + lnr = 0; do { - char *buffer = xmalloc_fgets(procinfo); + buffer = xmalloc_fgets(procinfo); if (buffer) { (proc)(lnr++, buffer); free(buffer); } - } while (!feof(procinfo)); + } while (buffer); fclose(procinfo); } From bugs at busybox.net Mon Dec 3 07:56:50 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Mon, 3 Dec 2007 07:56:50 -0800 Subject: [BusyBox 0001629]: 1.8.2 command line redirect bug Message-ID: The following issue has been SUBMITTED. ====================================================================== http://busybox.net/bugs/view.php?id=1629 ====================================================================== Reported By: sunx Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1629 Category: Standards Compliance Reproducibility: always Severity: minor Priority: normal Status: assigned ====================================================================== Date Submitted: 12-03-2007 07:56 PST Last Modified: 12-03-2007 07:56 PST ====================================================================== Summary: 1.8.2 command line redirect bug Description: current directory is not empty ls > 1.txt but 1.txt is zero lenght this bug infected all applet ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 12-03-07 07:56 sunx New Issue 12-03-07 07:56 sunx Status new => assigned 12-03-07 07:56 sunx Assigned To => BusyBox ====================================================================== From vapier at gentoo.org Mon Dec 3 21:58:54 2007 From: vapier at gentoo.org (Mike Frysinger) Date: Tue, 4 Dec 2007 00:58:54 -0500 Subject: svn commit: trunk/busybox: coreutils libbb procps In-Reply-To: <20070501200733.8A13B4859E@busybox.net> References: <20070501200733.8A13B4859E@busybox.net> Message-ID: <200712040058.55499.vapier@gentoo.org> On Tuesday 01 May 2007, vda at busybox.net wrote: > Author: vda > Date: 2007-05-01 13:07:29 -0700 (Tue, 01 May 2007) > New Revision: 18534 > > Log: > test: code size saving, no logic changes > ps: fix warning, make a bit smaller > kill -l: make smaller & know much more signals > > Modified: trunk/busybox/libbb/u_signal_names.c > =================================================================== > --- trunk/busybox/libbb/u_signal_names.c 2007-04-30 21:23:22 UTC (rev > 18533) +++ trunk/busybox/libbb/u_signal_names.c 2007-05-01 20:07:29 UTC > (rev 18534) @@ -9,20 +9,111 @@ > > #include "libbb.h" > > -static const struct signal_name { > - int number; > - char name[5]; > -} signals[] = { > +static const char signals[32][7] = { > // SUSv3 says kill must support these, and specifies the numerical > values, // > http://www.opengroup.org/onlinepubs/009695399/utilities/kill.html // TODO: > "[SIG]EXIT" shouldn't work for kill, right? > - {0, "EXIT"}, {1, "HUP"}, {2, "INT"}, {3, "QUIT"}, {6, "ABRT"}, {9, > "KILL"}, - {14, "ALRM"}, {15, "TERM"}, > + // {0, "EXIT"}, {1, "HUP"}, {2, "INT"}, {3, "QUIT"}, > + // {6, "ABRT"}, {9, "KILL"}, {14, "ALRM"}, {15, "TERM"} > // And Posix adds the following: > - {SIGILL, "ILL"}, {SIGTRAP, "TRAP"}, {SIGFPE, "FPE"}, {SIGUSR1, "USR1"}, > - {SIGSEGV, "SEGV"}, {SIGUSR2, "USR2"}, {SIGPIPE, "PIPE"}, {SIGCHLD, > "CHLD"}, - {SIGCONT, "CONT"}, {SIGSTOP, "STOP"}, {SIGTSTP, "TSTP"}, > {SIGTTIN, "TTIN"}, - {SIGTTOU, "TTOU"} > + // {SIGILL, "ILL"}, {SIGTRAP, "TRAP"}, {SIGFPE, "FPE"}, {SIGUSR1, > "USR1"}, + // {SIGSEGV, "SEGV"}, {SIGUSR2, "USR2"}, {SIGPIPE, "PIPE"}, > {SIGCHLD, "CHLD"}, + // {SIGCONT, "CONT"}, {SIGSTOP, "STOP"}, {SIGTSTP, > "TSTP"}, {SIGTTIN, "TTIN"}, + // {SIGTTOU, "TTOU"} > + [0] = "EXIT", > +#ifdef SIGHUP > + [SIGHUP ] = "HUP", > +#endif > +#ifdef SIGINT > + [SIGINT ] = "INT", > +#endif > +#ifdef SIGQUIT > + [SIGQUIT ] = "QUIT", > +#endif > +#ifdef SIGILL > + [SIGILL ] = "ILL", > +#endif > +#ifdef SIGTRAP > + [SIGTRAP ] = "TRAP", > +#endif > +#ifdef SIGABRT > + [SIGABRT ] = "ABRT", > +#endif > +#ifdef SIGBUS > + [SIGBUS ] = "BUS", > +#endif > +#ifdef SIGFPE > + [SIGFPE ] = "FPE", > +#endif > +#ifdef SIGKILL > + [SIGKILL ] = "KILL", > +#endif > +#ifdef SIGUSR1 > + [SIGUSR1 ] = "USR1", > +#endif > +#ifdef SIGSEGV > + [SIGSEGV ] = "SEGV", > +#endif > +#ifdef SIGUSR2 > + [SIGUSR2 ] = "USR2", > +#endif > +#ifdef SIGPIPE > + [SIGPIPE ] = "PIPE", > +#endif > +#ifdef SIGALRM > + [SIGALRM ] = "ALRM", > +#endif > +#ifdef SIGTERM > + [SIGTERM ] = "TERM", > +#endif > +#ifdef SIGSTKFLT > + [SIGSTKFLT] = "STKFLT", > +#endif > +#ifdef SIGCHLD > + [SIGCHLD ] = "CHLD", > +#endif > +#ifdef SIGCONT > + [SIGCONT ] = "CONT", > +#endif > +#ifdef SIGSTOP > + [SIGSTOP ] = "STOP", > +#endif > +#ifdef SIGTSTP > + [SIGTSTP ] = "TSTP", > +#endif > +#ifdef SIGTTIN > + [SIGTTIN ] = "TTIN", > +#endif > +#ifdef SIGTTOU > + [SIGTTOU ] = "TTOU", > +#endif > +#ifdef SIGURG > + [SIGURG ] = "URG", > +#endif > +#ifdef SIGXCPU > + [SIGXCPU ] = "XCPU", > +#endif > +#ifdef SIGXFSZ > + [SIGXFSZ ] = "XFSZ", > +#endif > +#ifdef SIGVTALRM > + [SIGVTALRM] = "VTALRM", > +#endif > +#ifdef SIGPROF > + [SIGPROF ] = "PROF", > +#endif > +#ifdef SIGWINCH > + [SIGWINCH ] = "WINCH", > +#endif > +#ifdef SIGPOLL > + [SIGPOLL ] = "POLL", > +#endif > +#ifdef SIGPWR > + [SIGPWR ] = "PWR", > +#endif > +#ifdef SIGSYS > + [SIGSYS ] = "SYS", > +#endif > }; > > // Convert signal name to number. > @@ -32,12 +123,28 @@ > int i; > > i = bb_strtou(name, NULL, 10); > - if (!errno) return i; > - for (i = 0; i < sizeof(signals) / sizeof(struct signal_name); i++) > - if (strcasecmp(name, signals[i].name) == 0 > - || (strncasecmp(name, "SIG", 3) == 0 > - && strcasecmp(&name[3], signals[i].name) == 0)) > - return signals[i].number; > + if (!errno) > + return i; > + if (strncasecmp(name, "SIG", 3) == 0) > + name += 3; > + for (i = 0; i < sizeof(signals) / sizeof(signals[0]); i++) > + if (strcasecmp(name, signals[i]) == 0) > + return i; > + > +#if ENABLE_DESKTOP && (defined(SIGIOT) || defined(SIGIO)) > + /* These are aliased to other names */ > + if ((name[0] | 0x20) == 'i' && (name[1] | 0x20) == 'o') { > +#ifdef SIGIO > + if (!name[2]) > + return SIGIO; > +#endif > +#ifdef SIGIOT > + if ((name[2] | 0x20) == 't' && !name[3]) > + return SIGIOT; > +#endif > + } > +#endif > + > return -1; > } > > @@ -45,12 +152,9 @@ > > const char *get_signame(int number) > { > - int i; > - > - for (i=0; i < sizeof(signals) / sizeof(struct signal_name); i++) { > - if (number == signals[i].number) { > - return signals[i].name; > - } > + if ((unsigned)number < sizeof(signals) / sizeof(signals[0])) { > + if (signals[number][0]) /* if it's not an empty str */ > + return signals[number]; > } > > return itoa(number); > while this would be nice, the code relies on extended assumptions which the POSIX spec does not require and in some cases, this fails consider HPPA who defines SIGSTKFLT as 36 ... this define isnt in POSIX and is clearly beyond the "32" limit here ... and SUSv3 does not state that `kill` needs to support this signal ... perhaps the #if checks should be changed to something like: #if defined(SIGSTKFLT) && SIGSTKFLT < KILL_MAX_SIG and we'll change the array to: #define KILL_MAX_SIG 32 static const char signals[KILL_MAX_SIG][7] = { -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 827 bytes Desc: This is a digitally signed message part. Url : http://busybox.net/lists/busybox-cvs/attachments/20071204/d60423d5/attachment.pgp From vda at busybox.net Tue Dec 4 01:48:42 2007 From: vda at busybox.net (vda at busybox.net) Date: Tue, 4 Dec 2007 01:48:42 -0800 (PST) Subject: svn commit: trunk/busybox: docs loginutils Message-ID: <20071204094842.ECD1A12802D@busybox.net> Author: vda Date: 2007-12-04 01:48:40 -0800 (Tue, 04 Dec 2007) New Revision: 20619 Log: getty: don't accept ancient '#' and '@' as backspace/kill line, it only confuses people. (Alexander Griesser (LKH Villach)) various other cleanups. function old new delta getty_main 2526 2546 +20 static.baud_index 4 - -4 parse_speeds 91 - -91 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 1/0 up/down: 20/-95) Total: -75 bytes text data bss dec hex filename 773152 1086 9008 783246 bf38e busybox_old 773081 1086 9008 783175 bf347 busybox_unstripped Added: trunk/busybox/docs/ctty.htm Modified: trunk/busybox/loginutils/getty.c Changeset: Sorry, the patch is too large to include (1214 lines). Please use ViewCVS to see it! http://busybox.net/cgi-bin/viewcvs.cgi?view=rev&root=svn&rev=20619 From bugs at busybox.net Tue Dec 4 01:54:04 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Tue, 4 Dec 2007 01:54:04 -0800 Subject: [BusyBox 0001629]: 1.8.2 command line redirect bug Message-ID: A NOTE has been added to this issue. ====================================================================== http://busybox.net/bugs/view.php?id=1629 ====================================================================== Reported By: sunx Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1629 Category: Standards Compliance Reproducibility: always Severity: minor Priority: normal Status: assigned ====================================================================== Date Submitted: 12-03-2007 07:56 PST Last Modified: 12-04-2007 01:54 PST ====================================================================== Summary: 1.8.2 command line redirect bug Description: current directory is not empty ls > 1.txt but 1.txt is zero lenght this bug infected all applet ====================================================================== ---------------------------------------------------------------------- vda - 12-04-07 01:54 ---------------------------------------------------------------------- Please post your .config and output of "ldd busybox" command. Issue History Date Modified Username Field Change ====================================================================== 12-03-07 07:56 sunx New Issue 12-03-07 07:56 sunx Status new => assigned 12-03-07 07:56 sunx Assigned To => BusyBox 12-04-07 01:54 vda Note Added: 0003009 ====================================================================== From bugs at busybox.net Tue Dec 4 01:54:15 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Tue, 4 Dec 2007 01:54:15 -0800 Subject: [BusyBox 0001629]: 1.8.2 command line redirect bug Message-ID: <5a44bbd60874a7a56afbd1d3e70bd9e1@busybox.net> The following issue requires your FEEDBACK. ====================================================================== http://busybox.net/bugs/view.php?id=1629 ====================================================================== Reported By: sunx Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1629 Category: Standards Compliance Reproducibility: always Severity: minor Priority: normal Status: feedback ====================================================================== Date Submitted: 12-03-2007 07:56 PST Last Modified: 12-04-2007 01:54 PST ====================================================================== Summary: 1.8.2 command line redirect bug Description: current directory is not empty ls > 1.txt but 1.txt is zero lenght this bug infected all applet ====================================================================== ---------------------------------------------------------------------- vda - 12-04-07 01:54 ---------------------------------------------------------------------- Please post your .config and output of "ldd busybox" command. Issue History Date Modified Username Field Change ====================================================================== 12-03-07 07:56 sunx New Issue 12-03-07 07:56 sunx Status new => assigned 12-03-07 07:56 sunx Assigned To => BusyBox 12-04-07 01:54 vda Note Added: 0003009 12-04-07 01:54 vda Status assigned => feedback ====================================================================== From vda at busybox.net Tue Dec 4 02:05:35 2007 From: vda at busybox.net (vda at busybox.net) Date: Tue, 4 Dec 2007 02:05:35 -0800 (PST) Subject: svn commit: trunk/busybox/libbb Message-ID: <20071204100535.66C2E128557@busybox.net> Author: vda Date: 2007-12-04 02:05:28 -0800 (Tue, 04 Dec 2007) New Revision: 20620 Log: guard against SIGxxx >= 32 (no code changes on i386) Modified: trunk/busybox/libbb/u_signal_names.c Changeset: Modified: trunk/busybox/libbb/u_signal_names.c =================================================================== --- trunk/busybox/libbb/u_signal_names.c 2007-12-04 09:48:40 UTC (rev 20619) +++ trunk/busybox/libbb/u_signal_names.c 2007-12-04 10:05:28 UTC (rev 20620) @@ -9,7 +9,9 @@ #include "libbb.h" -static const char signals[32][7] = { +#define KILL_MAX_SIG 32 + +static const char signals[KILL_MAX_SIG][7] = { // SUSv3 says kill must support these, and specifies the numerical values, // http://www.opengroup.org/onlinepubs/009695399/utilities/kill.html // TODO: "[SIG]EXIT" shouldn't work for kill, right? @@ -20,98 +22,101 @@ // {SIGSEGV, "SEGV"}, {SIGUSR2, "USR2"}, {SIGPIPE, "PIPE"}, {SIGCHLD, "CHLD"}, // {SIGCONT, "CONT"}, {SIGSTOP, "STOP"}, {SIGTSTP, "TSTP"}, {SIGTTIN, "TTIN"}, // {SIGTTOU, "TTOU"} + +/* Believe it or not, but some arches have more than 32 SIGs! + * HPPA: SIGSTKFLT == 36. We don't include those. */ [0] = "EXIT", -#ifdef SIGHUP +#if defined SIGHUP && SIGHUP < KILL_MAX_SIG [SIGHUP ] = "HUP", #endif -#ifdef SIGINT +#if defined SIGINT && SIGINT < KILL_MAX_SIG [SIGINT ] = "INT", #endif -#ifdef SIGQUIT +#if defined SIGQUIT && SIGQUIT < KILL_MAX_SIG [SIGQUIT ] = "QUIT", #endif -#ifdef SIGILL +#if defined SIGILL && SIGILL < KILL_MAX_SIG [SIGILL ] = "ILL", #endif -#ifdef SIGTRAP +#if defined SIGTRAP && SIGTRAP < KILL_MAX_SIG [SIGTRAP ] = "TRAP", #endif -#ifdef SIGABRT +#if defined SIGABRT && SIGABRT < KILL_MAX_SIG [SIGABRT ] = "ABRT", #endif -#ifdef SIGBUS +#if defined SIGBUS && SIGBUS < KILL_MAX_SIG [SIGBUS ] = "BUS", #endif -#ifdef SIGFPE +#if defined SIGFPE && SIGFPE < KILL_MAX_SIG [SIGFPE ] = "FPE", #endif -#ifdef SIGKILL +#if defined SIGKILL && SIGKILL < KILL_MAX_SIG [SIGKILL ] = "KILL", #endif -#ifdef SIGUSR1 +#if defined SIGUSR1 && SIGUSR1 < KILL_MAX_SIG [SIGUSR1 ] = "USR1", #endif -#ifdef SIGSEGV +#if defined SIGSEGV && SIGSEGV < KILL_MAX_SIG [SIGSEGV ] = "SEGV", #endif -#ifdef SIGUSR2 +#if defined SIGUSR2 && SIGUSR2 < KILL_MAX_SIG [SIGUSR2 ] = "USR2", #endif -#ifdef SIGPIPE +#if defined SIGPIPE && SIGPIPE < KILL_MAX_SIG [SIGPIPE ] = "PIPE", #endif -#ifdef SIGALRM +#if defined SIGALRM && SIGALRM < KILL_MAX_SIG [SIGALRM ] = "ALRM", #endif -#ifdef SIGTERM +#if defined SIGTERM && SIGTERM < KILL_MAX_SIG [SIGTERM ] = "TERM", #endif -#ifdef SIGSTKFLT +#if defined SIGSTKFLT && SIGSTKFLT < KILL_MAX_SIG [SIGSTKFLT] = "STKFLT", #endif -#ifdef SIGCHLD +#if defined SIGCHLD && SIGCHLD < KILL_MAX_SIG [SIGCHLD ] = "CHLD", #endif -#ifdef SIGCONT +#if defined SIGCONT && SIGCONT < KILL_MAX_SIG [SIGCONT ] = "CONT", #endif -#ifdef SIGSTOP +#if defined SIGSTOP && SIGSTOP < KILL_MAX_SIG [SIGSTOP ] = "STOP", #endif -#ifdef SIGTSTP +#if defined SIGTSTP && SIGTSTP < KILL_MAX_SIG [SIGTSTP ] = "TSTP", #endif -#ifdef SIGTTIN +#if defined SIGTTIN && SIGTTIN < KILL_MAX_SIG [SIGTTIN ] = "TTIN", #endif -#ifdef SIGTTOU +#if defined SIGTTOU && SIGTTOU < KILL_MAX_SIG [SIGTTOU ] = "TTOU", #endif -#ifdef SIGURG +#if defined SIGURG && SIGURG < KILL_MAX_SIG [SIGURG ] = "URG", #endif -#ifdef SIGXCPU +#if defined SIGXCPU && SIGXCPU < KILL_MAX_SIG [SIGXCPU ] = "XCPU", #endif -#ifdef SIGXFSZ +#if defined SIGXFSZ && SIGXFSZ < KILL_MAX_SIG [SIGXFSZ ] = "XFSZ", #endif -#ifdef SIGVTALRM +#if defined SIGVTALRM && SIGVTALRM < KILL_MAX_SIG [SIGVTALRM] = "VTALRM", #endif -#ifdef SIGPROF +#if defined SIGPROF && SIGPROF < KILL_MAX_SIG [SIGPROF ] = "PROF", #endif -#ifdef SIGWINCH +#if defined SIGWINCH && SIGWINCH < KILL_MAX_SIG [SIGWINCH ] = "WINCH", #endif -#ifdef SIGPOLL +#if defined SIGPOLL && SIGPOLL < KILL_MAX_SIG [SIGPOLL ] = "POLL", #endif -#ifdef SIGPWR +#if defined SIGPWR && SIGPWR < KILL_MAX_SIG [SIGPWR ] = "PWR", #endif -#ifdef SIGSYS +#if defined SIGSYS && SIGSYS < KILL_MAX_SIG [SIGSYS ] = "SYS", #endif }; @@ -134,11 +139,11 @@ #if ENABLE_DESKTOP && (defined(SIGIOT) || defined(SIGIO)) /* These are aliased to other names */ if ((name[0] | 0x20) == 'i' && (name[1] | 0x20) == 'o') { -#ifdef SIGIO +#if defined SIGIO if (!name[2]) return SIGIO; #endif -#ifdef SIGIOT +#if defined SIGIOT if ((name[2] | 0x20) == 't' && !name[3]) return SIGIOT; #endif From vda.linux at googlemail.com Tue Dec 4 02:06:47 2007 From: vda.linux at googlemail.com (Denys Vlasenko) Date: Tue, 4 Dec 2007 02:06:47 -0800 Subject: svn commit: trunk/busybox: coreutils libbb procps In-Reply-To: <200712040058.55499.vapier@gentoo.org> References: <20070501200733.8A13B4859E@busybox.net> <200712040058.55499.vapier@gentoo.org> Message-ID: <200712040206.47756.vda.linux@googlemail.com> On Monday 03 December 2007 21:58, Mike Frysinger wrote: > On Tuesday 01 May 2007, vda at busybox.net wrote: > > Author: vda > > Date: 2007-05-01 13:07:29 -0700 (Tue, 01 May 2007) > > New Revision: 18534 > > > > Log: > > test: code size saving, no logic changes > > ps: fix warning, make a bit smaller > > kill -l: make smaller & know much more signals > > ... > > +static const char signals[32][7] = { > > + [0] = "EXIT", > > +#ifdef SIGHUP > > + [SIGHUP ] = "HUP", > > +#endif > > +#ifdef SIGINT > > + [SIGINT ] = "INT", > > +#endif ... > > +#ifdef SIGPWR > > + [SIGPWR ] = "PWR", > > +#endif > > +#ifdef SIGSYS > > + [SIGSYS ] = "SYS", > > +#endif > > }; > > while this would be nice, the code relies on extended assumptions which the > POSIX spec does not require and in some cases, this fails > > consider HPPA who defines SIGSTKFLT as 36 ... this define isnt in POSIX and > is clearly beyond the "32" limit here ... and SUSv3 does not state that > `kill` needs to support this signal ... > > perhaps the #if checks should be changed to something like: > #if defined(SIGSTKFLT) && SIGSTKFLT < KILL_MAX_SIG > and we'll change the array to: > #define KILL_MAX_SIG 32 > static const char signals[KILL_MAX_SIG][7] = { > -mike Fixed in svn, thanks. -- vda From vda at busybox.net Tue Dec 4 02:20:52 2007 From: vda at busybox.net (vda at busybox.net) Date: Tue, 4 Dec 2007 02:20:52 -0800 (PST) Subject: svn commit: trunk/busybox/libbb Message-ID: <20071204102052.B35E712854F@busybox.net> Author: vda Date: 2007-12-04 02:20:48 -0800 (Tue, 04 Dec 2007) New Revision: 20621 Log: Make signal table a bit smaller get_signum 136 151 +15 signals 224 192 -32 Modified: trunk/busybox/libbb/u_signal_names.c Changeset: Modified: trunk/busybox/libbb/u_signal_names.c =================================================================== --- trunk/busybox/libbb/u_signal_names.c 2007-12-04 10:05:28 UTC (rev 20620) +++ trunk/busybox/libbb/u_signal_names.c 2007-12-04 10:20:48 UTC (rev 20621) @@ -11,10 +11,9 @@ #define KILL_MAX_SIG 32 -static const char signals[KILL_MAX_SIG][7] = { +static const char signals[KILL_MAX_SIG][6] = { // SUSv3 says kill must support these, and specifies the numerical values, // http://www.opengroup.org/onlinepubs/009695399/utilities/kill.html - // TODO: "[SIG]EXIT" shouldn't work for kill, right? // {0, "EXIT"}, {1, "HUP"}, {2, "INT"}, {3, "QUIT"}, // {6, "ABRT"}, {9, "KILL"}, {14, "ALRM"}, {15, "TERM"} // And Posix adds the following: @@ -25,6 +24,8 @@ /* Believe it or not, but some arches have more than 32 SIGs! * HPPA: SIGSTKFLT == 36. We don't include those. */ + +/* NB: longest (6-char) names are NOT nul-terminated */ [0] = "EXIT", #if defined SIGHUP && SIGHUP < KILL_MAX_SIG [SIGHUP ] = "HUP", @@ -132,8 +133,10 @@ return i; if (strncasecmp(name, "SIG", 3) == 0) name += 3; + if (strlen(name) > 6) + return -1; for (i = 0; i < ARRAY_SIZE(signals); i++) - if (strcasecmp(name, signals[i]) == 0) + if (strncasecmp(name, signals[i], 6) == 0) return i; #if ENABLE_DESKTOP && (defined(SIGIOT) || defined(SIGIO)) From bugs at busybox.net Tue Dec 4 04:57:23 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Tue, 4 Dec 2007 04:57:23 -0800 Subject: [BusyBox 0001629]: 1.8.2 command line redirect bug Message-ID: A NOTE has been added to this issue. ====================================================================== http://busybox.net/bugs/view.php?id=1629 ====================================================================== Reported By: sunx Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1629 Category: Standards Compliance Reproducibility: always Severity: minor Priority: normal Status: feedback ====================================================================== Date Submitted: 12-03-2007 07:56 PST Last Modified: 12-04-2007 04:57 PST ====================================================================== Summary: 1.8.2 command line redirect bug Description: current directory is not empty ls > 1.txt but 1.txt is zero lenght this bug infected all applet ====================================================================== ---------------------------------------------------------------------- vda - 12-04-07 01:54 ---------------------------------------------------------------------- Please post your .config and output of "ldd busybox" command. ---------------------------------------------------------------------- sunx - 12-04-07 04:57 ---------------------------------------------------------------------- binary is static linking gcc 3.3.2 glibc 2.3.2 but , i think glibc viersion is not important Issue History Date Modified Username Field Change ====================================================================== 12-03-07 07:56 sunx New Issue 12-03-07 07:56 sunx Status new => assigned 12-03-07 07:56 sunx Assigned To => BusyBox 12-04-07 01:54 vda Note Added: 0003009 12-04-07 01:54 vda Status assigned => feedback 12-04-07 04:56 sunx File Added: dot_config 12-04-07 04:57 sunx Note Added: 0003014 ====================================================================== From bugs at busybox.net Tue Dec 4 04:58:15 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Tue, 4 Dec 2007 04:58:15 -0800 Subject: [BusyBox 0001629]: 1.8.2 command line redirect bug Message-ID: A NOTE has been added to this issue. ====================================================================== http://busybox.net/bugs/view.php?id=1629 ====================================================================== Reported By: sunx Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1629 Category: Standards Compliance Reproducibility: always Severity: minor Priority: normal Status: feedback ====================================================================== Date Submitted: 12-03-2007 07:56 PST Last Modified: 12-04-2007 04:58 PST ====================================================================== Summary: 1.8.2 command line redirect bug Description: current directory is not empty ls > 1.txt but 1.txt is zero lenght this bug infected all applet ====================================================================== ---------------------------------------------------------------------- vda - 12-04-07 01:54 ---------------------------------------------------------------------- Please post your .config and output of "ldd busybox" command. ---------------------------------------------------------------------- sunx - 12-04-07 04:57 ---------------------------------------------------------------------- binary is static linking gcc 3.3.2 glibc 2.3.2 but , i think glibc viersion is not important ---------------------------------------------------------------------- sunx - 12-04-07 04:58 ---------------------------------------------------------------------- binary is static linking gcc 3.3.2 glibc 2.3.2 but , i think glibc viersion is not important Issue History Date Modified Username Field Change ====================================================================== 12-03-07 07:56 sunx New Issue 12-03-07 07:56 sunx Status new => assigned 12-03-07 07:56 sunx Assigned To => BusyBox 12-04-07 01:54 vda Note Added: 0003009 12-04-07 01:54 vda Status assigned => feedback 12-04-07 04:56 sunx File Added: dot_config 12-04-07 04:57 sunx Note Added: 0003014 12-04-07 04:58 sunx Note Added: 0003019 ====================================================================== From vda at busybox.net Tue Dec 4 10:46:04 2007 From: vda at busybox.net (vda at busybox.net) Date: Tue, 4 Dec 2007 10:46:04 -0800 (PST) Subject: svn commit: trunk/busybox/loginutils Message-ID: <20071204184604.6C20312802D@busybox.net> Author: vda Date: 2007-12-04 10:46:01 -0800 (Tue, 04 Dec 2007) New Revision: 20622 Log: getty: a small code shrink touch - 40 +40 fakehost 4 - -4 getty_main 2546 2493 -53 Modified: trunk/busybox/loginutils/getty.c Changeset: Modified: trunk/busybox/loginutils/getty.c =================================================================== --- trunk/busybox/loginutils/getty.c 2007-12-04 10:20:48 UTC (rev 20621) +++ trunk/busybox/loginutils/getty.c 2007-12-04 18:46:01 UTC (rev 20622) @@ -28,12 +28,16 @@ * System V, assume it is SunOS 4. */ #ifdef LOGIN_PROCESS /* defined in System V utmp.h */ -#define SYSV_STYLE /* select System V style getty */ #include #include #if ENABLE_FEATURE_WTMP extern void updwtmp(const char *filename, const struct utmp *ut); #endif +#else /* if !sysV style, wtmp/utmp code is off */ +#undef ENABLE_FEATURE_UTMP +#undef ENABLE_FEATURE_WTMP +#define ENABLE_FEATURE_UTMP 0 +#define ENABLE_FEATURE_WTMP 0 #endif /* LOGIN_PROCESS */ /* @@ -116,7 +120,7 @@ static const char opt_string[] ALIGN1 = "I:LH:f:hil:mt:wn"; #define F_INITSTRING (1 << 0) /* -I initstring is set */ #define F_LOCAL (1 << 1) /* -L force local */ -#define F_FAKEHOST (1 << 2) /* -H force fakehost */ +#define F_FAKEHOST (1 << 2) /* -H fake hostname */ #define F_CUSTISSUE (1 << 3) /* -f give alternative issue file */ #define F_RTSCTS (1 << 4) /* -h enable RTS/CTS flow control */ #define F_ISSUE (1 << 5) /* -i display /etc/issue */ @@ -124,11 +128,9 @@ #define F_PARSE (1 << 7) /* -m process modem status messages */ #define F_TIMEOUT (1 << 8) /* -t time out */ #define F_WAITCRLF (1 << 9) /* -w wait for CR or LF */ -#define F_NOPROMPT (1 << 10) /* -n don't ask for login name! */ +#define F_NOPROMPT (1 << 10) /* -n don't ask for login name */ -/* Fake hostname for ut_host specified on command line. */ -static char *fakehost = NULL; #define line_buf bb_common_bufsiz1 /* The following is used for understandable diagnostics. */ @@ -175,20 +177,20 @@ } /* parse_args - parse command-line arguments */ -static void parse_args(char **argv, struct options *op) +static void parse_args(char **argv, struct options *op, char **fakehost_p) { char *ts; opt_complementary = "-2"; /* at least 2 args */ op->flags = getopt32(argv, opt_string, - &(op->initstring), &fakehost, &(op->issue), + &(op->initstring), fakehost_p, &(op->issue), &(op->login), &ts); argv += optind; if (op->flags & F_INITSTRING) { const char *p = op->initstring; char *q; - op->initstring = q = xstrdup(op->initstring); + op->initstring = q = xstrdup(p); /* copy optarg into op->initstring decoding \ddd octal codes into chars */ while (*p) { @@ -564,16 +566,24 @@ ioctl_or_perror_and_die(0, TCSETS, tp, "%s: TCSETS", op->tty); } -#ifdef SYSV_STYLE #if ENABLE_FEATURE_UTMP +static void touch(const char *filename) +{ + if (access(filename, R_OK | W_OK) == -1) + close(open(filename, O_WRONLY | O_CREAT, 0664)); +} + /* update_utmp - update our utmp entry */ -static void update_utmp(const char *line) +static void update_utmp(const char *line, char *fakehost) { struct utmp ut; struct utmp *utp; - time_t t; int mypid = getpid(); + /* In case we won't find an entry below... */ + memset(&ut, 0, sizeof(ut)); + safe_strncpy(ut.ut_id, line + 3, sizeof(ut.ut_id)); + /* * The utmp file holds miscellaneous information about things started by * /sbin/init and other system-related events. Our purpose is to update @@ -582,29 +592,22 @@ * utmp file can be opened for update, and if we are able to find our * entry in the utmp file. */ - if (access(_PATH_UTMP, R_OK|W_OK) == -1) { - close(creat(_PATH_UTMP, 0664)); - } + touch(_PATH_UTMP); + utmpname(_PATH_UTMP); setutent(); - while ((utp = getutent()) - && !(utp->ut_type == INIT_PROCESS && utp->ut_pid == mypid) - ) { - continue; + while ((utp = getutent()) != NULL) { + if (utp->ut_type == INIT_PROCESS && utp->ut_pid == mypid) { + memcpy(&ut, utp, sizeof(ut)); + break; + } } - /* some inits don't initialize utmp... */ - memset(&ut, 0, sizeof(ut)); - safe_strncpy(ut.ut_id, line + 3, sizeof(ut.ut_id)); - if (utp) - memcpy(&ut, utp, sizeof(ut)); - strcpy(ut.ut_user, "LOGIN"); safe_strncpy(ut.ut_line, line, sizeof(ut.ut_line)); if (fakehost) safe_strncpy(ut.ut_host, fakehost, sizeof(ut.ut_host)); - time(&t); - ut.ut_time = t; + ut.ut_time = time(NULL); ut.ut_type = LOGIN_PROCESS; ut.ut_pid = mypid; @@ -612,19 +615,17 @@ endutent(); #if ENABLE_FEATURE_WTMP - if (access(bb_path_wtmp_file, R_OK|W_OK) == -1) - close(creat(bb_path_wtmp_file, 0664)); + touch(bb_path_wtmp_file); updwtmp(bb_path_wtmp_file, &ut); #endif } - #endif /* CONFIG_FEATURE_UTMP */ -#endif /* SYSV_STYLE */ int getty_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int getty_main(int argc, char **argv) { int n; + char *fakehost = NULL; /* Fake hostname for ut_host */ char *logname; /* login name, given to /bin/login */ /* Merging these into "struct local" may _seem_ to reduce * parameter passing, but today's gcc will inline @@ -673,7 +674,7 @@ #endif /* Parse command-line arguments. */ - parse_args(argv, &options); + parse_args(argv, &options, &fakehost); debug("calling open_tty\n"); /* Open the tty as standard input, if it is not "-" */ @@ -694,12 +695,10 @@ */ ioctl_or_perror_and_die(0, TCGETS, &termios, "%s: TCGETS", options.tty); -#ifdef SYSV_STYLE #if ENABLE_FEATURE_UTMP /* Update the utmp file */ - update_utmp(options.tty); + update_utmp(options.tty, fakehost); #endif -#endif #ifdef __linux__ /* Make ourself a foreground process group within our session */ From bugs at busybox.net Tue Dec 4 10:51:50 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Tue, 4 Dec 2007 10:51:50 -0800 Subject: [BusyBox 0001629]: 1.8.2 command line redirect bug Message-ID: <6a995fa18f6cf606da8e47f5494cfa92@busybox.net> A NOTE has been added to this issue. ====================================================================== http://busybox.net/bugs/view.php?id=1629 ====================================================================== Reported By: sunx Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1629 Category: Standards Compliance Reproducibility: always Severity: minor Priority: normal Status: feedback ====================================================================== Date Submitted: 12-03-2007 07:56 PST Last Modified: 12-04-2007 10:51 PST ====================================================================== Summary: 1.8.2 command line redirect bug Description: current directory is not empty ls > 1.txt but 1.txt is zero lenght this bug infected all applet ====================================================================== ---------------------------------------------------------------------- vda - 12-04-07 01:54 ---------------------------------------------------------------------- Please post your .config and output of "ldd busybox" command. ---------------------------------------------------------------------- sunx - 12-04-07 04:59 ---------------------------------------------------------------------- the attachment is .config binary is static linking gcc 3.3.2 glibc 2.3.2 but , i think glibc viersion is not important ---------------------------------------------------------------------- vda - 12-04-07 10:51 ---------------------------------------------------------------------- It's CONFIG_STATIC=y + glibc. With your .config: $ make HOSTCC scripts/basic/fixdep HOSTCC scripts/basic/split-include HOSTCC scripts/basic/docproc HOSTCC scripts/kconfig/conf.o HOSTCC scripts/kconfig/kxgettext.o HOSTCC scripts/kconfig/mconf.o SHIPPED scripts/kconfig/zconf.tab.c SHIPPED scripts/kconfig/lex.zconf.c SHIPPED scripts/kconfig/zconf.hash.c HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf scripts/kconfig/conf -s Config.in # # using defaults found in .config # SPLIT include/autoconf.h -> include/config/* GEN include/bbconfigopts.h HOSTCC applets/usage GEN include/usage_compressed.h CC applets/applets.o applets/applets.c:15:2: warning: #warning Static linking against glibc produces buggy executables applets/applets.c:16:2: warning: #warning (glibc does not cope well with ld --gc-sections). applets/applets.c:17:2: warning: #warning See sources.redhat.com/bugzilla/show_bug.cgi?id=3400 applets/applets.c:18:2: warning: #warning Note that glibc is unsuitable for static linking anyway. applets/applets.c:19:2: warning: #warning If you still want to do it, remove -Wl,--gc-sections applets/applets.c:20:2: warning: #warning from top-level Makefile and remove this warning. applets/applets.c:21:2: error: #error Aborting compilation. make[1]: *** [applets/applets.o] Error 1 make: *** [applets] Error 2 This warning says it all. I suppose you didn't read it. Issue History Date Modified Username Field Change ====================================================================== 12-03-07 07:56 sunx New Issue 12-03-07 07:56 sunx Status new => assigned 12-03-07 07:56 sunx Assigned To => BusyBox 12-04-07 01:54 vda Note Added: 0003009 12-04-07 01:54 vda Status assigned => feedback 12-04-07 04:56 sunx File Added: dot_config 12-04-07 04:57 sunx Note Added: 0003014 12-04-07 04:58 sunx Note Added: 0003019 12-04-07 04:58 sunx Note Deleted: 0003019 12-04-07 04:59 sunx Note Edited: 0003014 12-04-07 10:51 vda Note Added: 0003024 ====================================================================== From bugs at busybox.net Tue Dec 4 10:52:10 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Tue, 4 Dec 2007 10:52:10 -0800 Subject: [BusyBox 0001629]: 1.8.2 command line redirect bug Message-ID: <0f0c9251b60e5c5c7dc8d8d92578e9a8@busybox.net> The following issue has been CLOSED ====================================================================== http://busybox.net/bugs/view.php?id=1629 ====================================================================== Reported By: sunx Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1629 Category: Standards Compliance Reproducibility: always Severity: minor Priority: normal Status: closed Resolution: open Fixed in Version: ====================================================================== Date Submitted: 12-03-2007 07:56 PST Last Modified: 12-04-2007 10:52 PST ====================================================================== Summary: 1.8.2 command line redirect bug Description: current directory is not empty ls > 1.txt but 1.txt is zero lenght this bug infected all applet ====================================================================== ---------------------------------------------------------------------- vda - 12-04-07 01:54 ---------------------------------------------------------------------- Please post your .config and output of "ldd busybox" command. ---------------------------------------------------------------------- sunx - 12-04-07 04:59 ---------------------------------------------------------------------- the attachment is .config binary is static linking gcc 3.3.2 glibc 2.3.2 but , i think glibc viersion is not important ---------------------------------------------------------------------- vda - 12-04-07 10:51 ---------------------------------------------------------------------- It's CONFIG_STATIC=y + glibc. With your .config: $ make HOSTCC scripts/basic/fixdep HOSTCC scripts/basic/split-include HOSTCC scripts/basic/docproc HOSTCC scripts/kconfig/conf.o HOSTCC scripts/kconfig/kxgettext.o HOSTCC scripts/kconfig/mconf.o SHIPPED scripts/kconfig/zconf.tab.c SHIPPED scripts/kconfig/lex.zconf.c SHIPPED scripts/kconfig/zconf.hash.c HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf scripts/kconfig/conf -s Config.in # # using defaults found in .config # SPLIT include/autoconf.h -> include/config/* GEN include/bbconfigopts.h HOSTCC applets/usage GEN include/usage_compressed.h CC applets/applets.o applets/applets.c:15:2: warning: #warning Static linking against glibc produces buggy executables applets/applets.c:16:2: warning: #warning (glibc does not cope well with ld --gc-sections). applets/applets.c:17:2: warning: #warning See sources.redhat.com/bugzilla/show_bug.cgi?id=3400 applets/applets.c:18:2: warning: #warning Note that glibc is unsuitable for static linking anyway. applets/applets.c:19:2: warning: #warning If you still want to do it, remove -Wl,--gc-sections applets/applets.c:20:2: warning: #warning from top-level Makefile and remove this warning. applets/applets.c:21:2: error: #error Aborting compilation. make[1]: *** [applets/applets.o] Error 1 make: *** [applets] Error 2 This warning says it all. I suppose you didn't read it. Issue History Date Modified Username Field Change ====================================================================== 12-03-07 07:56 sunx New Issue 12-03-07 07:56 sunx Status new => assigned 12-03-07 07:56 sunx Assigned To => BusyBox 12-04-07 01:54 vda Note Added: 0003009 12-04-07 01:54 vda Status assigned => feedback 12-04-07 04:56 sunx File Added: dot_config 12-04-07 04:57 sunx Note Added: 0003014 12-04-07 04:58 sunx Note Added: 0003019 12-04-07 04:58 sunx Note Deleted: 0003019 12-04-07 04:59 sunx Note Edited: 0003014 12-04-07 10:51 vda Note Added: 0003024 12-04-07 10:52 vda Status feedback => closed ====================================================================== From vda at busybox.net Tue Dec 4 13:44:52 2007 From: vda at busybox.net (vda at busybox.net) Date: Tue, 4 Dec 2007 13:44:52 -0800 (PST) Subject: svn commit: trunk/busybox/libbb Message-ID: <20071204214452.B418E128552@busybox.net> Author: vda Date: 2007-12-04 13:44:52 -0800 (Tue, 04 Dec 2007) New Revision: 20623 Log: signal names hack was wrong, it broke "get signal name" function. Reverting :( Modified: trunk/busybox/libbb/u_signal_names.c Changeset: Modified: trunk/busybox/libbb/u_signal_names.c =================================================================== --- trunk/busybox/libbb/u_signal_names.c 2007-12-04 18:46:01 UTC (rev 20622) +++ trunk/busybox/libbb/u_signal_names.c 2007-12-04 21:44:52 UTC (rev 20623) @@ -9,9 +9,10 @@ #include "libbb.h" -#define KILL_MAX_SIG 32 +/* Believe it or not, but some arches have more than 32 SIGs! + * HPPA: SIGSTKFLT == 36. */ -static const char signals[KILL_MAX_SIG][6] = { +static const char signals[][7] = { // SUSv3 says kill must support these, and specifies the numerical values, // http://www.opengroup.org/onlinepubs/009695399/utilities/kill.html // {0, "EXIT"}, {1, "HUP"}, {2, "INT"}, {3, "QUIT"}, @@ -22,102 +23,98 @@ // {SIGCONT, "CONT"}, {SIGSTOP, "STOP"}, {SIGTSTP, "TSTP"}, {SIGTTIN, "TTIN"}, // {SIGTTOU, "TTOU"} -/* Believe it or not, but some arches have more than 32 SIGs! - * HPPA: SIGSTKFLT == 36. We don't include those. */ - -/* NB: longest (6-char) names are NOT nul-terminated */ [0] = "EXIT", -#if defined SIGHUP && SIGHUP < KILL_MAX_SIG +#ifdef SIGHUP [SIGHUP ] = "HUP", #endif -#if defined SIGINT && SIGINT < KILL_MAX_SIG +#ifdef SIGINT [SIGINT ] = "INT", #endif -#if defined SIGQUIT && SIGQUIT < KILL_MAX_SIG +#ifdef SIGQUIT [SIGQUIT ] = "QUIT", #endif -#if defined SIGILL && SIGILL < KILL_MAX_SIG +#ifdef SIGILL [SIGILL ] = "ILL", #endif -#if defined SIGTRAP && SIGTRAP < KILL_MAX_SIG +#ifdef SIGTRAP [SIGTRAP ] = "TRAP", #endif -#if defined SIGABRT && SIGABRT < KILL_MAX_SIG +#ifdef SIGABRT [SIGABRT ] = "ABRT", #endif -#if defined SIGBUS && SIGBUS < KILL_MAX_SIG +#ifdef SIGBUS [SIGBUS ] = "BUS", #endif -#if defined SIGFPE && SIGFPE < KILL_MAX_SIG +#ifdef SIGFPE [SIGFPE ] = "FPE", #endif -#if defined SIGKILL && SIGKILL < KILL_MAX_SIG +#ifdef SIGKILL [SIGKILL ] = "KILL", #endif -#if defined SIGUSR1 && SIGUSR1 < KILL_MAX_SIG +#ifdef SIGUSR1 [SIGUSR1 ] = "USR1", #endif -#if defined SIGSEGV && SIGSEGV < KILL_MAX_SIG +#ifdef SIGSEGV [SIGSEGV ] = "SEGV", #endif -#if defined SIGUSR2 && SIGUSR2 < KILL_MAX_SIG +#ifdef SIGUSR2 [SIGUSR2 ] = "USR2", #endif -#if defined SIGPIPE && SIGPIPE < KILL_MAX_SIG +#ifdef SIGPIPE [SIGPIPE ] = "PIPE", #endif -#if defined SIGALRM && SIGALRM < KILL_MAX_SIG +#ifdef SIGALRM [SIGALRM ] = "ALRM", #endif -#if defined SIGTERM && SIGTERM < KILL_MAX_SIG +#ifdef SIGTERM [SIGTERM ] = "TERM", #endif -#if defined SIGSTKFLT && SIGSTKFLT < KILL_MAX_SIG +#ifdef SIGSTKFLT [SIGSTKFLT] = "STKFLT", #endif -#if defined SIGCHLD && SIGCHLD < KILL_MAX_SIG +#ifdef SIGCHLD [SIGCHLD ] = "CHLD", #endif -#if defined SIGCONT && SIGCONT < KILL_MAX_SIG +#ifdef SIGCONT [SIGCONT ] = "CONT", #endif -#if defined SIGSTOP && SIGSTOP < KILL_MAX_SIG +#ifdef SIGSTOP [SIGSTOP ] = "STOP", #endif -#if defined SIGTSTP && SIGTSTP < KILL_MAX_SIG +#ifdef SIGTSTP [SIGTSTP ] = "TSTP", #endif -#if defined SIGTTIN && SIGTTIN < KILL_MAX_SIG +#ifdef SIGTTIN [SIGTTIN ] = "TTIN", #endif -#if defined SIGTTOU && SIGTTOU < KILL_MAX_SIG +#ifdef SIGTTOU [SIGTTOU ] = "TTOU", #endif -#if defined SIGURG && SIGURG < KILL_MAX_SIG +#ifdef SIGURG [SIGURG ] = "URG", #endif -#if defined SIGXCPU && SIGXCPU < KILL_MAX_SIG +#ifdef SIGXCPU [SIGXCPU ] = "XCPU", #endif -#if defined SIGXFSZ && SIGXFSZ < KILL_MAX_SIG +#ifdef SIGXFSZ [SIGXFSZ ] = "XFSZ", #endif -#if defined SIGVTALRM && SIGVTALRM < KILL_MAX_SIG +#ifdef SIGVTALRM [SIGVTALRM] = "VTALRM", #endif -#if defined SIGPROF && SIGPROF < KILL_MAX_SIG +#ifdef SIGPROF [SIGPROF ] = "PROF", #endif -#if defined SIGWINCH && SIGWINCH < KILL_MAX_SIG +#ifdef SIGWINCH [SIGWINCH ] = "WINCH", #endif -#if defined SIGPOLL && SIGPOLL < KILL_MAX_SIG +#ifdef SIGPOLL [SIGPOLL ] = "POLL", #endif -#if defined SIGPWR && SIGPWR < KILL_MAX_SIG +#ifdef SIGPWR [SIGPWR ] = "PWR", #endif -#if defined SIGSYS && SIGSYS < KILL_MAX_SIG +#ifdef SIGSYS [SIGSYS ] = "SYS", #endif }; @@ -133,20 +130,20 @@ return i; if (strncasecmp(name, "SIG", 3) == 0) name += 3; - if (strlen(name) > 6) - return -1; for (i = 0; i < ARRAY_SIZE(signals); i++) - if (strncasecmp(name, signals[i], 6) == 0) + if (strcasecmp(name, signals[i]) == 0) return i; #if ENABLE_DESKTOP && (defined(SIGIOT) || defined(SIGIO)) - /* These are aliased to other names */ + /* SIGIO[T] are aliased to other names, + * thus cannot be stored in the signals[] array. + * Need special code to recognize them */ if ((name[0] | 0x20) == 'i' && (name[1] | 0x20) == 'o') { -#if defined SIGIO +#ifdef SIGIO if (!name[2]) return SIGIO; #endif -#if defined SIGIOT +#ifdef SIGIOT if ((name[2] | 0x20) == 't' && !name[3]) return SIGIOT; #endif From bugs at busybox.net Tue Dec 4 21:18:08 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Tue, 4 Dec 2007 21:18:08 -0800 Subject: [BusyBox 0001629]: 1.8.2 command line redirect bug Message-ID: <634dac9adb6e52788419ca2789ae4bd4@bugs.busybox.net> The following issue has been REOPENED. ====================================================================== http://busybox.net/bugs/view.php?id=1629 ====================================================================== Reported By: sunx Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1629 Category: Standards Compliance Reproducibility: always Severity: minor Priority: normal Status: feedback ====================================================================== Date Submitted: 12-03-2007 07:56 PST Last Modified: 12-04-2007 21:18 PST ====================================================================== Summary: 1.8.2 command line redirect bug Description: current directory is not empty ls > 1.txt but 1.txt is zero lenght this bug infected all applet ====================================================================== ---------------------------------------------------------------------- vda - 12-04-07 01:54 ---------------------------------------------------------------------- Please post your .config and output of "ldd busybox" command. ---------------------------------------------------------------------- sunx - 12-04-07 04:59 ---------------------------------------------------------------------- the attachment is .config binary is static linking gcc 3.3.2 glibc 2.3.2 but , i think glibc viersion is not important ---------------------------------------------------------------------- vda - 12-04-07 10:51 ---------------------------------------------------------------------- It's CONFIG_STATIC=y + glibc. With your .config: $ make HOSTCC scripts/basic/fixdep HOSTCC scripts/basic/split-include HOSTCC scripts/basic/docproc HOSTCC scripts/kconfig/conf.o HOSTCC scripts/kconfig/kxgettext.o HOSTCC scripts/kconfig/mconf.o SHIPPED scripts/kconfig/zconf.tab.c SHIPPED scripts/kconfig/lex.zconf.c SHIPPED scripts/kconfig/zconf.hash.c HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf scripts/kconfig/conf -s Config.in # # using defaults found in .config # SPLIT include/autoconf.h -> include/config/* GEN include/bbconfigopts.h HOSTCC applets/usage GEN include/usage_compressed.h CC applets/applets.o applets/applets.c:15:2: warning: #warning Static linking against glibc produces buggy executables applets/applets.c:16:2: warning: #warning (glibc does not cope well with ld --gc-sections). applets/applets.c:17:2: warning: #warning See sources.redhat.com/bugzilla/show_bug.cgi?id=3400 applets/applets.c:18:2: warning: #warning Note that glibc is unsuitable for static linking anyway. applets/applets.c:19:2: warning: #warning If you still want to do it, remove -Wl,--gc-sections applets/applets.c:20:2: warning: #warning from top-level Makefile and remove this warning. applets/applets.c:21:2: error: #error Aborting compilation. make[1]: *** [applets/applets.o] Error 1 make: *** [applets] Error 2 This warning says it all. I suppose you didn't read it. ---------------------------------------------------------------------- sunx - 12-04-07 21:18 ---------------------------------------------------------------------- yes, i saw it and checked top-level Makefile, but there has no gc-sections so, i comment the "#error" line in applets/applets.c what should i do ? , please help me Issue History Date Modified Username Field Change ====================================================================== 12-03-07 07:56 sunx New Issue 12-03-07 07:56 sunx Status new => assigned 12-03-07 07:56 sunx Assigned To => BusyBox 12-04-07 01:54 vda Note Added: 0003009 12-04-07 01:54 vda Status assigned => feedback 12-04-07 04:56 sunx File Added: dot_config 12-04-07 04:57 sunx Note Added: 0003014 12-04-07 04:58 sunx Note Added: 0003019 12-04-07 04:58 sunx Note Deleted: 0003019 12-04-07 04:59 sunx Note Edited: 0003014 12-04-07 10:51 vda Note Added: 0003024 12-04-07 10:52 vda Status feedback => closed 12-04-07 10:52 vda Resolution open => unable to reproduce 12-04-07 21:18 sunx Status closed => feedback 12-04-07 21:18 sunx Resolution unable to reproduce => reopened 12-04-07 21:18 sunx Note Added: 0003029 ====================================================================== From bugs at busybox.net Wed Dec 5 17:20:51 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Wed, 5 Dec 2007 17:20:51 -0800 Subject: [BusyBox 0001629]: 1.8.2 command line redirect bug Message-ID: A NOTE has been added to this issue. ====================================================================== http://busybox.net/bugs/view.php?id=1629 ====================================================================== Reported By: sunx Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1629 Category: Standards Compliance Reproducibility: always Severity: minor Priority: normal Status: feedback ====================================================================== Date Submitted: 12-03-2007 07:56 PST Last Modified: 12-05-2007 17:20 PST ====================================================================== Summary: 1.8.2 command line redirect bug Description: current directory is not empty ls > 1.txt but 1.txt is zero lenght this bug infected all applet ====================================================================== ---------------------------------------------------------------------- vda - 12-04-07 01:54 ---------------------------------------------------------------------- Please post your .config and output of "ldd busybox" command. ---------------------------------------------------------------------- sunx - 12-04-07 04:59 ---------------------------------------------------------------------- the attachment is .config binary is static linking gcc 3.3.2 glibc 2.3.2 but , i think glibc viersion is not important ---------------------------------------------------------------------- vda - 12-04-07 10:51 ---------------------------------------------------------------------- It's CONFIG_STATIC=y + glibc. With your .config: $ make HOSTCC scripts/basic/fixdep HOSTCC scripts/basic/split-include HOSTCC scripts/basic/docproc HOSTCC scripts/kconfig/conf.o HOSTCC scripts/kconfig/kxgettext.o HOSTCC scripts/kconfig/mconf.o SHIPPED scripts/kconfig/zconf.tab.c SHIPPED scripts/kconfig/lex.zconf.c SHIPPED scripts/kconfig/zconf.hash.c HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf scripts/kconfig/conf -s Config.in # # using defaults found in .config # SPLIT include/autoconf.h -> include/config/* GEN include/bbconfigopts.h HOSTCC applets/usage GEN include/usage_compressed.h CC applets/applets.o applets/applets.c:15:2: warning: #warning Static linking against glibc produces buggy executables applets/applets.c:16:2: warning: #warning (glibc does not cope well with ld --gc-sections). applets/applets.c:17:2: warning: #warning See sources.redhat.com/bugzilla/show_bug.cgi?id=3400 applets/applets.c:18:2: warning: #warning Note that glibc is unsuitable for static linking anyway. applets/applets.c:19:2: warning: #warning If you still want to do it, remove -Wl,--gc-sections applets/applets.c:20:2: warning: #warning from top-level Makefile and remove this warning. applets/applets.c:21:2: error: #error Aborting compilation. make[1]: *** [applets/applets.o] Error 1 make: *** [applets] Error 2 This warning says it all. I suppose you didn't read it. ---------------------------------------------------------------------- sunx - 12-04-07 21:18 ---------------------------------------------------------------------- yes, i saw it and checked top-level Makefile, but there has no gc-sections so, i comment the "#error" line in applets/applets.c what should i do ? , please help me ---------------------------------------------------------------------- sunx - 12-05-07 17:20 ---------------------------------------------------------------------- i got it now, modify script/trylink anyway thanks Issue History Date Modified Username Field Change ====================================================================== 12-03-07 07:56 sunx New Issue 12-03-07 07:56 sunx Status new => assigned 12-03-07 07:56 sunx Assigned To => BusyBox 12-04-07 01:54 vda Note Added: 0003009 12-04-07 01:54 vda Status assigned => feedback 12-04-07 04:56 sunx File Added: dot_config 12-04-07 04:57 sunx Note Added: 0003014 12-04-07 04:58 sunx Note Added: 0003019 12-04-07 04:58 sunx Note Deleted: 0003019 12-04-07 04:59 sunx Note Edited: 0003014 12-04-07 10:51 vda Note Added: 0003024 12-04-07 10:52 vda Status feedback => closed 12-04-07 10:52 vda Resolution open => unable to reproduce 12-04-07 21:18 sunx Status closed => feedback 12-04-07 21:18 sunx Resolution unable to reproduce => reopened 12-04-07 21:18 sunx Note Added: 0003029 12-05-07 17:20 sunx Note Added: 0003034 ====================================================================== From bugs at busybox.net Sat Dec 8 19:47:01 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Sat, 8 Dec 2007 19:47:01 -0800 Subject: [BusyBox 0001629]: 1.8.2 command line redirect bug Message-ID: <803cffe42acec1298882f97f39b7912e@busybox.net> The following issue has been CLOSED ====================================================================== http://busybox.net/bugs/view.php?id=1629 ====================================================================== Reported By: sunx Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1629 Category: Standards Compliance Reproducibility: always Severity: minor Priority: normal Status: closed Resolution: reopened Fixed in Version: ====================================================================== Date Submitted: 12-03-2007 07:56 PST Last Modified: 12-08-2007 19:47 PST ====================================================================== Summary: 1.8.2 command line redirect bug Description: current directory is not empty ls > 1.txt but 1.txt is zero lenght this bug infected all applet ====================================================================== ---------------------------------------------------------------------- vda - 12-04-07 01:54 ---------------------------------------------------------------------- Please post your .config and output of "ldd busybox" command. ---------------------------------------------------------------------- sunx - 12-04-07 04:59 ---------------------------------------------------------------------- the attachment is .config binary is static linking gcc 3.3.2 glibc 2.3.2 but , i think glibc viersion is not important ---------------------------------------------------------------------- vda - 12-04-07 10:51 ---------------------------------------------------------------------- It's CONFIG_STATIC=y + glibc. With your .config: $ make HOSTCC scripts/basic/fixdep HOSTCC scripts/basic/split-include HOSTCC scripts/basic/docproc HOSTCC scripts/kconfig/conf.o HOSTCC scripts/kconfig/kxgettext.o HOSTCC scripts/kconfig/mconf.o SHIPPED scripts/kconfig/zconf.tab.c SHIPPED scripts/kconfig/lex.zconf.c SHIPPED scripts/kconfig/zconf.hash.c HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf scripts/kconfig/conf -s Config.in # # using defaults found in .config # SPLIT include/autoconf.h -> include/config/* GEN include/bbconfigopts.h HOSTCC applets/usage GEN include/usage_compressed.h CC applets/applets.o applets/applets.c:15:2: warning: #warning Static linking against glibc produces buggy executables applets/applets.c:16:2: warning: #warning (glibc does not cope well with ld --gc-sections). applets/applets.c:17:2: warning: #warning See sources.redhat.com/bugzilla/show_bug.cgi?id=3400 applets/applets.c:18:2: warning: #warning Note that glibc is unsuitable for static linking anyway. applets/applets.c:19:2: warning: #warning If you still want to do it, remove -Wl,--gc-sections applets/applets.c:20:2: warning: #warning from top-level Makefile and remove this warning. applets/applets.c:21:2: error: #error Aborting compilation. make[1]: *** [applets/applets.o] Error 1 make: *** [applets] Error 2 This warning says it all. I suppose you didn't read it. ---------------------------------------------------------------------- sunx - 12-04-07 21:18 ---------------------------------------------------------------------- yes, i saw it and checked top-level Makefile, but there has no gc-sections so, i comment the "#error" line in applets/applets.c what should i do ? , please help me ---------------------------------------------------------------------- sunx - 12-05-07 17:20 ---------------------------------------------------------------------- i got it now, modify script/trylink anyway thanks ---------------------------------------------------------------------- vda - 12-08-07 19:47 ---------------------------------------------------------------------- It's in scripts/trylink now, not in the Makefile Issue History Date Modified Username Field Change ====================================================================== 12-03-07 07:56 sunx New Issue 12-03-07 07:56 sunx Status new => assigned 12-03-07 07:56 sunx Assigned To => BusyBox 12-04-07 01:54 vda Note Added: 0003009 12-04-07 01:54 vda Status assigned => feedback 12-04-07 04:56 sunx File Added: dot_config 12-04-07 04:57 sunx Note Added: 0003014 12-04-07 04:58 sunx Note Added: 0003019 12-04-07 04:58 sunx Note Deleted: 0003019 12-04-07 04:59 sunx Note Edited: 0003014 12-04-07 10:51 vda Note Added: 0003024 12-04-07 10:52 vda Status feedback => closed 12-04-07 10:52 vda Resolution open => unable to reproduce 12-04-07 21:18 sunx Status closed => feedback 12-04-07 21:18 sunx Resolution unable to reproduce => reopened 12-04-07 21:18 sunx Note Added: 0003029 12-05-07 17:20 sunx Note Added: 0003034 12-08-07 19:47 vda Status feedback => closed 12-08-07 19:47 vda Note Added: 0003069 ====================================================================== From vda at busybox.net Sat Dec 8 20:13:47 2007 From: vda at busybox.net (vda at busybox.net) Date: Sat, 8 Dec 2007 20:13:47 -0800 (PST) Subject: svn commit: trunk/busybox/editors Message-ID: <20071209041347.A0C9912854E@busybox.net> Author: vda Date: 2007-12-08 20:13:43 -0800 (Sat, 08 Dec 2007) New Revision: 20630 Log: vi: don't use common_bufsiz as read buffer, it can be too small (found by Cristian Ionescu-Idbohrn ) Modified: trunk/busybox/editors/vi.c Changeset: Modified: trunk/busybox/editors/vi.c =================================================================== --- trunk/busybox/editors/vi.c 2007-12-08 00:59:10 UTC (rev 20629) +++ trunk/busybox/editors/vi.c 2007-12-09 04:13:43 UTC (rev 20630) @@ -184,6 +184,7 @@ #if ENABLE_FEATURE_VI_COLON char *initial_cmds[3]; // currently 2 entries, NULL terminated #endif + char readbuffer[MAX_LINELEN]; }; #define G (*ptr_to_globals) #define text (G.text ) @@ -200,6 +201,10 @@ #define term_orig (G.term_orig ) #define term_vi (G.term_vi ) #define initial_cmds (G.initial_cmds ) +#define readbuffer (G.readbuffer ) +#define INIT_G() do { \ + PTR_TO_GLOBALS = xzalloc(sizeof(G)); \ +} while (0) static int init_text_buffer(char *); // init from file or create new static void edit_file(char *); // edit one file @@ -321,7 +326,7 @@ my_pid = getpid(); #endif - PTR_TO_GLOBALS = xzalloc(sizeof(G)); + INIT_G(); #if ENABLE_FEATURE_VI_CRASHME srand((long) my_pid); @@ -2142,8 +2147,6 @@ return safe_poll(pfd, 1, hund*10) > 0; } -#define readbuffer bb_common_bufsiz1 - static int readed_for_parse; //----- IO Routines -------------------------------------------- From vda at busybox.net Sun Dec 9 02:03:31 2007 From: vda at busybox.net (vda at busybox.net) Date: Sun, 9 Dec 2007 02:03:31 -0800 (PST) Subject: svn commit: trunk/busybox: libbb shell Message-ID: <20071209100331.280C5128504@busybox.net> Author: vda Date: 2007-12-09 02:03:28 -0800 (Sun, 09 Dec 2007) New Revision: 20631 Log: lineedit: don't violate API if we do simple fgets ash: cosmetic style fixes, no code changes Modified: trunk/busybox/libbb/lineedit.c trunk/busybox/shell/ash.c Changeset: Modified: trunk/busybox/libbb/lineedit.c =================================================================== --- trunk/busybox/libbb/lineedit.c 2007-12-09 04:13:43 UTC (rev 20630) +++ trunk/busybox/libbb/lineedit.c 2007-12-09 10:03:28 UTC (rev 20631) @@ -1343,8 +1343,10 @@ int len; parse_and_put_prompt(prompt); fflush(stdout); - fgets(command, maxsize, stdin); - len = strlen(command); + if (fgets(command, maxsize, stdin) == NULL) + len = -1; /* EOF or error */ + else + len = strlen(command); DEINIT_S(); return len; } Modified: trunk/busybox/shell/ash.c =================================================================== --- trunk/busybox/shell/ash.c 2007-12-09 04:13:43 UTC (rev 20630) +++ trunk/busybox/shell/ash.c 2007-12-09 10:03:28 UTC (rev 20631) @@ -8553,7 +8553,7 @@ goto retry; } if (nr < 0 && errno == 0) { - /* Ctrl+D presend */ + /* Ctrl+D pressed */ nr = 0; } } @@ -8564,8 +8564,8 @@ if (nr < 0) { if (parsefile->fd == 0 && errno == EWOULDBLOCK) { int flags = fcntl(0, F_GETFL); - if (flags >= 0 && flags & O_NONBLOCK) { - flags &=~ O_NONBLOCK; + if (flags >= 0 && (flags & O_NONBLOCK)) { + flags &= ~O_NONBLOCK; if (fcntl(0, F_SETFL, flags) >= 0) { out2str("sh: turning off NDELAY mode\n"); goto retry; From vda at busybox.net Sun Dec 9 02:07:39 2007 From: vda at busybox.net (vda at busybox.net) Date: Sun, 9 Dec 2007 02:07:39 -0800 (PST) Subject: svn commit: trunk/busybox: findutils include Message-ID: <20071209100739.00332128504@busybox.net> Author: vda Date: 2007-12-09 02:07:39 -0800 (Sun, 09 Dec 2007) New Revision: 20632 Log: find: add -iname support (Alexander Griesser ) Modified: trunk/busybox/findutils/find.c trunk/busybox/include/usage.h Changeset: Modified: trunk/busybox/findutils/find.c =================================================================== --- trunk/busybox/findutils/find.c 2007-12-09 10:03:28 UTC (rev 20631) +++ trunk/busybox/findutils/find.c 2007-12-09 10:07:39 UTC (rev 20632) @@ -76,7 +76,7 @@ #define ACTS(name, arg...) typedef struct { action a; arg; } action_##name; #define ACTF(name) static int func_##name(const char *fileName, struct stat *statbuf, action_##name* ap) ACTS(print) - ACTS(name, const char *pattern;) + ACTS(name, const char *pattern; bool iname;) USE_FEATURE_FIND_PATH( ACTS(path, const char *pattern;)) USE_FEATURE_FIND_REGEX( ACTS(regex, regex_t compiled_pattern;)) USE_FEATURE_FIND_PRINT0( ACTS(print0)) @@ -188,8 +188,9 @@ if (*tmp == '/') tmp++; } - return fnmatch(ap->pattern, tmp, FNM_PERIOD) == 0; + return fnmatch(ap->pattern, tmp, FNM_PERIOD | (ap->iname ? FNM_CASEFOLD : 0)) == 0; } + #if ENABLE_FEATURE_FIND_PATH ACTF(path) { @@ -458,6 +459,7 @@ USE_FEATURE_FIND_PAREN( PARM_char_brace,) /* All options starting from here require argument */ PARM_name , + PARM_iname , USE_FEATURE_FIND_PATH( PARM_path ,) USE_FEATURE_FIND_REGEX( PARM_regex ,) USE_FEATURE_FIND_TYPE( PARM_type ,) @@ -490,6 +492,7 @@ USE_FEATURE_FIND_PAREN( "(\0" ) /* All options starting from here require argument */ "-name\0" + "-iname\0" USE_FEATURE_FIND_PATH( "-path\0" ) USE_FEATURE_FIND_REGEX( "-regex\0" ) USE_FEATURE_FIND_TYPE( "-type\0" ) @@ -654,10 +657,11 @@ argv = endarg; } #endif - else if (parm == PARM_name) { + else if (parm == PARM_name || parm == PARM_iname) { action_name *ap; ap = ALLOC_ACTION(name); ap->pattern = arg1; + ap->iname = (parm == PARM_iname); } #if ENABLE_FEATURE_FIND_PATH else if (parm == PARM_path) { Modified: trunk/busybox/include/usage.h =================================================================== --- trunk/busybox/include/usage.h 2007-12-09 10:03:28 UTC (rev 20631) +++ trunk/busybox/include/usage.h 2007-12-09 10:07:39 UTC (rev 20632) @@ -1008,6 +1008,7 @@ "\n -maxdepth N Descend at most N levels. -maxdepth 0 applies" \ "\n tests/actions to command line arguments only") \ "\n -name PATTERN File name (w/o directory name) matches PATTERN" \ + "\n -iname PATTERN Case insensitive -name" \ USE_FEATURE_FIND_PATH( \ "\n -path PATTERN Path matches PATTERN") \ USE_FEATURE_FIND_REGEX( \ From vda at busybox.net Sun Dec 9 23:03:57 2007 From: vda at busybox.net (vda at busybox.net) Date: Sun, 9 Dec 2007 23:03:57 -0800 (PST) Subject: svn commit: trunk/busybox: include networking/udhcp Message-ID: <20071210070357.9D2FE12857E@busybox.net> Author: vda Date: 2007-12-09 23:03:38 -0800 (Sun, 09 Dec 2007) New Revision: 20634 Log: udhcpc: support for -O