From bugs at busybox.net Thu Mar 1 13:14:16 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Thu, 1 Mar 2007 13:14:16 -0800 Subject: [BusyBox 0001244]: (init) inittab handling broken in revision 17937 Message-ID: The following issue has been SUBMITTED. ====================================================================== http://busybox.net/bugs/view.php?id=1244 ====================================================================== Reported By: espakman Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1244 Category: Other Reproducibility: always Severity: major Priority: normal Status: assigned ====================================================================== Date Submitted: 03-01-2007 13:14 PST Last Modified: 03-01-2007 13:14 PST ====================================================================== Summary: (init) inittab handling broken in revision 17937 Description: Since revision 17937 not all items in the inittab are executed. My inittab file: ::sysinit:/etc/init.d/rcS ::wait:/etc/init.d/rc 2 tty1::respawn:/sbin/getty 38400 tty1 tty2::respawn:/sbin/getty 38400 tty2 ::restart:/sbin/init ::shutdown:/etc/init.d/rc 0 The "wait" (rc 2) and "shutdown" (rc 0) scripts are not executed after rev 17937, also if I replace the "wait" with a second "sysinit" this line is not executed. Running rc 0 or rc 2 by hand or using a busybox before rev 17937 works fine. Libc: uClibc-0.9.28 gcc: gcc-3.3.3 ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 03-01-07 13:14 espakman New Issue 03-01-07 13:14 espakman Status new => assigned 03-01-07 13:14 espakman Assigned To => BusyBox ====================================================================== From bugs at busybox.net Fri Mar 2 00:36:58 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Fri, 2 Mar 2007 00:36:58 -0800 Subject: [BusyBox 0001245]: tftp client doesn't work Message-ID: The following issue has been SUBMITTED. ====================================================================== http://busybox.net/bugs/view.php?id=1245 ====================================================================== Reported By: dibacco73 Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1245 Category: Documentation Reproducibility: always Severity: minor Priority: normal Status: assigned ====================================================================== Date Submitted: 03-02-2007 00:36 PST Last Modified: 03-02-2007 00:36 PST ====================================================================== Summary: tftp client doesn't work Description: I have an embedded system with busybox-1.4.0, connected in a LAN where there is an tftp server (tftp32). I can ping the tftp server but when I try to do an tftp session using the tftp client embedded in busybox I receive a timeout. ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 03-02-07 00:36 dibacco73 New Issue 03-02-07 00:36 dibacco73 Status new => assigned 03-02-07 00:36 dibacco73 Assigned To => BusyBox ====================================================================== From bugs at busybox.net Fri Mar 2 04:46:51 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Fri, 2 Mar 2007 04:46:51 -0800 Subject: [BusyBox 0001245]: tftp client doesn't work Message-ID: <3dc3e36293a9b858ff1fcbaa2898ddbb@bugs.busybox.net> A NOTE has been added to this issue. ====================================================================== http://busybox.net/bugs/view.php?id=1245 ====================================================================== Reported By: dibacco73 Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1245 Category: Documentation Reproducibility: always Severity: minor Priority: normal Status: assigned ====================================================================== Date Submitted: 03-02-2007 00:36 PST Last Modified: 03-02-2007 04:46 PST ====================================================================== Summary: tftp client doesn't work Description: I have an embedded system with busybox-1.4.0, connected in a LAN where there is an tftp server (tftp32). I can ping the tftp server but when I try to do an tftp session using the tftp client embedded in busybox I receive a timeout. ====================================================================== ---------------------------------------------------------------------- razzor - 03-02-07 04:46 ---------------------------------------------------------------------- At least tftp-hpa (http://www.kernel.org/pub/software/network/tftp/) replies from a different port than udp/69. So these checks in networking/tftp.c (1.4.1) are invalid: if (from->sa_family == AF_INET6) if (((struct sockaddr_in6*)from)->sin6_port != port) goto recv_again; if (from->sa_family == AF_INET) if (((struct sockaddr_in*)from)->sin_port != port) goto recv_again; Issue History Date Modified Username Field Change ====================================================================== 03-02-07 00:36 dibacco73 New Issue 03-02-07 00:36 dibacco73 Status new => assigned 03-02-07 00:36 dibacco73 Assigned To => BusyBox 03-02-07 04:46 razzor Note Added: 0002194 ====================================================================== From bugs at busybox.net Fri Mar 2 07:13:22 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Fri, 2 Mar 2007 07:13:22 -0800 Subject: [BusyBox 0001245]: tftp client doesn't work Message-ID: <1dbeedbaeb23be467fe3910c08725ee7@bugs.busybox.net> A NOTE has been added to this issue. ====================================================================== http://busybox.net/bugs/view.php?id=1245 ====================================================================== Reported By: dibacco73 Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1245 Category: Documentation Reproducibility: always Severity: minor Priority: normal Status: assigned ====================================================================== Date Submitted: 03-02-2007 00:36 PST Last Modified: 03-02-2007 07:13 PST ====================================================================== Summary: tftp client doesn't work Description: I have an embedded system with busybox-1.4.0, connected in a LAN where there is an tftp server (tftp32). I can ping the tftp server but when I try to do an tftp session using the tftp client embedded in busybox I receive a timeout. ====================================================================== ---------------------------------------------------------------------- razzor - 03-02-07 04:47 ---------------------------------------------------------------------- At least tftp-hpa ( http://www.kernel.org/pub/software/network/tftp/ ) replies from a different port than udp/69. So these checks in networking/tftp.c (1.4.1) are invalid: if (from->sa_family == AF_INET6) if (((struct sockaddr_in6*)from)->sin6_port != port) goto recv_again; if (from->sa_family == AF_INET) if (((struct sockaddr_in*)from)->sin_port != port) goto recv_again; ---------------------------------------------------------------------- dibacco73 - 03-02-07 07:13 ---------------------------------------------------------------------- Removing the checks in tftp.c leads to another problem: tftp32 server says: error 10054 in system call recv. An existing connection was forcibly closed by the remote host The remote host is the embedded busybox system doing running tftp client. Issue History Date Modified Username Field Change ====================================================================== 03-02-07 00:36 dibacco73 New Issue 03-02-07 00:36 dibacco73 Status new => assigned 03-02-07 00:36 dibacco73 Assigned To => BusyBox 03-02-07 04:46 razzor Note Added: 0002194 03-02-07 04:47 razzor Note Edited: 0002194 03-02-07 07:13 dibacco73 Note Added: 0002195 ====================================================================== From bugs at busybox.net Fri Mar 2 12:38:13 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Fri, 2 Mar 2007 12:38:13 -0800 Subject: [BusyBox 0001244]: (init) inittab handling broken in revision 17937 Message-ID: <71f51bdfb6b074d3c3f58e41ecef884d@busybox.net> A NOTE has been added to this issue. ====================================================================== http://busybox.net/bugs/view.php?id=1244 ====================================================================== Reported By: espakman Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1244 Category: Other Reproducibility: always Severity: major Priority: normal Status: assigned ====================================================================== Date Submitted: 03-01-2007 13:14 PST Last Modified: 03-02-2007 12:38 PST ====================================================================== Summary: (init) inittab handling broken in revision 17937 Description: Since revision 17937 not all items in the inittab are executed. My inittab file: ::sysinit:/etc/init.d/rcS ::wait:/etc/init.d/rc 2 tty1::respawn:/sbin/getty 38400 tty1 tty2::respawn:/sbin/getty 38400 tty2 ::restart:/sbin/init ::shutdown:/etc/init.d/rc 0 The "wait" (rc 2) and "shutdown" (rc 0) scripts are not executed after rev 17937, also if I replace the "wait" with a second "sysinit" this line is not executed. Running rc 0 or rc 2 by hand or using a busybox before rev 17937 works fine. Libc: uClibc-0.9.28 gcc: gcc-3.3.3 ====================================================================== ---------------------------------------------------------------------- espakman - 03-02-07 12:38 ---------------------------------------------------------------------- The problem seems to be a bit different. No init startup/shutdown output is shown on the console anymore and some daemons won't start up on boot time with this revision (maybe they need a controlling tty?). Some examples of daemons that won't start on init: dnsmasq and ulogd Issue History Date Modified Username Field Change ====================================================================== 03-01-07 13:14 espakman New Issue 03-01-07 13:14 espakman Status new => assigned 03-01-07 13:14 espakman Assigned To => BusyBox 03-02-07 12:38 espakman Note Added: 0002196 ====================================================================== From bugs at busybox.net Fri Mar 2 15:08:45 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Fri, 2 Mar 2007 15:08:45 -0800 Subject: [BusyBox 0001245]: tftp client doesn't work Message-ID: The following issue has been CLOSED ====================================================================== http://busybox.net/bugs/view.php?id=1245 ====================================================================== Reported By: dibacco73 Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1245 Category: Documentation Reproducibility: always Severity: minor Priority: normal Status: closed Resolution: open Fixed in Version: ====================================================================== Date Submitted: 03-02-2007 00:36 PST Last Modified: 03-02-2007 15:08 PST ====================================================================== Summary: tftp client doesn't work Description: I have an embedded system with busybox-1.4.0, connected in a LAN where there is an tftp server (tftp32). I can ping the tftp server but when I try to do an tftp session using the tftp client embedded in busybox I receive a timeout. ====================================================================== ---------------------------------------------------------------------- razzor - 03-02-07 04:47 ---------------------------------------------------------------------- At least tftp-hpa ( http://www.kernel.org/pub/software/network/tftp/ ) replies from a different port than udp/69. So these checks in networking/tftp.c (1.4.1) are invalid: if (from->sa_family == AF_INET6) if (((struct sockaddr_in6*)from)->sin6_port != port) goto recv_again; if (from->sa_family == AF_INET) if (((struct sockaddr_in*)from)->sin_port != port) goto recv_again; ---------------------------------------------------------------------- dibacco73 - 03-02-07 07:13 ---------------------------------------------------------------------- Removing the checks in tftp.c leads to another problem: tftp32 server says: error 10054 in system call recv. An existing connection was forcibly closed by the remote host The remote host is the embedded busybox system doing running tftp client. ---------------------------------------------------------------------- vda - 03-02-07 15:08 ---------------------------------------------------------------------- Already fixed in svn. Also adding patch to post 1.4.1: http://busybox.net/downloads/fixes-1.4.1/busybox-1.4.1-tftp.patch Issue History Date Modified Username Field Change ====================================================================== 03-02-07 00:36 dibacco73 New Issue 03-02-07 00:36 dibacco73 Status new => assigned 03-02-07 00:36 dibacco73 Assigned To => BusyBox 03-02-07 04:46 razzor Note Added: 0002194 03-02-07 04:47 razzor Note Edited: 0002194 03-02-07 07:13 dibacco73 Note Added: 0002195 03-02-07 15:08 vda Status assigned => closed 03-02-07 15:08 vda Note Added: 0002197 ====================================================================== From bugs at busybox.net Fri Mar 2 15:09:23 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Fri, 2 Mar 2007 15:09:23 -0800 Subject: [BusyBox 0001226]: static busybox break tftp Message-ID: <6c9fd78d93be8155bf255b49a3d4c952@busybox.net> The following issue has been CLOSED ====================================================================== http://busybox.net/bugs/view.php?id=1226 ====================================================================== Reported By: goutnet Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1226 Category: Networking Support Reproducibility: always Severity: block Priority: normal Status: closed Resolution: open Fixed in Version: ====================================================================== Date Submitted: 02-16-2007 07:47 PST Last Modified: 03-02-2007 15:09 PST ====================================================================== Summary: static busybox break tftp Description: tftp can not download any file when compiled as static (with glibc), I have not tried with uClibc : client: :/$ /bin/tftp -g -l /tmp/version.txt -r /rootfs/version.txt 10.0.0.1 using server "10.0.0.1:69", remotefile "/rootfs/version.txt", localfile "/tmp/version.txt". sending 28 bytes 00 01 2f 72 6f 6f 74 66 73 2f 76 65 72 73 69 6f 6e 2e 74 78 74 00 6f 63 74 65 74 00 tftp: timeout sending 28 bytes 00 01 2f 72 6f 6f 74 66 73 2f 76 65 72 73 69 6f 6e 2e 74 78 74 00 6f 63 74 65 74 00 tftp: timeout sending 28 bytes 00 01 2f 72 6f 6f 74 66 73 2f 76 65 72 73 69 6f 6e 2e 74 78 74 00 6f 63 74 65 74 00 tftp: timeout sending 28 bytes 00 01 2f 72 6f 6f 74 66 73 2f 76 65 72 73 69 6f 6e 2e 74 78 74 00 6f 63 74 65 74 00 tftp: timeout sending 28 bytes 00 01 2f 72 6f 6f 74 66 73 2f 76 65 72 73 69 6f 6e 2e 74 78 74 00 6f 63 74 65 74 00 tftp: timeout tftp: last timeout server log : Feb 16 16:45:58 eikichi atftpd[14858]: Serving /rootfs/version.txt to 192.168.100.71:32925 Feb 16 16:45:58 eikichi atftpd[14858]: timeout: retrying... Feb 16 16:46:23 eikichi last message repeated 8 times Feb 16 16:46:28 eikichi atftpd[14858]: Serving /rootfs/version.txt to 192.168.100.71:32925 Feb 16 16:46:33 eikichi atftpd[14858]: timeout: retrying... Feb 16 16:46:38 eikichi atftpd[14858]: timeout: retrying... Feb 16 16:46:38 eikichi atftpd[14858]: Serving /rootfs/version.txt to 192.168.100.71:32925 Feb 16 16:46:43 eikichi atftpd[14858]: timeout: retrying... Feb 16 16:47:03 eikichi last message repeated 7 times looking to tcpdump, the answer is sent from the server, but the client does not listen ... I tried several other clients, all works ... ====================================================================== ---------------------------------------------------------------------- vda - 02-17-07 08:10 ---------------------------------------------------------------------- I think your build produced the following warning: #warning Static linking against glibc produces buggy executables #warning (glibc does not cope well with ld --gc-sections). #warning See sources.redhat.com/bugzilla/show_bug.cgi?id=3400 #warning Note that glibc is unsuitable for static linking anyway. #warning If you still want to do it, remove -Wl,--gc-sections #warning from top-level Makefile and remove this warning. Did you try non-static build? Did you remove -Wl,--gc-sections? Please show those tcpdumps you mention. Also there were some fixes to tftp recently, consider testing current svn. ---------------------------------------------------------------------- goutnet - 02-19-07 07:46 ---------------------------------------------------------------------- I did remove the mentionned code, applying a selfmade patch : Index: busybox/Makefile =================================================================== --- busybox.orig/Makefile 2007-02-15 16:42:26.000000000 +0100 +++ busybox/Makefile 2007-02-15 16:42:29.000000000 +0100 @@ -563,7 +563,7 @@ quiet_cmd_busybox__ ?= LINK $@ cmd_busybox__ ?= $(srctree)/scripts/trylink $(CC) $(LDFLAGS) \ -o $@ \ - -Wl,--warn-common -Wl,--sort-common -Wl,--gc-sections \ + -Wl,--warn-common -Wl,--sort-common \ -Wl,--start-group $(busybox-all) -Wl,--end-group # Generate System.map Index: busybox/applets/applets.c =================================================================== --- busybox.orig/applets/applets.c 2007-02-15 16:43:00.000000000 +0100 +++ busybox/applets/applets.c 2007-02-15 16:43:07.000000000 +0100 @@ -15,16 +15,6 @@ #include "busybox.h" #include -/* Apparently uclibc defines __GLIBC__ (compat trick?). Oh well. */ -#if ENABLE_STATIC && defined(__GLIBC__) && !defined(__UCLIBC__) -#warning Static linking against glibc produces buggy executables -#warning (glibc does not cope well with ld --gc-sections). -#warning See sources.redhat.com/bugzilla/show_bug.cgi?id=3400 -#warning Note that glibc is unsuitable for static linking anyway. -#warning If you still want to do it, remove -Wl,--gc-sections -#warning from top-level Makefile and remove this warning. -#endif - #if ENABLE_SHOW_USAGE && !ENABLE_FEATURE_COMPRESS_USAGE static const char usage_messages[] = #define MAKE_USAGE a non static build work (as mentionned), only static build fails, I'll redo the tcpdump thing when I can (and I will try the svn version as well) ---------------------------------------------------------------------- goutnet - 02-19-07 08:13 ---------------------------------------------------------------------- I just checked the svn version, and this fix the issue ... I didn't look carefully to the code, but it sounds like there were only minor changes ... Well, anyway, thanks for the trick :) Issue History Date Modified Username Field Change ====================================================================== 02-16-07 07:47 goutnet New Issue 02-16-07 07:47 goutnet Status new => assigned 02-16-07 07:47 goutnet Assigned To => BusyBox 02-16-07 07:47 goutnet File Added: .config 02-17-07 08:10 vda Note Added: 0002177 02-19-07 07:46 goutnet Note Added: 0002181 02-19-07 08:13 goutnet Note Added: 0002182 03-02-07 15:09 vda Status assigned => closed ====================================================================== From vda at busybox.net Fri Mar 2 16:36:35 2007 From: vda at busybox.net (vda at busybox.net) Date: Fri, 2 Mar 2007 16:36:35 -0800 (PST) Subject: svn commit: trunk/busybox: libbb networking Message-ID: <20070303003635.E32434867E@busybox.net> Author: vda Date: 2007-03-02 16:36:35 -0800 (Fri, 02 Mar 2007) New Revision: 17999 Log: ping: don't measure times if ping payload is less than 8 bytes; commonalize some ping code. Modified: trunk/busybox/libbb/create_icmp6_socket.c trunk/busybox/libbb/create_icmp_socket.c trunk/busybox/networking/ping.c Changeset: Modified: trunk/busybox/libbb/create_icmp6_socket.c =================================================================== --- trunk/busybox/libbb/create_icmp6_socket.c 2007-03-02 23:03:05 UTC (rev 17998) +++ trunk/busybox/libbb/create_icmp6_socket.c 2007-03-03 00:36:35 UTC (rev 17999) @@ -10,8 +10,6 @@ #include #include #include -#include -#include #include "libbb.h" #ifdef CONFIG_FEATURE_IPV6 @@ -23,12 +21,12 @@ proto = getprotobyname("ipv6-icmp"); /* if getprotobyname failed, just silently force * proto->p_proto to have the correct value for "ipv6-icmp" */ - if ((sock = socket(AF_INET6, SOCK_RAW, - (proto ? proto->p_proto : IPPROTO_ICMPV6))) < 0) { + sock = socket(AF_INET6, SOCK_RAW, + (proto ? proto->p_proto : IPPROTO_ICMPV6)); + if (sock < 0) { if (errno == EPERM) bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); - else - bb_perror_msg_and_die(bb_msg_can_not_create_raw_socket); + bb_perror_msg_and_die(bb_msg_can_not_create_raw_socket); } /* drop root privs if running setuid */ Modified: trunk/busybox/libbb/create_icmp_socket.c =================================================================== --- trunk/busybox/libbb/create_icmp_socket.c 2007-03-02 23:03:05 UTC (rev 17998) +++ trunk/busybox/libbb/create_icmp_socket.c 2007-03-03 00:36:35 UTC (rev 17999) @@ -10,8 +10,6 @@ #include #include #include -#include -#include #include "libbb.h" int create_icmp_socket(void) @@ -22,12 +20,12 @@ proto = getprotobyname("icmp"); /* if getprotobyname failed, just silently force * proto->p_proto to have the correct value for "icmp" */ - if ((sock = socket(AF_INET, SOCK_RAW, - (proto ? proto->p_proto : 1))) < 0) { /* 1 == ICMP */ + sock = socket(AF_INET, SOCK_RAW, + (proto ? proto->p_proto : 1)); /* 1 == ICMP */ + if (sock < 0) { if (errno == EPERM) bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); - else - bb_perror_msg_and_die(bb_msg_can_not_create_raw_socket); + bb_perror_msg_and_die(bb_msg_can_not_create_raw_socket); } /* drop root privs if running setuid */ Modified: trunk/busybox/networking/ping.c =================================================================== --- trunk/busybox/networking/ping.c 2007-03-02 23:03:05 UTC (rev 17998) +++ trunk/busybox/networking/ping.c 2007-03-03 00:36:35 UTC (rev 17999) @@ -262,7 +262,8 @@ static unsigned long ntransmitted, nreceived, nrepeats, pingcount; static int myid; -static unsigned long tmin = ULONG_MAX, tmax, tsum; +static unsigned tmin = UINT_MAX, tmax; +static unsigned long tsum; static char rcvd_tbl[MAX_DUP_CHK / 8]; static const char *hostname; @@ -278,8 +279,6 @@ static void pingstats(int junk ATTRIBUTE_UNUSED) { - int status; - signal(SIGINT, SIG_IGN); printf("\n--- %s ping statistics ---\n", hostname); @@ -290,16 +289,12 @@ if (ntransmitted) ntransmitted = (ntransmitted - nreceived) * 100 / ntransmitted; printf("%lu%% packet loss\n", ntransmitted); - if (nreceived) - printf("round-trip min/avg/max = %lu.%lu/%lu.%lu/%lu.%lu ms\n", + if (tmin != UINT_MAX) + printf("round-trip min/avg/max = %u.%u/%lu.%lu/%u.%u ms\n", tmin / 10, tmin % 10, (tsum / (nreceived + nrepeats)) / 10, (tsum / (nreceived + nrepeats)) % 10, tmax / 10, tmax % 10); - if (nreceived != 0) - status = EXIT_SUCCESS; - else - status = EXIT_FAILURE; - exit(status); + exit(nreceived == 0); /* (nreceived == 0) is true (1) -- 'failure' */ } static void sendping_tail(void (*sp)(int), const void *pkt, int size_pkt) @@ -406,16 +401,58 @@ } #endif +static void unpack_tail(int sz, struct timeval *tp, + const char *from_str, + uint16_t recv_seq, int ttl) +{ + const char *dupmsg = " (DUP!)"; + unsigned triptime = triptime; /* for gcc */ + + ++nreceived; + + if (tp) { + struct timeval tv; + + gettimeofday(&tv, NULL); + tv.tv_usec -= tp->tv_usec; + if (tv.tv_usec < 0) { + --tv.tv_sec; + tv.tv_usec += 1000000; + } + tv.tv_sec -= tp->tv_sec; + + triptime = tv.tv_sec * 10000 + (tv.tv_usec / 100); + tsum += triptime; + if (triptime < tmin) + tmin = triptime; + if (triptime > tmax) + tmax = triptime; + } + + if (TST(recv_seq % MAX_DUP_CHK)) { + ++nrepeats; + --nreceived; + } else { + SET(recv_seq % MAX_DUP_CHK); + dupmsg += 7; + } + + if (option_mask32 & OPT_QUIET) + return; + + printf("%d bytes from %s: seq=%u ttl=%d", sz, + from_str, recv_seq, ttl); + if (tp) + printf(" time=%u.%u ms", triptime / 10, triptime % 10); + puts(dupmsg); + fflush(stdout); +} static void unpack4(char *buf, int sz, struct sockaddr_in *from) { struct icmp *icmppkt; struct iphdr *iphdr; - struct timeval tv, *tp; - int hlen, dupflag; - unsigned long triptime; + int hlen; - gettimeofday(&tv, NULL); - /* discard if too short */ if (sz < (datalen + ICMP_MINLEN)) return; @@ -430,61 +467,25 @@ if (icmppkt->icmp_type == ICMP_ECHOREPLY) { uint16_t recv_seq = ntohs(icmppkt->icmp_seq); - ++nreceived; - tp = (struct timeval *) icmppkt->icmp_data; + struct timeval *tp = NULL; - if ((tv.tv_usec -= tp->tv_usec) < 0) { - --tv.tv_sec; - tv.tv_usec += 1000000; - } - tv.tv_sec -= tp->tv_sec; - - triptime = tv.tv_sec * 10000 + (tv.tv_usec / 100); - tsum += triptime; - if (triptime < tmin) - tmin = triptime; - if (triptime > tmax) - tmax = triptime; - - if (TST(recv_seq % MAX_DUP_CHK)) { - ++nrepeats; - --nreceived; - dupflag = 1; - } else { - SET(recv_seq % MAX_DUP_CHK); - dupflag = 0; - } - - if (option_mask32 & OPT_QUIET) - return; - - printf("%d bytes from %s: icmp_seq=%u", sz, - inet_ntoa(*(struct in_addr *) &from->sin_addr.s_addr), - recv_seq); - printf(" ttl=%d", iphdr->ttl); - printf(" time=%lu.%lu ms", triptime / 10, triptime % 10); - if (dupflag) - printf(" (DUP!)"); - puts(""); - } else { - if (icmppkt->icmp_type != ICMP_ECHO) - bb_error_msg("warning: got ICMP %d (%s)", - icmppkt->icmp_type, - icmp_type_name(icmppkt->icmp_type)); + if (sz >= ICMP_MINLEN + sizeof(struct timeval)) + tp = (struct timeval *) icmppkt->icmp_data; + unpack_tail(sz, tp, + inet_ntoa(*(struct in_addr *) &from->sin_addr.s_addr), + recv_seq, iphdr->ttl); + } else if (icmppkt->icmp_type != ICMP_ECHO) { + bb_error_msg("warning: got ICMP %d (%s)", + icmppkt->icmp_type, + icmp_type_name(icmppkt->icmp_type)); } - fflush(stdout); } #if ENABLE_PING6 static void unpack6(char *packet, int sz, struct sockaddr_in6 *from, int hoplimit) { struct icmp6_hdr *icmppkt; - struct timeval tv, *tp; - int dupflag; - unsigned long triptime; char buf[INET6_ADDRSTRLEN]; - gettimeofday(&tv, NULL); - /* discard if too short */ if (sz < (datalen + sizeof(struct icmp6_hdr))) return; @@ -495,50 +496,19 @@ if (icmppkt->icmp6_type == ICMP6_ECHO_REPLY) { uint16_t recv_seq = ntohs(icmppkt->icmp6_seq); - ++nreceived; - tp = (struct timeval *) &icmppkt->icmp6_data8[4]; + struct timeval *tp = NULL; - if ((tv.tv_usec -= tp->tv_usec) < 0) { - --tv.tv_sec; - tv.tv_usec += 1000000; - } - tv.tv_sec -= tp->tv_sec; - - triptime = tv.tv_sec * 10000 + (tv.tv_usec / 100); - tsum += triptime; - if (triptime < tmin) - tmin = triptime; - if (triptime > tmax) - tmax = triptime; - - if (TST(recv_seq % MAX_DUP_CHK)) { - ++nrepeats; - --nreceived; - dupflag = 1; - } else { - SET(recv_seq % MAX_DUP_CHK); - dupflag = 0; - } - - if (option_mask32 & OPT_QUIET) - return; - - printf("%d bytes from %s: icmp6_seq=%u", sz, - inet_ntop(AF_INET6, &pingaddr.sin6.sin6_addr, - buf, sizeof(buf)), - recv_seq); - printf(" ttl=%d time=%lu.%lu ms", hoplimit, - triptime / 10, triptime % 10); - if (dupflag) - printf(" (DUP!)"); - puts(""); - } else { - if (icmppkt->icmp6_type != ICMP6_ECHO_REQUEST) - bb_error_msg("warning: got ICMP %d (%s)", - icmppkt->icmp6_type, - icmp6_type_name(icmppkt->icmp6_type)); + if (sz >= sizeof(struct icmp6_hdr) + sizeof(struct timeval)) + tp = (struct timeval *) &icmppkt->icmp6_data8[4]; + unpack_tail(sz, tp, + inet_ntop(AF_INET6, &pingaddr.sin6.sin6_addr, + buf, sizeof(buf)), + recv_seq, hoplimit); + } else if (icmppkt->icmp6_type != ICMP6_ECHO_REQUEST) { + bb_error_msg("warning: got ICMP %d (%s)", + icmppkt->icmp6_type, + icmp6_type_name(icmppkt->icmp6_type)); } - fflush(stdout); } #endif From vda at busybox.net Sat Mar 3 12:06:59 2007 From: vda at busybox.net (vda at busybox.net) Date: Sat, 3 Mar 2007 12:06:59 -0800 (PST) Subject: svn commit: trunk/busybox/archival: libunarchive Message-ID: <20070303200659.776F448559@busybox.net> Author: vda Date: 2007-03-03 12:06:59 -0800 (Sat, 03 Mar 2007) New Revision: 18001 Log: tar: handle tarfiles with (broken) checksums a-la Sun. Modified: trunk/busybox/archival/libunarchive/get_header_tar.c trunk/busybox/archival/tar.c Changeset: Modified: trunk/busybox/archival/libunarchive/get_header_tar.c =================================================================== --- trunk/busybox/archival/libunarchive/get_header_tar.c 2007-03-03 02:20:17 UTC (rev 18000) +++ trunk/busybox/archival/libunarchive/get_header_tar.c 2007-03-03 20:06:59 UTC (rev 18001) @@ -69,7 +69,7 @@ char padding[12]; /* 500-512 */ } tar; char *cp; - int sum, i; + int i, sum_u, sum_s, sum; int parse_names; if (sizeof(tar) != 512) @@ -110,16 +110,23 @@ #endif bb_error_msg_and_die("invalid tar magic"); } - /* Do checksum on headers */ - sum = ' ' * sizeof(tar.chksum); + + /* Do checksum on headers. + * POSIX says that checksum is done on unsigned bytes, but + * Sun and HP-UX fucked it up... more details in + * GNU tar source. */ + sum_s = sum_u = ' ' * sizeof(tar.chksum); for (i = 0; i < 148 ; i++) { - sum += ((char*)&tar)[i]; + sum_u += ((unsigned char*)&tar)[i]; + sum_s += ((signed char*)&tar)[i]; } for (i = 156; i < 512 ; i++) { - sum += ((char*)&tar)[i]; + sum_u += ((unsigned char*)&tar)[i]; + sum_s += ((signed char*)&tar)[i]; } /* This field does not need special treatment (getOctal) */ - if (sum != xstrtoul(tar.chksum, 8)) { + sum = xstrtoul(tar.chksum, 8); + if (sum_u != sum && sum_s != sum) { bb_error_msg_and_die("invalid tar header checksum"); } Modified: trunk/busybox/archival/tar.c =================================================================== --- trunk/busybox/archival/tar.c 2007-03-03 02:20:17 UTC (rev 18000) +++ trunk/busybox/archival/tar.c 2007-03-03 20:06:59 UTC (rev 18001) @@ -173,6 +173,9 @@ static void chksum_and_xwrite(int fd, struct TarHeader* hp) { + /* POSIX says that checksum is done on unsigned bytes + * (Sun and HP-UX fucked it up... more details in + * GNU tar source) */ const unsigned char *cp; int chksum, size; From vda at busybox.net Sat Mar 3 15:12:18 2007 From: vda at busybox.net (vda at busybox.net) Date: Sat, 3 Mar 2007 15:12:18 -0800 (PST) Subject: svn commit: trunk/busybox/shell Message-ID: <20070303231218.350BE48689@busybox.net> Author: vda Date: 2007-03-03 15:12:17 -0800 (Sat, 03 Mar 2007) New Revision: 18002 Log: ash: do not use "safe applets" in non-standalone shell Modified: trunk/busybox/shell/ash.c Changeset: Modified: trunk/busybox/shell/ash.c =================================================================== --- trunk/busybox/shell/ash.c 2007-03-03 20:06:59 UTC (rev 18001) +++ trunk/busybox/shell/ash.c 2007-03-03 23:12:17 UTC (rev 18002) @@ -6455,7 +6455,9 @@ /* ============ find_command */ -static int is_safe_applet(char *name) +#if ENABLE_FEATURE_SH_STANDALONE_SHELL +static int +is_safe_applet(char *name) { /* It isn't a bug to have non-existent applet here... */ /* ...just a waste of space... */ @@ -6488,6 +6490,7 @@ return 0; } +#endif struct builtincmd { const char *name; @@ -6551,28 +6554,27 @@ tryexec(char *cmd, char **argv, char **envp) { int repeated = 0; - struct BB_applet *a; - int argc = 0; - char **c; - if (strchr(cmd, '/') == NULL - && (a = find_applet_by_name(cmd)) != NULL - && is_safe_applet(cmd) - ) { - c = argv; - while (*c != NULL) { - c++; argc++; +#if ENABLE_FEATURE_SH_STANDALONE_SHELL + if (strchr(cmd, '/') == NULL) { + struct BB_applet *a; + char **c; + + a = find_applet_by_name(cmd); + if (a) { + if (is_safe_applet(cmd)) { + c = argv; + while (*c) + c++; + applet_name = cmd; + exit(a->main(c - argv, argv)); + } + /* re-exec ourselves with the new arguments */ + execve(CONFIG_BUSYBOX_EXEC_PATH, argv, envp); + /* If they called chroot or otherwise made the binary no longer + * executable, fall through */ } - applet_name = cmd; - exit(a->main(argc, argv)); } -#if ENABLE_FEATURE_SH_STANDALONE_SHELL - if (find_applet_by_name(cmd) != NULL) { - /* re-exec ourselves with the new arguments */ - execve(CONFIG_BUSYBOX_EXEC_PATH, argv, envp); - /* If they called chroot or otherwise made the binary no longer - * executable, fall through */ - } #endif repeat: @@ -6619,7 +6621,7 @@ clearredir(1); envp = environment(); - if (strchr(argv[0], '/') || is_safe_applet(argv[0]) + if (strchr(argv[0], '/') #if ENABLE_FEATURE_SH_STANDALONE_SHELL || find_applet_by_name(argv[0]) #endif @@ -11141,13 +11143,13 @@ entry->u.index = -1; return; } -#endif - + /* Already caught above if (is_safe_applet(name)) { entry->cmdtype = CMDNORMAL; entry->u.index = -1; return; - } + }*/ +#endif updatetbl = (path == pathval()); if (!updatetbl) { From vda at busybox.net Sun Mar 4 10:09:50 2007 From: vda at busybox.net (vda at busybox.net) Date: Sun, 4 Mar 2007 10:09:50 -0800 (PST) Subject: svn commit: trunk/busybox/archival: libunarchive Message-ID: <20070304180950.D395C485B1@busybox.net> Author: vda Date: 2007-03-04 10:09:50 -0800 (Sun, 04 Mar 2007) New Revision: 18003 Log: remove f words Modified: trunk/busybox/archival/libunarchive/get_header_tar.c trunk/busybox/archival/tar.c Changeset: Modified: trunk/busybox/archival/libunarchive/get_header_tar.c =================================================================== --- trunk/busybox/archival/libunarchive/get_header_tar.c 2007-03-03 23:12:17 UTC (rev 18002) +++ trunk/busybox/archival/libunarchive/get_header_tar.c 2007-03-04 18:09:50 UTC (rev 18003) @@ -113,7 +113,7 @@ /* Do checksum on headers. * POSIX says that checksum is done on unsigned bytes, but - * Sun and HP-UX fucked it up... more details in + * Sun and HP-UX gets it wrong... more details in * GNU tar source. */ sum_s = sum_u = ' ' * sizeof(tar.chksum); for (i = 0; i < 148 ; i++) { Modified: trunk/busybox/archival/tar.c =================================================================== --- trunk/busybox/archival/tar.c 2007-03-03 23:12:17 UTC (rev 18002) +++ trunk/busybox/archival/tar.c 2007-03-04 18:09:50 UTC (rev 18003) @@ -174,7 +174,7 @@ static void chksum_and_xwrite(int fd, struct TarHeader* hp) { /* POSIX says that checksum is done on unsigned bytes - * (Sun and HP-UX fucked it up... more details in + * (Sun and HP-UX gets it wrong... more details in * GNU tar source) */ const unsigned char *cp; int chksum, size; From bugs at busybox.net Sun Mar 4 15:35:11 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Sun, 4 Mar 2007 15:35:11 -0800 Subject: [BusyBox 0001239]: BusyBox-1.{3, 4} does not compile with SElinux enabled. Message-ID: <74f9b391333aae0c87eb1873130c2f90@busybox.net> A NOTE has been added to this issue. ====================================================================== http://busybox.net/bugs/view.php?id=1239 ====================================================================== Reported By: Xake Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1239 Category: Other Reproducibility: always Severity: minor Priority: normal Status: assigned ====================================================================== Date Submitted: 02-27-2007 01:38 PST Last Modified: 03-04-2007 15:35 PST ====================================================================== Summary: BusyBox-1.{3,4} does not compile with SElinux enabled. Description: This bug was first encountered with gentoo (see link http://bugs.gentoo.org/show_bug.cgi?id=160879 for more info). make defconfig && make works right. But enabling SELinux support and it fails with the following error (seems like it does not link agains selinux as it should): LINK busybox_unstripped coreutils/lib.a(id.o): In function `id_main': id.c:(.text.id_main+0x135): undefined reference to `is_selinux_enabled' id.c:(.text.id_main+0x145): undefined reference to `getcon' id.c:(.text.id_main+0x17a): undefined reference to `freecon' coreutils/lib.a(ls.o): In function `my_stat': ls.c:(.text.my_stat+0x35): undefined reference to `is_selinux_enabled' ls.c:(.text.my_stat+0x44): undefined reference to `getfilecon' ls.c:(.text.my_stat+0x58): undefined reference to `is_selinux_enabled' ls.c:(.text.my_stat+0x67): undefined reference to `lgetfilecon' coreutils/lib.a(ls.o): In function `showfiles': ls.c:(.text.showfiles+0x46b): undefined reference to `freecon' init/lib.a(init.o): In function `init_main': init.c:(.text.init_main+0x412): undefined reference to `selinux_init_load_policy' loginutils/lib.a(login.o): In function `login_main': login.c:(.text.login_main+0x5b6): undefined reference to `is_selinux_enabled' login.c:(.text.login_main+0x5d4): undefined reference to `get_default_context' login.c:(.text.login_main+0x600): undefined reference to `getfilecon' login.c:(.text.login_main+0x629): undefined reference to `security_compute_relabel' login.c:(.text.login_main+0x649): undefined reference to `setfilecon' procps/lib.a(ps.o): In function `ps_main': ps.c:(.text.ps_main+0x9e): undefined reference to `is_selinux_enabled' ps.c:(.text.ps_main+0xd4): undefined reference to `is_selinux_enabled' ps.c:(.text.ps_main+0xe5): undefined reference to `getpidcon' ps.c:(.text.ps_main+0x11b): undefined reference to `freecon' libbb/lib.a(run_shell.o): In function `set_current_security_context': run_shell.c:(.text.set_current_security_context+0x2c): undefined reference to `freecon' libbb/lib.a(run_shell.o): In function `run_shell': run_shell.c:(.text.run_shell+0xce): undefined reference to `setexeccon' run_shell.c:(.text.run_shell+0xde): undefined reference to `freecon' libbb/lib.a(run_shell.o): In function `renew_current_security_context': run_shell.c:(.text.renew_current_security_context+0x27): undefined reference to `freecon' run_shell.c:(.text.renew_current_security_context+0x34): undefined reference to `getcon' collect2: ld returned 1 exit status make: *** [busybox_unstripped] Error 1 *** However doing: LDFLAGS="-lselinux" make finishes fine ====================================================================== ---------------------------------------------------------------------- vda - 02-27-07 10:20 ---------------------------------------------------------------------- Very strange. It should link against selinux libs by adding these flags: ifeq ($(CONFIG_SELINUX),y) LDFLAGS += -lselinux -lsepol endif Unfortunately I have no selinux libs on my system to test it. Try adding this line: CFLAGS := $(CFLAGS) CPPFLAGS := $(CPPFLAGS) AFLAGS := $(AFLAGS) +LDFLAGS := $(LDFLAGS) does this work? ---------------------------------------------------------------------- jpo - 03-04-07 15:35 ---------------------------------------------------------------------- I'm seeing exactly the same problems in Fedora Core 6 system (busybox 1.3.2 and 1.4.1). Adding ifeq ($(CONFIG_SELINUX),y) LDFLAGS += -lselinux endif to the file Makefile.flags fixes the problem in busybox 1.4.1 but not in busybox 1.3.2. Busybox 1.3.2 still fails but now with a different error: LD applets/built-in.o ld: cannot find -lselinux make[1]: *** [applets/built-in.o] Error 1 make: *** [applets] Error 2 Issue History Date Modified Username Field Change ====================================================================== 02-27-07 01:38 Xake New Issue 02-27-07 01:38 Xake Status new => assigned 02-27-07 01:38 Xake Assigned To => BusyBox 02-27-07 10:20 vda Note Added: 0002190 03-04-07 15:35 jpo Note Added: 0002202 ====================================================================== From vda at busybox.net Sun Mar 4 16:24:52 2007 From: vda at busybox.net (vda at busybox.net) Date: Sun, 4 Mar 2007 16:24:52 -0800 (PST) Subject: svn commit: trunk/busybox/shell Message-ID: <20070305002452.F2C98485CA@busybox.net> Author: vda Date: 2007-03-04 16:24:52 -0800 (Sun, 04 Mar 2007) New Revision: 18004 Log: ash: cosmetic improvements in error messages Modified: trunk/busybox/shell/ash.c Changeset: Modified: trunk/busybox/shell/ash.c =================================================================== --- trunk/busybox/shell/ash.c 2007-03-04 18:09:50 UTC (rev 18003) +++ trunk/busybox/shell/ash.c 2007-03-05 00:24:52 UTC (rev 18004) @@ -985,9 +985,10 @@ { fprintf(stderr, "%s: ", arg0); if (commandname) { - const char *fmt = (!iflag || parsefile->fd) ? - "%s: %d: " : "%s: "; - fprintf(stderr, fmt, commandname, startlinno); + if (strcmp(arg0, commandname)) + fprintf(stderr, "%s: ", commandname); + if (!iflag || parsefile->fd) + fprintf(stderr, "line %d: ", startlinno); } vfprintf(stderr, msg, ap); outcslow('\n', stderr); @@ -1518,13 +1519,13 @@ c = *p++; for (q = optstring; *q != c; ) { if (*q == '\0') - ash_msg_and_raise_error("Illegal option -%c", c); + ash_msg_and_raise_error("illegal option -%c", c); if (*++q == ':') q++; } if (*++q == ':') { if (*p == '\0' && (p = *argptr++) == NULL) - ash_msg_and_raise_error("No arg for -%c option", c); + ash_msg_and_raise_error("no arg for -%c option", c); optionarg = p; p = NULL; } @@ -3426,7 +3427,7 @@ xtcsetpgrp(int fd, pid_t pgrp) { if (tcsetpgrp(fd, pgrp)) - ash_msg_and_raise_error("Cannot set tty process group (%m)"); + ash_msg_and_raise_error("cannot set tty process group (%m)"); } /* @@ -3512,7 +3513,7 @@ if (argc <= 1) { usage: ash_msg_and_raise_error( -"Usage: kill [-s sigspec | -signum | -sigspec] [pid | job]... or\n" +"usage: kill [-s sigspec | -signum | -sigspec] [pid | job]... or\n" "kill -l [exitstatus]" ); } @@ -4472,7 +4473,7 @@ if (jp->nprocs == 0) { close(0); if (open(bb_dev_null, O_RDONLY) != 0) - ash_msg_and_raise_error("Can't open %s", bb_dev_null); + ash_msg_and_raise_error("can't open %s", bb_dev_null); } } if (!oldlvl && iflag) { @@ -4533,7 +4534,7 @@ TRACE(("Fork failed, errno=%d", errno)); if (jp) freejob(jp); - ash_msg_and_raise_error("Cannot fork"); + ash_msg_and_raise_error("cannot fork"); } if (pid == 0) forkchild(jp, n, mode); @@ -4699,7 +4700,7 @@ size_t len = 0; if (pipe(pip) < 0) - ash_msg_and_raise_error("Pipe call failed"); + ash_msg_and_raise_error("pipe call failed"); if (redir->type == NHERE) { len = strlen(redir->nhere.doc->narg.text); if (len <= PIPESIZE) { @@ -4785,9 +4786,9 @@ return f; ecreate: - ash_msg_and_raise_error("cannot create %s: %s", fname, errmsg(errno, "Directory nonexistent")); + ash_msg_and_raise_error("cannot create %s: %s", fname, errmsg(errno, "nonexistent directory")); eopen: - ash_msg_and_raise_error("cannot open %s: %s", fname, errmsg(errno, "No such file")); + ash_msg_and_raise_error("cannot open %s: %s", fname, errmsg(errno, "no such file")); } /* @@ -5312,7 +5313,7 @@ struct job *jp; if (pipe(pip) < 0) - ash_msg_and_raise_error("Pipe call failed"); + ash_msg_and_raise_error("pipe call failed"); jp = makejob(n, 1); if (forkshell(jp, n, FORK_NOJOB) == 0) { FORCE_INT_ON; @@ -7790,7 +7791,7 @@ if (lp->next) { if (pipe(pip) < 0) { close(prevfd); - ash_msg_and_raise_error("Pipe call failed"); + ash_msg_and_raise_error("pipe call failed"); } } if (forkshell(jp, lp->n, n->npipe.backgnd) == 0) { @@ -8953,13 +8954,13 @@ if (fd < 0) { if (flags & INPUT_NOFILE_OK) goto out; - ash_msg_and_raise_error("Can't open %s", fname); + ash_msg_and_raise_error("can't open %s", fname); } if (fd < 10) { fd2 = copyfd(fd, 10); close(fd); if (fd2 < 0) - ash_msg_and_raise_error("Out of file descriptors"); + ash_msg_and_raise_error("out of file descriptors"); fd = fd2; } setinputfd(fd, flags & INPUT_PUSH_FILE); @@ -9097,7 +9098,7 @@ return; } } - ash_msg_and_raise_error("Illegal option -o %s", name); + ash_msg_and_raise_error("illegal option -o %s", name); } out1str("Current option settings\n"); for (i = 0; i < NOPTS; i++) @@ -9115,7 +9116,7 @@ return; } } - ash_msg_and_raise_error("Illegal option -%c", flag); + ash_msg_and_raise_error("illegal option -%c", flag); /* NOTREACHED */ } static void @@ -9368,7 +9369,7 @@ char **optbase; if (argc < 3) - ash_msg_and_raise_error("Usage: getopts optstring var [arg]"); + ash_msg_and_raise_error("usage: getopts optstring var [arg]"); if (argc == 3) { optbase = shellparam.p; if (shellparam.optind > shellparam.nparam + 1) { @@ -9405,7 +9406,7 @@ static void raise_error_syntax(const char *msg) { - ash_msg_and_raise_error("Syntax error: %s", msg); + ash_msg_and_raise_error("syntax error: %s", msg); /* NOTREACHED */ } @@ -11803,7 +11804,7 @@ } else { mask = ~mask & 0777; if (!bb_parse_mode(ap, &mask)) { - ash_msg_and_raise_error("Illegal mode: %s", ap); + ash_msg_and_raise_error("illegal mode: %s", ap); } umask(~mask & 0777); } From vda at busybox.net Sun Mar 4 16:27:50 2007 From: vda at busybox.net (vda at busybox.net) Date: Sun, 4 Mar 2007 16:27:50 -0800 (PST) Subject: svn commit: trunk/busybox/shell: ash_test ash_test/ash-alias ash_test/as etc... Message-ID: <20070305002750.D992648566@busybox.net> Author: vda Date: 2007-03-04 16:27:50 -0800 (Sun, 04 Mar 2007) New Revision: 18005 Log: small ash testsuite, adapted from bash (only a small part of it, actually) Added: trunk/busybox/shell/ash_test/ trunk/busybox/shell/ash_test/ash-alias/ trunk/busybox/shell/ash_test/ash-alias/alias.right trunk/busybox/shell/ash_test/ash-alias/alias.tests trunk/busybox/shell/ash_test/ash-arith/ trunk/busybox/shell/ash_test/ash-arith/README.ash trunk/busybox/shell/ash_test/ash-arith/arith-for.right trunk/busybox/shell/ash_test/ash-arith/arith-for.testsx trunk/busybox/shell/ash_test/ash-arith/arith.right trunk/busybox/shell/ash_test/ash-arith/arith.tests trunk/busybox/shell/ash_test/ash-arith/arith1.sub trunk/busybox/shell/ash_test/ash-arith/arith2.sub trunk/busybox/shell/ash_test/printenv.c trunk/busybox/shell/ash_test/recho.c trunk/busybox/shell/ash_test/run-all trunk/busybox/shell/ash_test/zecho.c Changeset: Sorry, the patch is too large to include (1091 lines). Please use ViewCVS to see it! http://busybox.net/cgi-bin/viewcvs.cgi?view=rev&root=svn&rev=18005 From bugs at busybox.net Mon Mar 5 02:12:33 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Mon, 5 Mar 2007 02:12:33 -0800 Subject: [BusyBox 0001184]: httpd cgi implementation broken by cset 17196 Message-ID: A NOTE has been added to this issue. ====================================================================== http://busybox.net/bugs/view.php?id=1184 ====================================================================== Reported By: aschultz Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1184 Category: Networking Support Reproducibility: always Severity: major Priority: normal Status: assigned ====================================================================== Date Submitted: 01-29-2007 06:54 PST Last Modified: 03-05-2007 02:12 PST ====================================================================== Summary: httpd cgi implementation broken by cset 17196 Description: cset 17196 contains this beauty (slightly edited to highlight my point): - if (strncmp(rbuf, "HTTP/1.0 200 OK\r\n", 4) != 0) { - /* there is no "HTTP", do it ourself */ - full_write(s, "HTTP/1.0 200 OK\r\n", 17); - } /* hmm, maybe 'else if'? */ - if (!strstr(rbuf, "ontent-")) { - full_write(s, "Content-type: text/plain\r\n\r\n", 28); - } - firstLine = 0; +#define HTTP_200 "HTTP/1.0 200 OK\r\n\r\n" + if (memcmp(rbuf, HTTP_200, 4) != 0) { + /* there is no "HTTP", do it ourself */ + full_write(s, HTTP_200, sizeof(HTTP_200)-1); + } +#undef HTTP_200 This breaks cgi scripts that omit to send a HTTP/1.0 header but continue to send other headers. The fix is simple, change the #define HTTP_200 to: #define HTTP_200 "HTTP/1.0 200 OK\r\n" ====================================================================== ---------------------------------------------------------------------- landau - 03-05-07 02:12 ---------------------------------------------------------------------- I second it. The trunk code has changed since then, but the bug persists. Changing in the trunk static const char HTTP_200[] = "HTTP/1.0 200 OK\r\n\r\n"; to static const char HTTP_200[] = "HTTP/1.0 200 OK\r\n"; seems to fix the bug. Issue History Date Modified Username Field Change ====================================================================== 01-29-07 06:54 aschultz New Issue 01-29-07 06:54 aschultz Status new => assigned 01-29-07 06:54 aschultz Assigned To => BusyBox 03-05-07 02:12 landau Note Added: 0002203 ====================================================================== From bugs at busybox.net Mon Mar 5 02:56:52 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Mon, 5 Mar 2007 02:56:52 -0800 Subject: [BusyBox 0001259]: httpd can run interpreter only for files in /cgi-bin/ Message-ID: <2007d82c75b57c0ee52800e9885a6907@bugs.busybox.net> The following issue has been SUBMITTED. ====================================================================== http://busybox.net/bugs/view.php?id=1259 ====================================================================== Reported By: landau Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1259 Category: Networking Support Reproducibility: always Severity: major Priority: normal Status: assigned ====================================================================== Date Submitted: 03-05-2007 02:56 PST Last Modified: 03-05-2007 02:56 PST ====================================================================== Summary: httpd can run interpreter only for files in /cgi-bin/ Description: If compiled with ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR (if not, the whole issue is not applicable), busybox's httpd executes the specifies interpreter only if the requested file is in /cgi-bin/. This behavior is incorrect for many interpreted files, such as PHP. If I write "*.php:/bin/php" in /etc/httpd.conf, I expect httpd to run /bin/php on any .php file anywhere in the document-root. The /cgi-bin/ check is correct for regular CGI scripts. The attached patch against 1.4.1 fixes the issue by checking whether there is a configured interpreter for the requested file, and if yes, runs it ignoring the /cgi-bin/ check. ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 03-05-07 02:56 landau New Issue 03-05-07 02:56 landau Status new => assigned 03-05-07 02:56 landau Assigned To => BusyBox 03-05-07 02:56 landau File Added: httpd.patch ====================================================================== From vda at busybox.net Mon Mar 5 08:56:26 2007 From: vda at busybox.net (vda at busybox.net) Date: Mon, 5 Mar 2007 08:56:26 -0800 (PST) Subject: svn commit: trunk/busybox/networking Message-ID: <20070305165626.0B367485D8@busybox.net> Author: vda Date: 2007-03-05 08:56:25 -0800 (Mon, 05 Mar 2007) New Revision: 18008 Log: httpd: fix breakage (introduced by me) Modified: trunk/busybox/networking/httpd.c Changeset: Modified: trunk/busybox/networking/httpd.c =================================================================== --- trunk/busybox/networking/httpd.c 2007-03-05 11:06:58 UTC (rev 18007) +++ trunk/busybox/networking/httpd.c 2007-03-05 16:56:25 UTC (rev 18008) @@ -1215,7 +1215,7 @@ /* Are we still buffering CGI output? */ if (buf_count >= 0) { - static const char HTTP_200[] = "HTTP/1.0 200 OK\r\n\r\n"; + static const char HTTP_200[] = "HTTP/1.0 200 OK\r\n"; /* Must use safe_read, not full_read, because * CGI may output a few first bytes and then wait * for POSTDATA without closing stdout. From bugs at busybox.net Mon Mar 5 08:56:45 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Mon, 5 Mar 2007 08:56:45 -0800 Subject: [BusyBox 0001184]: httpd cgi implementation broken by cset 17196 Message-ID: <7f17065bc3272a4be6d70b84f4df217e@busybox.net> The following issue has been CLOSED ====================================================================== http://busybox.net/bugs/view.php?id=1184 ====================================================================== Reported By: aschultz Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1184 Category: Networking Support Reproducibility: always Severity: major Priority: normal Status: closed Resolution: open Fixed in Version: ====================================================================== Date Submitted: 01-29-2007 06:54 PST Last Modified: 03-05-2007 08:56 PST ====================================================================== Summary: httpd cgi implementation broken by cset 17196 Description: cset 17196 contains this beauty (slightly edited to highlight my point): - if (strncmp(rbuf, "HTTP/1.0 200 OK\r\n", 4) != 0) { - /* there is no "HTTP", do it ourself */ - full_write(s, "HTTP/1.0 200 OK\r\n", 17); - } /* hmm, maybe 'else if'? */ - if (!strstr(rbuf, "ontent-")) { - full_write(s, "Content-type: text/plain\r\n\r\n", 28); - } - firstLine = 0; +#define HTTP_200 "HTTP/1.0 200 OK\r\n\r\n" + if (memcmp(rbuf, HTTP_200, 4) != 0) { + /* there is no "HTTP", do it ourself */ + full_write(s, HTTP_200, sizeof(HTTP_200)-1); + } +#undef HTTP_200 This breaks cgi scripts that omit to send a HTTP/1.0 header but continue to send other headers. The fix is simple, change the #define HTTP_200 to: #define HTTP_200 "HTTP/1.0 200 OK\r\n" ====================================================================== ---------------------------------------------------------------------- landau - 03-05-07 02:12 ---------------------------------------------------------------------- I second it. The trunk code has changed since then, but the bug persists. Changing in the trunk static const char HTTP_200[] = "HTTP/1.0 200 OK\r\n\r\n"; to static const char HTTP_200[] = "HTTP/1.0 200 OK\r\n"; seems to fix the bug. ---------------------------------------------------------------------- vda - 03-05-07 08:56 ---------------------------------------------------------------------- Fixed in svn. Thanks! Issue History Date Modified Username Field Change ====================================================================== 01-29-07 06:54 aschultz New Issue 01-29-07 06:54 aschultz Status new => assigned 01-29-07 06:54 aschultz Assigned To => BusyBox 03-05-07 02:12 landau Note Added: 0002203 03-05-07 02:57 landau Issue Monitored: landau 03-05-07 08:56 vda Status assigned => closed 03-05-07 08:56 vda Note Added: 0002210 ====================================================================== From vda at busybox.net Mon Mar 5 11:22:05 2007 From: vda at busybox.net (vda at busybox.net) Date: Mon, 5 Mar 2007 11:22:05 -0800 (PST) Subject: svn commit: trunk/busybox/init Message-ID: <20070305192205.BBDA0485FC@busybox.net> Author: vda Date: 2007-03-05 11:22:04 -0800 (Mon, 05 Mar 2007) New Revision: 18009 Log: init: fix handling of stdio file descriptors Modified: trunk/busybox/init/init.c Changeset: Modified: trunk/busybox/init/init.c =================================================================== --- trunk/busybox/init/init.c 2007-03-05 16:56:25 UTC (rev 18008) +++ trunk/busybox/init/init.c 2007-03-05 19:22:04 UTC (rev 18009) @@ -201,7 +201,7 @@ } /* Set terminal settings to reasonable defaults */ -static void set_term(void) +static void set_sane_term(void) { struct termios tty; @@ -313,9 +313,8 @@ { /* empty tty_name means "use init's tty", else... */ if (tty_name[0]) { - close(0); - if ((device_open(tty_name, O_RDWR)) < 0) { - dup2(1, 0); /* restore fd #0 - avoid nasty surprises */ + int fd = device_open(tty_name, O_RDWR); + if (fd < 0) { message(L_LOG | L_CONSOLE, "Can't open %s: %s", tty_name, strerror(errno)); if (fail) @@ -325,13 +324,14 @@ #else _exit(2); #endif + } else { + dup2(fd, 0); + dup2(fd, 1); + dup2(fd, 2); + if (fd > 2) close(fd); } } - close(1); - close(2); - set_term(); - dup(0); - dup(0); + set_sane_term(); } static pid_t run(const struct init_action *a) @@ -926,7 +926,7 @@ /* Figure out where the default console should be */ console_init(); - set_term(); + set_sane_term(); chdir("/"); setsid(); { From vda at busybox.net Mon Mar 5 11:24:34 2007 From: vda at busybox.net (vda at busybox.net) Date: Mon, 5 Mar 2007 11:24:34 -0800 (PST) Subject: svn commit: trunk/busybox/networking Message-ID: <20070305192434.DA191485FF@busybox.net> Author: vda Date: 2007-03-05 11:24:33 -0800 (Mon, 05 Mar 2007) New Revision: 18010 Log: httpd: run interpreter for configured file extensions in any dir, not only in /cgi-bin/ Modified: trunk/busybox/networking/httpd.c Changeset: Modified: trunk/busybox/networking/httpd.c =================================================================== --- trunk/busybox/networking/httpd.c 2007-03-05 19:22:04 UTC (rev 18009) +++ trunk/busybox/networking/httpd.c 2007-03-05 19:24:33 UTC (rev 18010) @@ -1701,6 +1701,20 @@ sendCgi(url, prequest, length, cookie, content_type); break; } +#if ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR + { + char *suffix = strrchr(test, '.'); + if (suffix) { + Htaccess *cur; + for (cur = config->script_i; cur; cur = cur->next) { + if (strcmp(cur->before_colon + 1, suffix) == 0) { + sendCgi(url, prequest, length, cookie, content_type); + goto bail_out; + } + } + } + } +#endif if (prequest != request_GET) { sendHeaders(HTTP_NOT_IMPLEMENTED); break; From bugs at busybox.net Mon Mar 5 11:25:13 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Mon, 5 Mar 2007 11:25:13 -0800 Subject: [BusyBox 0001259]: httpd can run interpreter only for files in /cgi-bin/ Message-ID: <5de6a6c24489f9ca0418e71ac1457357@busybox.net> The following issue has been CLOSED ====================================================================== http://busybox.net/bugs/view.php?id=1259 ====================================================================== Reported By: landau Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1259 Category: Networking Support Reproducibility: always Severity: major Priority: normal Status: closed Resolution: open Fixed in Version: ====================================================================== Date Submitted: 03-05-2007 02:56 PST Last Modified: 03-05-2007 11:25 PST ====================================================================== Summary: httpd can run interpreter only for files in /cgi-bin/ Description: If compiled with ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR (if not, the whole issue is not applicable), busybox's httpd executes the specifies interpreter only if the requested file is in /cgi-bin/. This behavior is incorrect for many interpreted files, such as PHP. If I write "*.php:/bin/php" in /etc/httpd.conf, I expect httpd to run /bin/php on any .php file anywhere in the document-root. The /cgi-bin/ check is correct for regular CGI scripts. The attached patch against 1.4.1 fixes the issue by checking whether there is a configured interpreter for the requested file, and if yes, runs it ignoring the /cgi-bin/ check. ====================================================================== ---------------------------------------------------------------------- vda - 03-05-07 11:25 ---------------------------------------------------------------------- Fixed in revision 18010, thanks Issue History Date Modified Username Field Change ====================================================================== 03-05-07 02:56 landau New Issue 03-05-07 02:56 landau Status new => assigned 03-05-07 02:56 landau Assigned To => BusyBox 03-05-07 02:56 landau File Added: httpd.patch 03-05-07 02:58 landau Issue Monitored: landau 03-05-07 11:25 vda Status assigned => closed 03-05-07 11:25 vda Note Added: 0002211 ====================================================================== From vda at busybox.net Mon Mar 5 11:55:30 2007 From: vda at busybox.net (vda at busybox.net) Date: Mon, 5 Mar 2007 11:55:30 -0800 (PST) Subject: svn commit: trunk/busybox/init Message-ID: <20070305195530.6EC92485D1@busybox.net> Author: vda Date: 2007-03-05 11:55:30 -0800 (Mon, 05 Mar 2007) New Revision: 18011 Log: decouple INIT and SYSLOGD (patch by Eric Spakman E.Spakman at inter.nl.net) Modified: trunk/busybox/init/Config.in trunk/busybox/init/init.c Changeset: Modified: trunk/busybox/init/Config.in =================================================================== --- trunk/busybox/init/Config.in 2007-03-05 19:24:33 UTC (rev 18010) +++ trunk/busybox/init/Config.in 2007-03-05 19:55:30 UTC (rev 18011) @@ -38,6 +38,11 @@ behavour, but is often what you want in an embedded system where the console is only accessed during development or for maintenance. +config FEATURE_INIT_SYSLOG + bool "Enable init to write to syslog" + default n + depends on INIT + config FEATURE_EXTRA_QUIET bool "Be _extra_ quiet on boot" default y Modified: trunk/busybox/init/init.c =================================================================== --- trunk/busybox/init/init.c 2007-03-05 19:24:33 UTC (rev 18010) +++ trunk/busybox/init/init.c 2007-03-05 19:55:30 UTC (rev 18011) @@ -16,7 +16,7 @@ #include #include -#if ENABLE_SYSLOGD +#if ENABLE_FEATURE_INIT_SYSLOG # include #endif @@ -84,7 +84,7 @@ /* Static variables */ static struct init_action *init_action_list = NULL; -#if !ENABLE_SYSLOGD +#if !ENABLE_FEATURE_INIT_SYSLOG static const char *log_console = VC_5; #endif #if !ENABLE_DEBUG_INIT @@ -144,7 +144,7 @@ __attribute__ ((format(printf, 2, 3))); static void message(int device, const char *fmt, ...) { -#if !ENABLE_SYSLOGD +#if !ENABLE_FEATURE_INIT_SYSLOG static int log_fd = -1; #endif @@ -159,7 +159,7 @@ msg[sizeof(msg) - 2] = '\0'; l = strlen(msg); -#if ENABLE_SYSLOGD +#if ENABLE_FEATURE_INIT_SYSLOG /* Log the message to syslogd */ if (device & L_LOG) { /* don't out "\r" */ @@ -285,7 +285,7 @@ * if TERM is set to linux (the default) */ if (!s || strcmp(s, "linux") == 0) putenv((char*)"TERM=vt102"); -#if !ENABLE_SYSLOGD +#if !ENABLE_FEATURE_INIT_SYSLOG log_console = NULL; #endif } else if (!s) From vda at busybox.net Mon Mar 5 12:46:47 2007 From: vda at busybox.net (vda at busybox.net) Date: Mon, 5 Mar 2007 12:46:47 -0800 (PST) Subject: svn commit: trunk/busybox/shell/ash_test: ash-invert Message-ID: <20070305204647.8FE4B48603@busybox.net> Author: vda Date: 2007-03-05 12:46:46 -0800 (Mon, 05 Mar 2007) New Revision: 18012 Log: add ash testcases Added: trunk/busybox/shell/ash_test/ash-invert/ trunk/busybox/shell/ash_test/ash-invert/invert.right trunk/busybox/shell/ash_test/ash-invert/invert.tests Changeset: Added: trunk/busybox/shell/ash_test/ash-invert/invert.right =================================================================== --- trunk/busybox/shell/ash_test/ash-invert/invert.right (rev 0) +++ trunk/busybox/shell/ash_test/ash-invert/invert.right 2007-03-05 20:46:46 UTC (rev 18012) @@ -0,0 +1,10 @@ +1 +1 +1 +0 +0 +1 +0 +1 +0 +1 Added: trunk/busybox/shell/ash_test/ash-invert/invert.tests =================================================================== --- trunk/busybox/shell/ash_test/ash-invert/invert.tests (rev 0) +++ trunk/busybox/shell/ash_test/ash-invert/invert.tests 2007-03-05 20:46:46 UTC (rev 18012) @@ -0,0 +1,19 @@ +# tests of return value inversion +# placeholder for future expansion + +# user subshells (...) did this wrong in bash versions before 2.04 + +! ( echo hello | grep h >/dev/null 2>&1 ); echo $? +! echo hello | grep h >/dev/null 2>&1 ; echo $? + +! true ; echo $? +! false; echo $? + +! (false) ; echo $? +! (true); echo $? + +! true | false ; echo $? +! false | true ; echo $? + +! (true | false) ; echo $? +! (false | true) ; echo $? Property changes on: trunk/busybox/shell/ash_test/ash-invert/invert.tests ___________________________________________________________________ Name: svn:executable + * From vda at busybox.net Mon Mar 5 13:08:30 2007 From: vda at busybox.net (vda at busybox.net) Date: Mon, 5 Mar 2007 13:08:30 -0800 (PST) Subject: svn commit: trunk/busybox/shell/ash_test: ash-heredoc Message-ID: <20070305210830.6793848606@busybox.net> Author: vda Date: 2007-03-05 13:08:29 -0800 (Mon, 05 Mar 2007) New Revision: 18014 Log: ash: "here document" testcases Added: trunk/busybox/shell/ash_test/ash-heredoc/ trunk/busybox/shell/ash_test/ash-heredoc/heredoc.right trunk/busybox/shell/ash_test/ash-heredoc/heredoc.tests Changeset: Added: trunk/busybox/shell/ash_test/ash-heredoc/heredoc.right =================================================================== --- trunk/busybox/shell/ash_test/ash-heredoc/heredoc.right (rev 0) +++ trunk/busybox/shell/ash_test/ash-heredoc/heredoc.right 2007-03-05 21:08:29 UTC (rev 18014) @@ -0,0 +1,21 @@ +there +one - alpha +two - beta +three - gamma +hi\ +there$a +stuff +hi\ +there +EO\ +F +hi +tab 1 +tab 2 +tab 3 +abc +def ghi +jkl mno +fff is a shell function +hi +there Added: trunk/busybox/shell/ash_test/ash-heredoc/heredoc.tests =================================================================== --- trunk/busybox/shell/ash_test/ash-heredoc/heredoc.tests (rev 0) +++ trunk/busybox/shell/ash_test/ash-heredoc/heredoc.tests 2007-03-05 21:08:29 UTC (rev 18014) @@ -0,0 +1,94 @@ +# check order and content of multiple here docs + +cat << EOF1 << EOF2 +hi +EOF1 +there +EOF2 + +while read line1; do + read line2 <&3 + echo $line1 - $line2 +done < /tmp/bash-zzz << EOF +abc +EOF +cat >> /tmp/bash-zzz << EOF +def ghi +jkl mno +EOF +cat /tmp/bash-zzz +rm -f /tmp/bash-zzz + +# make sure command printing puts the here-document as the last redirection +# on the line, and the function export code preserves syntactic correctness +fff() +{ + ed /tmp/foo </dev/null +/^name/d +w +q +ENDOFINPUT +aa=1 +} + +type fff +#ash# export -f fff +#ash# ${THIS_SH} -c 'type fff' + +# check that end of file delimits a here-document +# THIS MUST BE LAST! + +cat << EOF +hi +there Property changes on: trunk/busybox/shell/ash_test/ash-heredoc/heredoc.tests ___________________________________________________________________ Name: svn:executable + * From bugs at busybox.net Tue Mar 6 06:35:44 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Tue, 6 Mar 2007 06:35:44 -0800 Subject: [BusyBox 0001260]: Fix httpd to run on MMU-less platforms Message-ID: <651516371f8e6b684eefe8c18fb67430@bugs.busybox.net> The following issue has been SUBMITTED. ====================================================================== http://busybox.net/bugs/view.php?id=1260 ====================================================================== Reported By: landau Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1260 Category: Networking Support Reproducibility: always Severity: major Priority: normal Status: assigned ====================================================================== Date Submitted: 03-06-2007 06:35 PST Last Modified: 03-06-2007 06:35 PST ====================================================================== Summary: Fix httpd to run on MMU-less platforms Description: The attached patch allows httpd to run on MMU-less platforms, such as Blackfin. All it does is calling vfork() instead of fork() (if BB_NOMMU is defined) and explaining in a comment why this is correct despite the child process' modifications to the address space. The issue is present since at least version 1.2. The patch is generated against svn rev 18015. ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 03-06-07 06:35 landau New Issue 03-06-07 06:35 landau Status new => assigned 03-06-07 06:35 landau Assigned To => BusyBox 03-06-07 06:35 landau File Added: httpd-nommu.patch ====================================================================== From vda at busybox.net Tue Mar 6 14:53:11 2007 From: vda at busybox.net (vda at busybox.net) Date: Tue, 6 Mar 2007 14:53:11 -0800 (PST) Subject: svn commit: trunk/busybox: include libbb networking Message-ID: <20070306225311.C8EE048091@busybox.net> Author: vda Date: 2007-03-06 14:53:10 -0800 (Tue, 06 Mar 2007) New Revision: 18018 Log: ifupdown: code to deconstruct the state_list gracefully (patch by Gabriel L. Somlo ) Modified: trunk/busybox/include/libbb.h trunk/busybox/libbb/llist.c trunk/busybox/networking/ifupdown.c Changeset: Modified: trunk/busybox/include/libbb.h =================================================================== --- trunk/busybox/include/libbb.h 2007-03-06 19:13:31 UTC (rev 18017) +++ trunk/busybox/include/libbb.h 2007-03-06 22:53:10 UTC (rev 18018) @@ -475,6 +475,7 @@ extern void llist_add_to(llist_t **old_head, void *data); extern void llist_add_to_end(llist_t **list_head, void *data); extern void *llist_pop(llist_t **elm); +extern void llist_unlink(llist_t **head, llist_t *elm); extern void llist_free(llist_t *elm, void (*freeit)(void *data)); extern llist_t* llist_rev(llist_t *list); Modified: trunk/busybox/libbb/llist.c =================================================================== --- trunk/busybox/libbb/llist.c 2007-03-06 19:13:31 UTC (rev 18017) +++ trunk/busybox/libbb/llist.c 2007-03-06 22:53:10 UTC (rev 18018) @@ -45,21 +45,40 @@ /* Remove first element from the list and return it */ void *llist_pop(llist_t ** head) { - void *data; + void *data, *next; if (!*head) - data = *head; - else { - void *next = (*head)->link; + return NULL; - data = (*head)->data; - free(*head); - *head = next; - } + data = (*head)->data; + next = (*head)->link; + free(*head); + *head = next; return data; } +/* Unlink arbitrary given element from the list */ +void llist_unlink(llist_t **head, llist_t *elm) +{ + llist_t *crt; + + if (!(elm && *head)) + return; + + if (elm == *head) { + *head = (*head)->link; + return; + } + + for (crt = *head; crt; crt = crt->link) { + if (crt->link == elm) { + crt->link = elm->link; + return; + } + } +} + /* Recursively free all elements in the linked list. If freeit != NULL * call it on each datum in the list */ void llist_free(llist_t * elm, void (*freeit) (void *data)) Modified: trunk/busybox/networking/ifupdown.c =================================================================== --- trunk/busybox/networking/ifupdown.c 2007-03-06 19:13:31 UTC (rev 18017) +++ trunk/busybox/networking/ifupdown.c 2007-03-06 22:53:10 UTC (rev 18018) @@ -1091,6 +1091,7 @@ llist_t *state_list = NULL; llist_t *target_list = NULL; const char *interfaces = "/etc/network/interfaces"; + FILE *state_fp; int any_failures = 0; cmds = iface_down; @@ -1117,6 +1118,19 @@ startup_PATH = getenv("PATH"); if (!startup_PATH) startup_PATH = ""; + /* Read the previous state from the state file */ + state_fp = fopen_or_warn("/var/run/ifstate", "r"); + if (state_fp) { + char *start, *end_ptr; + while ((start = xmalloc_fgets(state_fp)) != NULL) { + /* We should only need to check for a single character */ + end_ptr = start + strcspn(start, " \t\n"); + *end_ptr = '\0'; + llist_add_to(&state_list, start); + } + fclose(state_fp); + } + /* Create a list of interfaces to work on */ if (DO_ALL) { if (cmds == iface_up) { @@ -1166,7 +1180,7 @@ } } else { /* ifdown */ - if (iface_state) { + if (!iface_state) { bb_error_msg("interface %s not configured", iface); continue; } @@ -1236,7 +1250,8 @@ iface_state->data = newiface; } } else { - /* Remove an interface from the linked list */ + /* Remove an interface from state_list */ + llist_unlink(&state_list, iface_state); free(llist_pop(&iface_state)); } } @@ -1244,8 +1259,6 @@ /* Actually write the new state */ if (!NO_ACT) { - FILE *state_fp; - state_fp = xfopen("/var/run/ifstate", "w"); while (state_list) { if (state_list->data) { From bugs at busybox.net Tue Mar 6 15:23:39 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Tue, 6 Mar 2007 15:23:39 -0800 Subject: [BusyBox 0001260]: Fix httpd to run on MMU-less platforms Message-ID: <90f4dfc0e97e3e4dfb5d9615292d367a@busybox.net> A NOTE has been added to this issue. ====================================================================== http://busybox.net/bugs/view.php?id=1260 ====================================================================== Reported By: landau Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1260 Category: Networking Support Reproducibility: always Severity: major Priority: normal Status: assigned ====================================================================== Date Submitted: 03-06-2007 06:35 PST Last Modified: 03-06-2007 15:23 PST ====================================================================== Summary: Fix httpd to run on MMU-less platforms Description: The attached patch allows httpd to run on MMU-less platforms, such as Blackfin. All it does is calling vfork() instead of fork() (if BB_NOMMU is defined) and explaining in a comment why this is correct despite the child process' modifications to the address space. The issue is present since at least version 1.2. The patch is generated against svn rev 18015. ====================================================================== ---------------------------------------------------------------------- vda - 03-06-07 15:23 ---------------------------------------------------------------------- Hi. No obvious problems with the patch. However, I am concerned that I don't know nommu people needs and nommu environments in general. Do you nave any nommu emulator or, say, qemu runnable image for nommu processor so that I can run-test the change and generally play with nommu? Issue History Date Modified Username Field Change ====================================================================== 03-06-07 06:35 landau New Issue 03-06-07 06:35 landau Status new => assigned 03-06-07 06:35 landau Assigned To => BusyBox 03-06-07 06:35 landau File Added: httpd-nommu.patch 03-06-07 15:23 vda Note Added: 0002212 ====================================================================== From vda at busybox.net Tue Mar 6 16:07:44 2007 From: vda at busybox.net (vda at busybox.net) Date: Tue, 6 Mar 2007 16:07:44 -0800 (PST) Subject: svn commit: trunk/busybox/coreutils Message-ID: <20070307000744.4AAC84809F@busybox.net> Author: vda Date: 2007-03-06 16:07:42 -0800 (Tue, 06 Mar 2007) New Revision: 18019 Log: who: stop using static buffer, small size optimizations Modified: trunk/busybox/coreutils/who.c Changeset: Modified: trunk/busybox/coreutils/who.c =================================================================== --- trunk/busybox/coreutils/who.c 2007-03-06 22:53:10 UTC (rev 18018) +++ trunk/busybox/coreutils/who.c 2007-03-07 00:07:42 UTC (rev 18019) @@ -21,26 +21,28 @@ #include #include -static const char * idle_string (time_t t) +static void idle_string(char *str6, time_t t) { - static char str[6]; + t = time(NULL) - t; - time_t s = time(NULL) - t; - - if (s < 60) - return "."; - if (s < (24 * 60 * 60)) { - sprintf(str, "%02d:%02d", - (int) (s / (60 * 60)), - (int) ((s % (60 * 60)) / 60)); - return str; + /*if (t < 60) { + str6[0] = '.'; + str6[1] = '\0'; + return; + }*/ + if (t >= 0 && t < (24 * 60 * 60)) { + sprintf(str6, "%02d:%02d", + (int) (t / (60 * 60)), + (int) ((t % (60 * 60)) / 60)); + return; } - return "old"; + strcpy(str6, "old"); } int who_main(int argc, char **argv); int who_main(int argc, char **argv) { + char str6[6]; struct utmp *ut; struct stat st; char *name; @@ -57,12 +59,18 @@ /* ut->ut_line is device name of tty - "/dev/" */ name = concat_path_file("/dev", ut->ut_line); - printf("%-10s %-8s %-8s %-12.12s %s\n", ut->ut_user, ut->ut_line, - (stat(name, &st)) ? "?" : idle_string(st.st_atime), - ctime(&thyme) + 4, ut->ut_host); - if (ENABLE_FEATURE_CLEAN_UP) free(name); + str6[0] = '?'; + str6[1] = '\0'; + if (stat(name, &st) == 0) + idle_string(str6, st.st_atime); + printf("%-10s %-8s %-9s %-14.14s %s\n", + ut->ut_user, ut->ut_line, str6, + ctime(&thyme) + 4, ut->ut_host); + if (ENABLE_FEATURE_CLEAN_UP) + free(name); } } - if (ENABLE_FEATURE_CLEAN_UP) endutent(); + if (ENABLE_FEATURE_CLEAN_UP) + endutent(); return 0; } From bugs at busybox.net Tue Mar 6 18:19:45 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Tue, 6 Mar 2007 18:19:45 -0800 Subject: [BusyBox 0001261]: [PATCH] hwclock must understand /dev/rtc0, /dev/rtc1, etc Message-ID: The following issue has been SUBMITTED. ====================================================================== http://busybox.net/bugs/view.php?id=1261 ====================================================================== Reported By: db Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1261 Category: Other Reproducibility: always Severity: feature Priority: normal Status: assigned ====================================================================== Date Submitted: 03-06-2007 18:19 PST Last Modified: 03-06-2007 18:19 PST ====================================================================== Summary: [PATCH] hwclock must understand /dev/rtc0, /dev/rtc1, etc Description: http://busybox.net/bugs/view.php?id=1179 Apologies if this is an actual duplicate rather than just looking like one, but so far as I can tell this bug report is still misfiled under either BuildRoot or uClibc ... and certainly it didn't show up when I searched the bug database, so by all indications this bug is "lost" from the perspective of BusyBox. I'm hoping that I can at least make it so that someone looking at BusyBox issues will see that a fix for this bug/"missing-feature" is ready. ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 03-06-07 18:19 db New Issue 03-06-07 18:19 db Status new => assigned 03-06-07 18:19 db Assigned To => BusyBox ====================================================================== From bugs at busybox.net Tue Mar 6 20:10:09 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Tue, 6 Mar 2007 20:10:09 -0800 Subject: [BusyBox 0001261]: [PATCH] hwclock must understand /dev/rtc0, /dev/rtc1, etc Message-ID: The following issue has been CLOSED ====================================================================== http://busybox.net/bugs/view.php?id=1261 ====================================================================== Reported By: db Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1261 Category: Other Reproducibility: always Severity: feature Priority: normal Status: closed Resolution: duplicate Duplicate: 0 Fixed in Version: ====================================================================== Date Submitted: 03-06-2007 18:19 PST Last Modified: 03-06-2007 20:10 PST ====================================================================== Summary: [PATCH] hwclock must understand /dev/rtc0, /dev/rtc1, etc Description: http://busybox.net/bugs/view.php?id=1179 Apologies if this is an actual duplicate rather than just looking like one, but so far as I can tell this bug report is still misfiled under either BuildRoot or uClibc ... and certainly it didn't show up when I searched the bug database, so by all indications this bug is "lost" from the perspective of BusyBox. I'm hoping that I can at least make it so that someone looking at BusyBox issues will see that a fix for this bug/"missing-feature" is ready. ====================================================================== ---------------------------------------------------------------------- vapier - 03-06-07 20:10 ---------------------------------------------------------------------- so you fix the original bug report, you dont file a new one ... use the "move" option when updating the bug report close -> dupe of 1179 Issue History Date Modified Username Field Change ====================================================================== 03-06-07 18:19 db New Issue 03-06-07 18:19 db Status new => assigned 03-06-07 18:19 db Assigned To => BusyBox 03-06-07 20:10 vapier Note Added: 0002213 03-06-07 20:10 vapier Status assigned => closed 03-06-07 20:10 vapier Resolution open => duplicate ====================================================================== From vda at busybox.net Wed Mar 7 01:35:48 2007 From: vda at busybox.net (vda at busybox.net) Date: Wed, 7 Mar 2007 01:35:48 -0800 (PST) Subject: svn commit: trunk/busybox: coreutils editors include libbb loginuti etc... Message-ID: <20070307093548.E2A8A48088@busybox.net> Author: vda Date: 2007-03-07 01:35:43 -0800 (Wed, 07 Mar 2007) New Revision: 18020 Log: clean up accumulated whitespace damage Modified: trunk/busybox/coreutils/od_bloaty.c trunk/busybox/editors/sed.c trunk/busybox/editors/vi.c trunk/busybox/include/libbb.h trunk/busybox/include/usage.h trunk/busybox/libbb/create_icmp_socket.c trunk/busybox/libbb/getopt32.c trunk/busybox/libbb/read.c trunk/busybox/libbb/xfuncs.c trunk/busybox/loginutils/adduser.c trunk/busybox/miscutils/less.c trunk/busybox/networking/httpd.c trunk/busybox/networking/ifupdown.c trunk/busybox/networking/udhcp/domain_codec.c trunk/busybox/selinux/selinuxenabled.c trunk/busybox/shell/ash.c trunk/busybox/shell/ash_test/printenv.c trunk/busybox/shell/msh.c trunk/busybox/util-linux/fdisk_sgi.c Changeset: Modified: trunk/busybox/coreutils/od_bloaty.c =================================================================== --- trunk/busybox/coreutils/od_bloaty.c 2007-03-07 00:07:42 UTC (rev 18019) +++ trunk/busybox/coreutils/od_bloaty.c 2007-03-07 09:35:43 UTC (rev 18020) @@ -542,7 +542,7 @@ fmt = SIGNED_DECIMAL; size = INT or LONG; (whichever integral_type_size[4] resolves to) print_function = print_int; (assuming size == INT) - fmt_string = "%011d%c"; + fmt_string = "%011d%c"; } S_ORIG is solely for reporting errors. It should be the full format string argument. */ @@ -823,7 +823,7 @@ n_bytes_read = fread(buf, 1, n_bytes_to_read, in_stream); n_skip -= n_bytes_read; if (n_bytes_read != n_bytes_to_read) - break; /* EOF on this file or error */ + break; /* EOF on this file or error */ } } if (n_skip == 0) @@ -1334,7 +1334,7 @@ /* If the --traditional option is used, there may be from * 0 to 3 remaining command line arguments; handle each case * separately. - * od [file] [[+]offset[.][b] [[+]label[.][b]]] + * od [file] [[+]offset[.][b] [[+]label[.][b]]] * The offset and pseudo_start have the same syntax. * * FIXME: POSIX 1003.1-2001 with XSI requires support for the Modified: trunk/busybox/editors/sed.c =================================================================== --- trunk/busybox/editors/sed.c 2007-03-07 00:07:42 UTC (rev 18019) +++ trunk/busybox/editors/sed.c 2007-03-07 09:35:43 UTC (rev 18020) @@ -896,7 +896,7 @@ /* or does this line matches our last address regex */ || (sed_cmd->end_match && old_matched && (regexec(sed_cmd->end_match, - pattern_space, 0, NULL, 0) == 0)) + pattern_space, 0, NULL, 0) == 0)) ); } Modified: trunk/busybox/editors/vi.c =================================================================== --- trunk/busybox/editors/vi.c 2007-03-07 00:07:42 UTC (rev 18019) +++ trunk/busybox/editors/vi.c 2007-03-07 09:35:43 UTC (rev 18020) @@ -84,7 +84,7 @@ S_TO_WS = 2, // used in skip_thing() for moving "dot" S_OVER_WS = 3, // used in skip_thing() for moving "dot" S_END_PUNCT = 4, // used in skip_thing() for moving "dot" - S_END_ALNUM = 5 // used in skip_thing() for moving "dot" + S_END_ALNUM = 5, // used in skip_thing() for moving "dot" }; typedef unsigned char Byte; Modified: trunk/busybox/include/libbb.h =================================================================== --- trunk/busybox/include/libbb.h 2007-03-07 00:07:42 UTC (rev 18019) +++ trunk/busybox/include/libbb.h 2007-03-07 09:35:43 UTC (rev 18020) @@ -575,7 +575,7 @@ cmd, __VA_ARGS__) #else #define BB_EXECVP(prog,cmd) execvp(prog,cmd) -#define BB_EXECLP(prog,cmd,...) execlp(prog,cmd, __VA_ARGS__) +#define BB_EXECLP(prog,cmd,...) execlp(prog,cmd, __VA_ARGS__) #endif USE_DESKTOP(long long) int uncompress(int fd_in, int fd_out); Modified: trunk/busybox/include/usage.h =================================================================== --- trunk/busybox/include/usage.h 2007-03-07 00:07:42 UTC (rev 18019) +++ trunk/busybox/include/usage.h 2007-03-07 09:35:43 UTC (rev 18020) @@ -60,7 +60,7 @@ "[-vn] [-H type] [-i if] -a [hostname]\n" \ "[-v] [-i if] -d hostname [pub]\n" \ "[-v] [-H type] [-i if] -s hostname hw_addr [temp]\n" \ - "[-v] [-H type] [-i if] -s hostname hw_addr [netmask nm] pub\n" \ + "[-v] [-H type] [-i if] -s hostname hw_addr [netmask nm] pub\n" \ "[-v] [-H type] [-i if] -Ds hostname ifa [netmask nm] pub\n" #define arp_full_usage \ "Manipulate the system ARP cache" \ @@ -269,7 +269,7 @@ "Change the process state and run specified program" \ "\n\nOptions:\n" \ " -u user[:grp] Set uid and gid\n" \ - " -U user[:grp] Set environment variables UID and GID\n" \ + " -U user[:grp] Set environment variables UID and GID\n" \ " -e dir Set environment variables as specified by files\n" \ " in the directory: file=1st_line_of_file\n" \ " -/ dir Chroot to dir\n" \ @@ -1776,7 +1776,7 @@ #define ls_trivial_usage \ "[-1Aa" USE_FEATURE_LS_TIMESTAMPS("c") "Cd" \ - USE_FEATURE_LS_TIMESTAMPS("e") USE_FEATURE_LS_FILETYPES("F") "iln" \ + USE_FEATURE_LS_TIMESTAMPS("e") USE_FEATURE_LS_FILETYPES("F") "iln" \ USE_FEATURE_LS_FILETYPES("p") USE_FEATURE_LS_FOLLOWLINKS("L") \ USE_FEATURE_LS_RECURSIVE("R") USE_FEATURE_LS_SORTFILES("rS") "s" \ USE_FEATURE_AUTOWIDTH("T") USE_FEATURE_LS_TIMESTAMPS("tu") \ Modified: trunk/busybox/libbb/create_icmp_socket.c =================================================================== --- trunk/busybox/libbb/create_icmp_socket.c 2007-03-07 00:07:42 UTC (rev 18019) +++ trunk/busybox/libbb/create_icmp_socket.c 2007-03-07 09:35:43 UTC (rev 18020) @@ -22,7 +22,7 @@ * proto->p_proto to have the correct value for "icmp" */ sock = socket(AF_INET, SOCK_RAW, (proto ? proto->p_proto : 1)); /* 1 == ICMP */ - if (sock < 0) { + if (sock < 0) { if (errno == EPERM) bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); bb_perror_msg_and_die(bb_msg_can_not_create_raw_socket); Modified: trunk/busybox/libbb/getopt32.c =================================================================== --- trunk/busybox/libbb/getopt32.c 2007-03-07 00:07:42 UTC (rev 18019) +++ trunk/busybox/libbb/getopt32.c 2007-03-07 09:35:43 UTC (rev 18020) @@ -79,9 +79,9 @@ (see getopt(3)) static const struct option applet_long_options[] = { - //name,has_arg,flag,val - { "verbose", 0, 0, 'v' }, - { 0, 0, 0, 0 } + //name,has_arg,flag,val + { "verbose", 0, 0, 'v' }, + { 0, 0, 0, 0 } }; applet_long_options = applet_long_options; Modified: trunk/busybox/libbb/read.c =================================================================== --- trunk/busybox/libbb/read.c 2007-03-07 00:07:42 UTC (rev 18019) +++ trunk/busybox/libbb/read.c 2007-03-07 09:35:43 UTC (rev 18020) @@ -129,7 +129,7 @@ buf = xmalloc(size + 1); size = read_close(fd, buf, size); if ((ssize_t)size < 0) - bb_perror_msg_and_die("'%s'", filename); + bb_perror_msg_and_die("'%s'", filename); xrealloc(buf, size + 1); buf[size] = '\0'; if (sizep) *sizep = size; Modified: trunk/busybox/libbb/xfuncs.c =================================================================== --- trunk/busybox/libbb/xfuncs.c 2007-03-07 00:07:42 UTC (rev 18019) +++ trunk/busybox/libbb/xfuncs.c 2007-03-07 09:35:43 UTC (rev 18020) @@ -522,7 +522,7 @@ bb_perror_msg_and_die("fork"); if (pid) /* parent */ exit(0); - /* child */ + /* child */ /* if daemonizing, make sure we detach from stdio */ setsid(); dup2(fd, 0); Modified: trunk/busybox/loginutils/adduser.c =================================================================== --- trunk/busybox/loginutils/adduser.c 2007-03-07 00:07:42 UTC (rev 18019) +++ trunk/busybox/loginutils/adduser.c 2007-03-07 09:35:43 UTC (rev 18020) @@ -101,7 +101,7 @@ bb_error_msg_and_die("illegal uid or no uids left"); case 3: bb_error_msg_and_die("%s: group name already in use", p->pw_name); - } + } /* add to passwd */ if (putpwent(p, file) == -1) { Modified: trunk/busybox/miscutils/less.c =================================================================== --- trunk/busybox/miscutils/less.c 2007-03-07 00:07:42 UTC (rev 18019) +++ trunk/busybox/miscutils/less.c 2007-03-07 09:35:43 UTC (rev 18020) @@ -883,13 +883,13 @@ break; case 'g': case '<': case 'G': case '>': cur_fline = num + max_displayed_line; - read_lines(); + read_lines(); buffer_line(num - 1); break; case 'p': case '%': num = num * (max_fline / 100); /* + max_fline / 2; */ cur_fline = num + max_displayed_line; - read_lines(); + read_lines(); buffer_line(num); break; #if ENABLE_FEATURE_LESS_REGEXP Modified: trunk/busybox/networking/httpd.c =================================================================== --- trunk/busybox/networking/httpd.c 2007-03-07 00:07:42 UTC (rev 18019) +++ trunk/busybox/networking/httpd.c 2007-03-07 09:35:43 UTC (rev 18020) @@ -873,8 +873,9 @@ #if ENABLE_FEATURE_HTTPD_BASIC_AUTH if (responseNum == HTTP_UNAUTHORIZED) { - len += sprintf(buf+len, "WWW-Authenticate: Basic realm=\"%s\"\r\n", - config->realm); + len += sprintf(buf+len, + "WWW-Authenticate: Basic realm=\"%s\"\r\n", + config->realm); } #endif if (responseNum == HTTP_MOVED_TEMPORARILY) { @@ -2000,7 +2001,7 @@ if (opt & OPT_SETUID) { if (ugid.gid != (gid_t)-1) { if (setgroups(1, &ugid.gid) == -1) - bb_perror_msg_and_die("setgroups"); + bb_perror_msg_and_die("setgroups"); xsetgid(ugid.gid); } xsetuid(ugid.uid); Modified: trunk/busybox/networking/ifupdown.c =================================================================== --- trunk/busybox/networking/ifupdown.c 2007-03-07 00:07:42 UTC (rev 18019) +++ trunk/busybox/networking/ifupdown.c 2007-03-07 09:35:43 UTC (rev 18020) @@ -421,7 +421,7 @@ result += execute("ifconfig %iface% %address% netmask %netmask%" "[[ broadcast %broadcast%]][[ pointopoint %pointopoint%]] ", ifd, exec); - result += execute("[[route add default gw %gateway% %iface%]]", ifd, exec); + result += execute("[[route add default gw %gateway% %iface%]]", ifd, exec); return ((result == 3) ? 3 : 0); #endif } Modified: trunk/busybox/networking/udhcp/domain_codec.c =================================================================== --- trunk/busybox/networking/udhcp/domain_codec.c 2007-03-07 00:07:42 UTC (rev 18019) +++ trunk/busybox/networking/udhcp/domain_codec.c 2007-03-07 09:35:43 UTC (rev 18020) @@ -200,6 +200,6 @@ *retlen = d - dname + 1; return dname; -} +} #endif /* ENABLE_FEATURE_RFC3397 */ Modified: trunk/busybox/selinux/selinuxenabled.c =================================================================== --- trunk/busybox/selinux/selinuxenabled.c 2007-03-07 00:07:42 UTC (rev 18019) +++ trunk/busybox/selinux/selinuxenabled.c 2007-03-07 09:35:43 UTC (rev 18020) @@ -1,6 +1,6 @@ /* * selinuxenabled - * + * * Based on libselinux 1.33.1 * Port to BusyBox Hiroshi Shinji * Modified: trunk/busybox/shell/ash.c =================================================================== --- trunk/busybox/shell/ash.c 2007-03-07 00:07:42 UTC (rev 18019) +++ trunk/busybox/shell/ash.c 2007-03-07 09:35:43 UTC (rev 18020) @@ -11197,7 +11197,7 @@ goto builtin_success; } else if (builtinloc <= 0) { goto builtin_success; - } + } } /* We have to search path. */ Modified: trunk/busybox/shell/ash_test/printenv.c =================================================================== --- trunk/busybox/shell/ash_test/printenv.c 2007-03-07 00:07:42 UTC (rev 18019) +++ trunk/busybox/shell/ash_test/printenv.c 2007-03-07 09:35:43 UTC (rev 18020) @@ -30,7 +30,7 @@ extern char **environ; int -main (argc, argv) +main (argc, argv) int argc; char **argv; { Modified: trunk/busybox/shell/msh.c =================================================================== --- trunk/busybox/shell/msh.c 2007-03-07 00:07:42 UTC (rev 18019) +++ trunk/busybox/shell/msh.c 2007-03-07 09:35:43 UTC (rev 18020) @@ -3723,7 +3723,7 @@ if (wb == NULL || wb->w_nword == 0 || (cp = wb->w_words[0]) == NULL ) { -// TODO: I suspect that +// TODO: I suspect that // char *evalstr(char *cp, int f) is actually // const char *evalstr(const char *cp, int f)! cp = (char*)""; Modified: trunk/busybox/util-linux/fdisk_sgi.c =================================================================== --- trunk/busybox/util-linux/fdisk_sgi.c 2007-03-07 00:07:42 UTC (rev 18019) +++ trunk/busybox/util-linux/fdisk_sgi.c 2007-03-07 09:35:43 UTC (rev 18020) @@ -356,9 +356,9 @@ static int sgi_check_bootfile(const char* aFile) { - if (strlen(aFile) < 3) /* "/a\n" is minimum */ { - printf(_("\nInvalid Bootfile!\n" - "\tThe bootfile must be an absolute non-zero pathname,\n" + if (strlen(aFile) < 3) /* "/a\n" is minimum */ { + printf(_("\nInvalid Bootfile!\n" + "\tThe bootfile must be an absolute non-zero pathname,\n" "\te.g. \"/unix\" or \"/unix.save\".\n")); return 0; } else { From bugs at busybox.net Wed Mar 7 01:38:18 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Wed, 7 Mar 2007 01:38:18 -0800 Subject: [BusyBox 0001260]: Fix httpd to run on MMU-less platforms Message-ID: A NOTE has been added to this issue. ====================================================================== http://busybox.net/bugs/view.php?id=1260 ====================================================================== Reported By: landau Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1260 Category: Networking Support Reproducibility: always Severity: major Priority: normal Status: assigned ====================================================================== Date Submitted: 03-06-2007 06:35 PST Last Modified: 03-07-2007 01:38 PST ====================================================================== Summary: Fix httpd to run on MMU-less platforms Description: The attached patch allows httpd to run on MMU-less platforms, such as Blackfin. All it does is calling vfork() instead of fork() (if BB_NOMMU is defined) and explaining in a comment why this is correct despite the child process' modifications to the address space. The issue is present since at least version 1.2. The patch is generated against svn rev 18015. ====================================================================== ---------------------------------------------------------------------- vda - 03-06-07 15:23 ---------------------------------------------------------------------- Hi. No obvious problems with the patch. However, I am concerned that I don't know nommu people needs and nommu environments in general. Do you nave any nommu emulator or, say, qemu runnable image for nommu processor so that I can run-test the change and generally play with nommu? ---------------------------------------------------------------------- landau - 03-07-07 01:38 ---------------------------------------------------------------------- Hi, I'm using an actual Blackfin BF537-stamp board. The CPU has no MMU. I haven't used any emulator for that, though the main Blackfin uClinux community site blackfin.uclinux.org (that has the kernel sources, toolchain, and everything one needs for a complete open-source build environment) mentions SkyEye (http://gro.clinux.org/projects/skyeye/). I haven't checked it. Another option (not checked either) is trying to compile the kernel for i386 and setting CONFIG_MMU=n in .config. If you have some no-mmu patches that you'd like to get merged, but you don't have the hardware to test it on, I'd be happy to test the patches on Blackfin. The busybox sources have some #ifdefs about BB_NOMMU, so I guess it was tested somehow... The main applets that don't work on Blackfin are init and inetd, so I have to use simpler external versions that came with the Blackfin uClinux distribution. Speaking of that, I'd love to have them merged (as optional components, of course!) into busybox, so that during configuration I'll be able to choose which init and inetd I want, or better, add a "CPU has MMU" option that preselects the right applet. I can volunteer for that task. Alex Issue History Date Modified Username Field Change ====================================================================== 03-06-07 06:35 landau New Issue 03-06-07 06:35 landau Status new => assigned 03-06-07 06:35 landau Assigned To => BusyBox 03-06-07 06:35 landau File Added: httpd-nommu.patch 03-06-07 15:23 vda Note Added: 0002212 03-07-07 01:38 landau Note Added: 0002214 ====================================================================== From bugs at busybox.net Wed Mar 7 07:52:23 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Wed, 7 Mar 2007 07:52:23 -0800 Subject: [BusyBox 0001262]: umount usage message lies about the availability of -a option Message-ID: <443d9e2d6988dbc14b5909fa76e51621@bugs.busybox.net> The following issue has been SUBMITTED. ====================================================================== http://busybox.net/bugs/view.php?id=1262 ====================================================================== Reported By: petesh Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1262 Category: Other Reproducibility: always Severity: trivial Priority: normal Status: assigned ====================================================================== Date Submitted: 03-07-2007 07:52 PST Last Modified: 03-07-2007 07:52 PST ====================================================================== Summary: umount usage message lies about the availability of -a option Description: When I built it without -s support for umount the usage message didn't reveal this fact. I wasted a while trying to track down the reason why my umount -a -r weren't working. Turns out that the usage message lied to me. I've attached the patch to fix the usage message. Cheers. ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 03-07-07 07:52 petesh New Issue 03-07-07 07:52 petesh Status new => assigned 03-07-07 07:52 petesh Assigned To => BusyBox 03-07-07 07:52 petesh File Added: fixusage-umount.diff ====================================================================== From vda at busybox.net Wed Mar 7 14:02:24 2007 From: vda at busybox.net (vda at busybox.net) Date: Wed, 7 Mar 2007 14:02:24 -0800 (PST) Subject: svn commit: trunk/busybox: archival archival/libunarchive include t etc... Message-ID: <20070307220224.BF4414807F@busybox.net> Author: vda Date: 2007-03-07 14:02:23 -0800 (Wed, 07 Mar 2007) New Revision: 18025 Log: bunzip2/gunzip/uncompress/unlzma: merge into common code - fix few corner cases, reduce size by 450 bytes. Update testsuite. Added: trunk/busybox/archival/bbunzip.c trunk/busybox/testsuite/bunzip2.tests trunk/busybox/testsuite/bzcat.tests trunk/busybox/testsuite/gunzip.tests Removed: trunk/busybox/archival/bunzip2.c trunk/busybox/archival/gunzip.c trunk/busybox/archival/uncompress.c trunk/busybox/archival/unlzma.c Modified: trunk/busybox/archival/Kbuild trunk/busybox/archival/libunarchive/check_header_gzip.c trunk/busybox/archival/libunarchive/get_header_tar_gz.c trunk/busybox/archival/rpm.c trunk/busybox/archival/rpm2cpio.c trunk/busybox/include/unarchive.h Changeset: Sorry, the patch is too large to include (1047 lines). Please use ViewCVS to see it! http://busybox.net/cgi-bin/viewcvs.cgi?view=rev&root=svn&rev=18025 From vda at busybox.net Wed Mar 7 14:16:39 2007 From: vda at busybox.net (vda at busybox.net) Date: Wed, 7 Mar 2007 14:16:39 -0800 (PST) Subject: svn commit: trunk/busybox/networking Message-ID: <20070307221639.8A73448082@busybox.net> Author: vda Date: 2007-03-07 14:16:38 -0800 (Wed, 07 Mar 2007) New Revision: 18026 Log: httpd: make httpd usable for NOMMU CPUs Modified: trunk/busybox/networking/httpd.c Changeset: Modified: trunk/busybox/networking/httpd.c =================================================================== --- trunk/busybox/networking/httpd.c 2007-03-07 22:02:23 UTC (rev 18025) +++ trunk/busybox/networking/httpd.c 2007-03-07 22:16:38 UTC (rev 18026) @@ -977,7 +977,20 @@ if (pipe(toCgi) != 0) return 0; +/* + * Note: We can use vfork() here in the no-mmu case, although + * the child modifies the parent's variables, due to: + * 1) The parent does not use the child-modified variables. + * 2) The allocated memory (in the child) is freed when the process + * exits. This happens instantly after the child finishes, + * since httpd is run from inetd (and it can't run standalone + * in uClinux). + */ +#ifdef BB_NOMMU + pid = vfork(); +#else pid = fork(); +#endif if (pid < 0) return 0; From bugs at busybox.net Wed Mar 7 14:17:15 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Wed, 7 Mar 2007 14:17:15 -0800 Subject: [BusyBox 0001260]: Fix httpd to run on MMU-less platforms Message-ID: <667da47ea1b51bbfaaf0ce83add8e413@busybox.net> The following issue has been CLOSED ====================================================================== http://busybox.net/bugs/view.php?id=1260 ====================================================================== Reported By: landau Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1260 Category: Networking Support Reproducibility: always Severity: major Priority: normal Status: closed Resolution: open Fixed in Version: ====================================================================== Date Submitted: 03-06-2007 06:35 PST Last Modified: 03-07-2007 14:17 PST ====================================================================== Summary: Fix httpd to run on MMU-less platforms Description: The attached patch allows httpd to run on MMU-less platforms, such as Blackfin. All it does is calling vfork() instead of fork() (if BB_NOMMU is defined) and explaining in a comment why this is correct despite the child process' modifications to the address space. The issue is present since at least version 1.2. The patch is generated against svn rev 18015. ====================================================================== ---------------------------------------------------------------------- vda - 03-06-07 15:23 ---------------------------------------------------------------------- Hi. No obvious problems with the patch. However, I am concerned that I don't know nommu people needs and nommu environments in general. Do you nave any nommu emulator or, say, qemu runnable image for nommu processor so that I can run-test the change and generally play with nommu? ---------------------------------------------------------------------- landau - 03-07-07 01:38 ---------------------------------------------------------------------- Hi, I'm using an actual Blackfin BF537-stamp board. The CPU has no MMU. I haven't used any emulator for that, though the main Blackfin uClinux community site blackfin.uclinux.org (that has the kernel sources, toolchain, and everything one needs for a complete open-source build environment) mentions SkyEye (http://gro.clinux.org/projects/skyeye/). I haven't checked it. Another option (not checked either) is trying to compile the kernel for i386 and setting CONFIG_MMU=n in .config. If you have some no-mmu patches that you'd like to get merged, but you don't have the hardware to test it on, I'd be happy to test the patches on Blackfin. The busybox sources have some #ifdefs about BB_NOMMU, so I guess it was tested somehow... The main applets that don't work on Blackfin are init and inetd, so I have to use simpler external versions that came with the Blackfin uClinux distribution. Speaking of that, I'd love to have them merged (as optional components, of course!) into busybox, so that during configuration I'll be able to choose which init and inetd I want, or better, add a "CPU has MMU" option that preselects the right applet. I can volunteer for that task. Alex ---------------------------------------------------------------------- vda - 03-07-07 14:17 ---------------------------------------------------------------------- Applied in rev 18026, thanks. Issue History Date Modified Username Field Change ====================================================================== 03-06-07 06:35 landau New Issue 03-06-07 06:35 landau Status new => assigned 03-06-07 06:35 landau Assigned To => BusyBox 03-06-07 06:35 landau File Added: httpd-nommu.patch 03-06-07 15:23 vda Note Added: 0002212 03-07-07 01:38 landau Note Added: 0002214 03-07-07 01:39 landau Issue Monitored: landau 03-07-07 14:17 vda Status assigned => closed 03-07-07 14:17 vda Note Added: 0002216 ====================================================================== From vda at busybox.net Wed Mar 7 14:45:43 2007 From: vda at busybox.net (vda at busybox.net) Date: Wed, 7 Mar 2007 14:45:43 -0800 (PST) Subject: svn commit: trunk/busybox/coreutils Message-ID: <20070307224543.06BF848085@busybox.net> Author: vda Date: 2007-03-07 14:45:42 -0800 (Wed, 07 Mar 2007) New Revision: 18027 Log: diff: make -U0 work Modified: trunk/busybox/coreutils/diff.c Changeset: Modified: trunk/busybox/coreutils/diff.c =================================================================== --- trunk/busybox/coreutils/diff.c 2007-03-07 22:16:38 UTC (rev 18026) +++ trunk/busybox/coreutils/diff.c 2007-03-07 22:45:42 UTC (rev 18027) @@ -1175,7 +1175,7 @@ L_arg = L_arg->link; } if (option_mask32 & FLAG_U) - context = xatou_range(U_opt, 1, INT_MAX); + context = xatoi_u(U_opt); /* * Do sanity checks, fill in stb1 and stb2 and call the appropriate From vda at busybox.net Wed Mar 7 14:49:54 2007 From: vda at busybox.net (vda at busybox.net) Date: Wed, 7 Mar 2007 14:49:54 -0800 (PST) Subject: svn commit: trunk/busybox/include Message-ID: <20070307224954.A5DBE4808A@busybox.net> Author: vda Date: 2007-03-07 14:49:53 -0800 (Wed, 07 Mar 2007) New Revision: 18028 Log: fix umount usage message Modified: trunk/busybox/include/usage.h Changeset: Modified: trunk/busybox/include/usage.h =================================================================== --- trunk/busybox/include/usage.h 2007-03-07 22:45:42 UTC (rev 18027) +++ trunk/busybox/include/usage.h 2007-03-07 22:49:53 UTC (rev 18028) @@ -3357,7 +3357,8 @@ #define umount_full_usage \ "Unmount file systems" \ "\n\nOptions:\n" \ - "\n -a Unmount all file systems" USE_FEATURE_MTAB_SUPPORT(" in /etc/mtab") \ + USE_FEATURE_UMOUNT_ALL( \ + "\n -a Unmount all file systems" USE_FEATURE_MTAB_SUPPORT(" in /etc/mtab")) \ USE_FEATURE_MTAB_SUPPORT( \ "\n -n Don't erase /etc/mtab entries") \ "\n -r Try to remount devices as read-only if mount is busy" \ From bugs at busybox.net Wed Mar 7 14:50:21 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Wed, 7 Mar 2007 14:50:21 -0800 Subject: [BusyBox 0001262]: umount usage message lies about the availability of -a option Message-ID: <6a120fa8c867e1cdc4c88616e51b28d1@busybox.net> The following issue has been CLOSED ====================================================================== http://busybox.net/bugs/view.php?id=1262 ====================================================================== Reported By: petesh Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1262 Category: Other Reproducibility: always Severity: trivial Priority: normal Status: closed Resolution: open Fixed in Version: ====================================================================== Date Submitted: 03-07-2007 07:52 PST Last Modified: 03-07-2007 14:50 PST ====================================================================== Summary: umount usage message lies about the availability of -a option Description: When I built it without -s support for umount the usage message didn't reveal this fact. I wasted a while trying to track down the reason why my umount -a -r weren't working. Turns out that the usage message lied to me. I've attached the patch to fix the usage message. Cheers. ====================================================================== ---------------------------------------------------------------------- vda - 03-07-07 14:50 ---------------------------------------------------------------------- Applied in revision 18028. Thanks! Issue History Date Modified Username Field Change ====================================================================== 03-07-07 07:52 petesh New Issue 03-07-07 07:52 petesh Status new => assigned 03-07-07 07:52 petesh Assigned To => BusyBox 03-07-07 07:52 petesh File Added: fixusage-umount.diff 03-07-07 14:50 vda Status assigned => closed 03-07-07 14:50 vda Note Added: 0002217 ====================================================================== From vda at busybox.net Wed Mar 7 15:02:54 2007 From: vda at busybox.net (vda at busybox.net) Date: Wed, 7 Mar 2007 15:02:54 -0800 (PST) Subject: svn commit: trunk/busybox: include util-linux Message-ID: <20070307230254.C251448094@busybox.net> Author: vda Date: 2007-03-07 15:02:50 -0800 (Wed, 07 Mar 2007) New Revision: 18029 Log: hwclock: support /dev/rtc0 etc Modified: trunk/busybox/include/usage.h trunk/busybox/util-linux/hwclock.c Changeset: Modified: trunk/busybox/include/usage.h =================================================================== --- trunk/busybox/include/usage.h 2007-03-07 22:49:53 UTC (rev 18028) +++ trunk/busybox/include/usage.h 2007-03-07 23:02:50 UTC (rev 18029) @@ -1286,15 +1286,18 @@ " -d STRING URL decode STRING" #define hwclock_trivial_usage \ - "[-r|--show] [-s|--hctosys] [-w|--systohc] [-l|--localtime] [-u|--utc]" + "[-r|--show] [-s|--hctosys] [-w|--systohc]" \ + " [-l|--localtime] [-u|--utc]" \ + " [-f FILE]" #define hwclock_full_usage \ - "Query and set the hardware clock (RTC)" \ + "Query and set a hardware clock (RTC)" \ "\n\nOptions:\n" \ " -r Read hardware clock and print result\n" \ " -s Set the system time from the hardware clock\n" \ " -w Set the hardware clock to the current system time\n" \ " -u The hardware clock is kept in coordinated universal time\n" \ - " -l The hardware clock is kept in local time" + " -l The hardware clock is kept in local time\n" \ + " -f FILE Use the specified clock (e.g. /dev/rtc2)" #define id_trivial_usage \ "[OPTIONS]... [USERNAME]" Modified: trunk/busybox/util-linux/hwclock.c =================================================================== --- trunk/busybox/util-linux/hwclock.c 2007-03-07 22:49:53 UTC (rev 18028) +++ trunk/busybox/util-linux/hwclock.c 2007-03-07 23:02:50 UTC (rev 18029) @@ -35,16 +35,22 @@ # endif #endif +static const char *rtcname; + static int xopen_rtc(int flags) { int rtc; - rtc = open("/dev/rtc", flags); - if (rtc < 0) { - rtc = open("/dev/misc/rtc", flags); - if (rtc < 0) - bb_perror_msg_and_die("cannot access RTC"); + + if (!rtcname) { + rtc = open("/dev/rtc", flags); + if (rtc >= 0) + return rtc; + rtc = open("/dev/rtc0", flags); + if (rtc >= 0) + return rtc; + rtcname = "/dev/misc/rtc"; } - return rtc; + return xopen(rtcname, flags); } static time_t read_rtc(int utc) @@ -175,6 +181,7 @@ #define HWCLOCK_OPT_SHOW 0x04 #define HWCLOCK_OPT_HCTOSYS 0x08 #define HWCLOCK_OPT_SYSTOHC 0x10 +#define HWCLOCK_OPT_RTCFILE 0x20 int hwclock_main(int argc, char **argv ); int hwclock_main(int argc, char **argv ) @@ -189,12 +196,13 @@ { "show", 0, 0, 'r' }, { "hctosys", 0, 0, 's' }, { "systohc", 0, 0, 'w' }, + { "file", 1, 0, 'f' }, { 0, 0, 0, 0 } }; applet_long_options = hwclock_long_options; #endif opt_complementary = "?:r--ws:w--rs:s--wr:l--u:u--l"; - opt = getopt32(argc, argv, "lursw"); + opt = getopt32(argc, argv, "lurswf:", &rtcname); /* If -u or -l wasn't given check if we are using utc */ if (opt & (HWCLOCK_OPT_UTC | HWCLOCK_OPT_LOCALTIME)) From bugs at busybox.net Wed Mar 7 15:03:11 2007 From: bugs at busybox.net (bugs at busybox.net) Date: Wed, 7 Mar 2007 15:03:11 -0800 Subject: [BusyBox 0001179]: [PATCH] hwclock must understand /dev/rtc0, /dev/rtc1, etc Message-ID: The following issue has been CLOSED ====================================================================== http://busybox.net/bugs/view.php?id=1179 ====================================================================== Reported By: db Assigned To: BusyBox ====================================================================== Project: BusyBox Issue ID: 1179 Category: New Features Reproducibility: always Severity: feature Priority: normal Status: closed Resolution: open Fixed in Version: ====================================================================== Date Submitted: 01-26-2007 12:00 PST Last Modified: 03-07-2007 15:03 PST ====================================================================== Summary: [PATCH] hwclock must understand /dev/rtc0, /dev/rtc1, etc Description: For the past year or more, Linux has had an RTC framework supporting multiple RTCs, conventionally named /dev/rtcN (N starting at zero). This is widely used on embedded Linuxes, since there are so many different implementations of RTCs, and systems may need more than one (e.g. the full featured integrated one may not be battery backed). The /dev/rtc name is conventionally used only for the RTC on an x86_pc. The busybox "hwclock" doesn't understand those names, and has no way to access more than one RTC at a time, even if someone sets up a symlink from e.g. rtc pointing at rtc0. ====================================================================== ---------------------------------------------------------------------- bernhardf - 01-27-07 05:19 ---------------------------------------------------------------------- wrong project. That's not a buildroot issue but a busybox one. ---------------------------------------------------------------------- bernhardf - 01-27-07 05:22 ---------------------------------------------------------------------- I cannot change the project this was reported against, so it is unlikely that Denis will ever see it, fwiw. Not closing for now. ---------------------------------------------------------------------- vda - 01-27-07 05:42 ---------------------------------------------------------------------- I saw it (bugs are auto-posted to ml) ---------------------------------------------------------------------- db - 01-27-07 08:31 ---------------------------------------------------------------------- I have no idea why I couldn't set the project correctly when submitting this bug ... there was no such option presented, and it was **AUTOMAGICALLY** assigned to the wrong project (sigh). ---------------------------------------------------------------------- vda - 03-07-07 15:03 ---------------------------------------------------------------------- bb_perror_msg_and_die("cannot access RTC"); return rtc; huh? ;) Apart from xopen_rtc being x2 bigger than it can be, patch is ok. Applied in rev 18028, thanks. Issue History Date Modified Username Field Change ====================================================================== 01-26-07 12:00 db New Issue 01-26-07 12:00 db Status new => assigned 01-26-07 12:00 db Assigned To => uClibc 01-26-07 12:00 db File Added: hwclock.patch 01-27-07 01:53 jocke Assigned To uClibc => BusyBox 01-27-07 05:19 bernhardf Note Added: 0002058 01-27-07 05:22 bernhardf Note Added: 0002059 01-27-07 05:42 vda Note Added: 0002060 01-27-07 08:31 db Note Added: 0002061 03-06-07 20:08 vapier Project buildroot => BusyBox 03-07-07 15:03 vda Status assigned => closed 03-07-07 15:03 vda Note Added: 0002218 ====================================================================== From vda at busybox.net Wed Mar 7 15:08:27 2007 From: vda at busybox.net (vda at busybox.net) Date: Wed, 7 Mar 2007 15:08:27 -0800 (PST) Subject: svn commit: trunk/busybox/testsuite Message-ID: <20070307230827.6347F480A2@busybox.net> Author: vda Date: 2007-03-07 15:08:26 -0800 (Wed, 07 Mar 2007) New Revision: 18030 Log: missed end-of-line Modified: trunk/busybox/testsuite/bunzip2.tests Changeset: Modified: trunk/busybox/testsuite/bunzip2.tests =================================================================== --