From florian at alphacore.net Thu Mar 1 01:23:26 2007 From: florian at alphacore.net (Florian Fainelli) Date: Thu, 01 Mar 2007 10:23:26 +0100 Subject: [PATCH] ping.c : fix min/max packet size usage In-Reply-To: <200703010014.19437.vda.linux@googlemail.com> References: <45E5DB9F.2030704@alphacore.net> <200703010014.19437.vda.linux@googlemail.com> Message-ID: <45E69B8E.6010201@alphacore.net> Hi Denis, Here is the rediff against the file you sent me, thanks for considering this patch. --- ping.c 2007-03-01 10:13:11.000000000 +0100 +++ ping.c.new 2007-03-01 10:18:00.000000000 +0100 @@ -416,8 +416,8 @@ gettimeofday(&tv, NULL); - /* discard if too short */ - if (sz < (datalen + ICMP_MINLEN)) + /* discard if too short /long */ + if (sz < (datalen + ICMP_MINLEN) || (sz > MAXICMPLEN)) return; /* check IP header */ @@ -433,6 +433,10 @@ ++nreceived; tp = (struct timeval *) icmppkt->icmp_data; + /* If packet is too short, results will be truncated */ + if (sz < (ICMP_MINLEN + sizeof(tv.tv_sec) + sizeof(tv.tv_usec))) + return; + if ((tv.tv_usec -= tp->tv_usec) < 0) { --tv.tv_sec; tv.tv_usec += 1000000; Denis Vlasenko a ?crit : > On Wednesday 28 February 2007 20:44, Florian Fainelli wrote: >> Hi all, >> >> An OpenWrt user reported that using packet size lower than 15, you could >> trigger the following bug : >> >> ping -s 1 -c 1 192.168.0.1 >> PING 192.168.0.1 (192.168.0.1): 1 data bytes >> 9 bytes from 192.168.0.1: icmp_seq=0 ttl=64 time=291869364.5 ms >> >> The following patch adds maximum length checking for ICMP packets, as >> well as minimum usable size. Also, I noticed that datalen was not used >> when generating packets, when not specified, datalen is initialized to >> DEFDATALEN. > > Thanks! > > Unfortunately after 1.4.1 ping and ping6 got merged into one ping.c > (saving kilobytes of code) and your patch doesn't apply to current svn. > > Care to rediff? > > ping.c from current svn is attached. > -- > vda > > > ------------------------------------------------------------------------ > > /* vi: set sw=4 ts=4: */ > /* > * Mini ping implementation for busybox > * > * Copyright (C) 1999 by Randolph Chung > * > * Adapted from the ping in netkit-base 0.10: > * Copyright (c) 1989 The Regents of the University of California. > * All rights reserved. > * > * This code is derived from software contributed to Berkeley by > * Mike Muuss. > * > * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. > */ > /* from ping6.c: > * Copyright (C) 1999 by Randolph Chung > * > * This version of ping is adapted from the ping in netkit-base 0.10, > * which is: > * > * Original copyright notice is retained at the end of this file. > * > * This version is an adaptation of ping.c from busybox. > * The code was modified by Bart Visscher > */ > > #include > #include > #include "busybox.h" > > #if ENABLE_PING6 > #include > /* I see RENUMBERED constants in bits/in.h - !!? > * What a fuck is going on with libc? Is it a glibc joke? */ > #ifdef IPV6_2292HOPLIMIT > #undef IPV6_HOPLIMIT > #define IPV6_HOPLIMIT IPV6_2292HOPLIMIT > #endif > #endif > > enum { > DEFDATALEN = 56, > MAXIPLEN = 60, > MAXICMPLEN = 76, > MAXPACKET = 65468, > MAX_DUP_CHK = (8 * 128), > MAXWAIT = 10, > PINGINTERVAL = 1, /* 1 second */ > }; > > /* common routines */ > > static int in_cksum(unsigned short *buf, int sz) > { > int nleft = sz; > int sum = 0; > unsigned short *w = buf; > unsigned short ans = 0; > > while (nleft > 1) { > sum += *w++; > nleft -= 2; > } > > if (nleft == 1) { > *(unsigned char *) (&ans) = *(unsigned char *) w; > sum += ans; > } > > sum = (sum >> 16) + (sum & 0xFFFF); > sum += (sum >> 16); > ans = ~sum; > return ans; > } > > #if !ENABLE_FEATURE_FANCY_PING > > /* simple version */ > > static char *hostname; > > static void noresp(int ign ATTRIBUTE_UNUSED) > { > printf("No response from %s\n", hostname); > exit(EXIT_FAILURE); > } > > static void ping4(len_and_sockaddr *lsa) > { > struct sockaddr_in pingaddr; > struct icmp *pkt; > int pingsock, c; > char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN]; > > pingsock = create_icmp_socket(); > pingaddr = lsa->sin; > > pkt = (struct icmp *) packet; > memset(pkt, 0, sizeof(packet)); > pkt->icmp_type = ICMP_ECHO; > pkt->icmp_cksum = in_cksum((unsigned short *) pkt, sizeof(packet)); > > c = sendto(pingsock, packet, DEFDATALEN + ICMP_MINLEN, 0, > (struct sockaddr *) &pingaddr, sizeof(pingaddr)); > > if (c < 0) { > if (ENABLE_FEATURE_CLEAN_UP) > close(pingsock); > bb_perror_msg_and_die("sendto"); > } > > /* listen for replies */ > while (1) { > struct sockaddr_in from; > socklen_t fromlen = sizeof(from); > > c = recvfrom(pingsock, packet, sizeof(packet), 0, > (struct sockaddr *) &from, &fromlen); > if (c < 0) { > if (errno != EINTR) > bb_perror_msg("recvfrom"); > continue; > } > if (c >= 76) { /* ip + icmp */ > struct iphdr *iphdr = (struct iphdr *) packet; > > pkt = (struct icmp *) (packet + (iphdr->ihl << 2)); /* skip ip hdr */ > if (pkt->icmp_type == ICMP_ECHOREPLY) > break; > } > } > if (ENABLE_FEATURE_CLEAN_UP) > close(pingsock); > } > > #if ENABLE_PING6 > static void ping6(len_and_sockaddr *lsa) > { > struct sockaddr_in6 pingaddr; > struct icmp6_hdr *pkt; > int pingsock, c; > int sockopt; > char packet[DEFDATALEN + MAXIPLEN + MAXICMPLEN]; > > pingsock = create_icmp6_socket(); > pingaddr = lsa->sin6; > > pkt = (struct icmp6_hdr *) packet; > memset(pkt, 0, sizeof(packet)); > pkt->icmp6_type = ICMP6_ECHO_REQUEST; > > sockopt = offsetof(struct icmp6_hdr, icmp6_cksum); > setsockopt(pingsock, SOL_RAW, IPV6_CHECKSUM, &sockopt, sizeof(sockopt)); > > c = sendto(pingsock, packet, DEFDATALEN + sizeof (struct icmp6_hdr), 0, > (struct sockaddr *) &pingaddr, sizeof(pingaddr)); > > if (c < 0) { > if (ENABLE_FEATURE_CLEAN_UP) > close(pingsock); > bb_perror_msg_and_die("sendto"); > } > > /* listen for replies */ > while (1) { > struct sockaddr_in6 from; > socklen_t fromlen = sizeof(from); > > c = recvfrom(pingsock, packet, sizeof(packet), 0, > (struct sockaddr *) &from, &fromlen); > if (c < 0) { > if (errno != EINTR) > bb_perror_msg("recvfrom"); > continue; > } > if (c >= 8) { /* icmp6_hdr */ > pkt = (struct icmp6_hdr *) packet; > if (pkt->icmp6_type == ICMP6_ECHO_REPLY) > break; > } > } > if (ENABLE_FEATURE_CLEAN_UP) > close(pingsock); > } > #endif > > int ping_main(int argc, char **argv); > int ping_main(int argc, char **argv) > { > len_and_sockaddr *lsa; > #if ENABLE_PING6 > sa_family_t af = AF_UNSPEC; > while (++argv[0][0] == '-') { > if (argv[0][1] == '4') { > af = AF_INET; > continue; > } > if (argv[0][1] == '6') { > af = AF_INET6; > continue; > } > bb_show_usage(); > } > #else > argv++; > #endif > > hostname = *argv; > if (!hostname) > bb_show_usage(); > > #if ENABLE_PING6 > lsa = xhost_and_af2sockaddr(hostname, 0, af); > #else > lsa = xhost_and_af2sockaddr(hostname, 0, AF_INET); > #endif > /* Set timer _after_ DNS resolution */ > signal(SIGALRM, noresp); > alarm(5); /* give the host 5000ms to respond */ > > #if ENABLE_PING6 > if (lsa->sa.sa_family == AF_INET6) > ping6(lsa); > else > #endif > ping4(lsa); > printf("%s is alive!\n", hostname); > return EXIT_SUCCESS; > } > > > #else /* FEATURE_FANCY_PING */ > > > /* full(er) version */ > > #define OPT_STRING ("qvc:s:I:4" USE_PING6("6")) > enum { > OPT_QUIET = 1 << 0, > OPT_VERBOSE = 1 << 1, > OPT_c = 1 << 2, > OPT_s = 1 << 3, > OPT_I = 1 << 4, > OPT_IPV4 = 1 << 5, > OPT_IPV6 = (1 << 6) * ENABLE_PING6, > }; > > > static union { > struct sockaddr sa; > struct sockaddr_in sin; > #if ENABLE_PING6 > struct sockaddr_in6 sin6; > #endif > } pingaddr; > static len_and_sockaddr *source_lsa; > static int pingsock = -1; > static unsigned datalen; /* intentionally uninitialized to work around gcc bug */ > > static int if_index; > > static unsigned long ntransmitted, nreceived, nrepeats, pingcount; > static int myid; > static unsigned long tmin = ULONG_MAX, tmax, tsum; > static char rcvd_tbl[MAX_DUP_CHK / 8]; > > static const char *hostname; > static const char *dotted; > > #define A(bit) rcvd_tbl[(bit)>>3] /* identify byte in array */ > #define B(bit) (1 << ((bit) & 0x07)) /* identify bit in byte */ > #define SET(bit) (A(bit) |= B(bit)) > #define CLR(bit) (A(bit) &= (~B(bit))) > #define TST(bit) (A(bit) & B(bit)) > > /**************************************************************************/ > > static void pingstats(int junk ATTRIBUTE_UNUSED) > { > int status; > > signal(SIGINT, SIG_IGN); > > printf("\n--- %s ping statistics ---\n", hostname); > printf("%lu packets transmitted, ", ntransmitted); > printf("%lu packets received, ", nreceived); > if (nrepeats) > printf("%lu duplicates, ", nrepeats); > 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", > 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); > } > > static void sendping_tail(void (*sp)(int), const void *pkt, int size_pkt) > { > int sz; > > CLR((uint16_t)ntransmitted % MAX_DUP_CHK); > ntransmitted++; > > /* sizeof(pingaddr) can be larger than real sa size, but I think > * it doesn't matter */ > sz = sendto(pingsock, pkt, size_pkt, 0, &pingaddr.sa, sizeof(pingaddr)); > if (sz < 0) > bb_perror_msg_and_die("sendto"); > if (sz != size_pkt) > bb_error_msg_and_die("ping wrote %d chars; %d expected", sz, > size_pkt); > > signal(SIGALRM, sp); > if (pingcount == 0 || ntransmitted < pingcount) { /* schedule next in 1s */ > alarm(PINGINTERVAL); > } else { /* done, wait for the last ping to come back */ > /* todo, don't necessarily need to wait so long... */ > signal(SIGALRM, pingstats); > alarm(MAXWAIT); > } > } > > static void sendping4(int junk ATTRIBUTE_UNUSED) > { > struct icmp *pkt = alloca(datalen + ICMP_MINLEN); > > pkt->icmp_type = ICMP_ECHO; > pkt->icmp_code = 0; > pkt->icmp_cksum = 0; > pkt->icmp_seq = htons(ntransmitted); /* don't ++ here, it can be a macro */ > pkt->icmp_id = myid; > gettimeofday((struct timeval *) &pkt->icmp_dun, NULL); > pkt->icmp_cksum = in_cksum((unsigned short *) pkt, datalen + ICMP_MINLEN); > > sendping_tail(sendping4, pkt, datalen + ICMP_MINLEN); > } > #if ENABLE_PING6 > static void sendping6(int junk ATTRIBUTE_UNUSED) > { > struct icmp6_hdr *pkt = alloca(datalen + sizeof(struct icmp6_hdr)); > > pkt->icmp6_type = ICMP6_ECHO_REQUEST; > pkt->icmp6_code = 0; > pkt->icmp6_cksum = 0; > pkt->icmp6_seq = htons(ntransmitted); /* don't ++ here, it can be a macro */ > pkt->icmp6_id = myid; > gettimeofday((struct timeval *) &pkt->icmp6_data8[4], NULL); > > sendping_tail(sendping6, pkt, datalen + sizeof(struct icmp6_hdr)); > } > #endif > > static const char *icmp_type_name(int id) > { > switch (id) { > case ICMP_ECHOREPLY: return "Echo Reply"; > case ICMP_DEST_UNREACH: return "Destination Unreachable"; > case ICMP_SOURCE_QUENCH: return "Source Quench"; > case ICMP_REDIRECT: return "Redirect (change route)"; > case ICMP_ECHO: return "Echo Request"; > case ICMP_TIME_EXCEEDED: return "Time Exceeded"; > case ICMP_PARAMETERPROB: return "Parameter Problem"; > case ICMP_TIMESTAMP: return "Timestamp Request"; > case ICMP_TIMESTAMPREPLY: return "Timestamp Reply"; > case ICMP_INFO_REQUEST: return "Information Request"; > case ICMP_INFO_REPLY: return "Information Reply"; > case ICMP_ADDRESS: return "Address Mask Request"; > case ICMP_ADDRESSREPLY: return "Address Mask Reply"; > default: return "unknown ICMP type"; > } > } > #if ENABLE_PING6 > /* RFC3542 changed some definitions from RFC2292 for no good reason, whee! > * the newer 3542 uses a MLD_ prefix where as 2292 uses ICMP6_ prefix */ > #ifndef MLD_LISTENER_QUERY > # define MLD_LISTENER_QUERY ICMP6_MEMBERSHIP_QUERY > #endif > #ifndef MLD_LISTENER_REPORT > # define MLD_LISTENER_REPORT ICMP6_MEMBERSHIP_REPORT > #endif > #ifndef MLD_LISTENER_REDUCTION > # define MLD_LISTENER_REDUCTION ICMP6_MEMBERSHIP_REDUCTION > #endif > static const char *icmp6_type_name(int id) > { > switch (id) { > case ICMP6_DST_UNREACH: return "Destination Unreachable"; > case ICMP6_PACKET_TOO_BIG: return "Packet too big"; > case ICMP6_TIME_EXCEEDED: return "Time Exceeded"; > case ICMP6_PARAM_PROB: return "Parameter Problem"; > case ICMP6_ECHO_REPLY: return "Echo Reply"; > case ICMP6_ECHO_REQUEST: return "Echo Request"; > case MLD_LISTENER_QUERY: return "Listener Query"; > case MLD_LISTENER_REPORT: return "Listener Report"; > case MLD_LISTENER_REDUCTION: return "Listener Reduction"; > default: return "unknown ICMP type"; > } > } > #endif > > 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; > > gettimeofday(&tv, NULL); > > /* discard if too short */ > if (sz < (datalen + ICMP_MINLEN)) > return; > > /* check IP header */ > iphdr = (struct iphdr *) buf; > hlen = iphdr->ihl << 2; > sz -= hlen; > icmppkt = (struct icmp *) (buf + hlen); > if (icmppkt->icmp_id != myid) > return; /* not our ping */ > > if (icmppkt->icmp_type == ICMP_ECHOREPLY) { > uint16_t recv_seq = ntohs(icmppkt->icmp_seq); > ++nreceived; > tp = (struct timeval *) icmppkt->icmp_data; > > 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)); > } > 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; > > icmppkt = (struct icmp6_hdr *) packet; > if (icmppkt->icmp6_id != myid) > return; /* not our ping */ > > if (icmppkt->icmp6_type == ICMP6_ECHO_REPLY) { > uint16_t recv_seq = ntohs(icmppkt->icmp6_seq); > ++nreceived; > tp = (struct timeval *) &icmppkt->icmp6_data8[4]; > > 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)); > } > fflush(stdout); > } > #endif > > static void ping4(len_and_sockaddr *lsa) > { > char packet[datalen + MAXIPLEN + MAXICMPLEN]; > int sockopt; > > pingsock = create_icmp_socket(); > pingaddr.sin = lsa->sin; > if (source_lsa) > xbind(pingsock, &lsa->sa, lsa->len); > > /* enable broadcast pings */ > setsockopt_broadcast(pingsock); > > /* set recv buf for broadcast pings */ > sockopt = 48 * 1024; /* explain why 48k? */ > setsockopt(pingsock, SOL_SOCKET, SO_RCVBUF, &sockopt, sizeof(sockopt)); > > signal(SIGINT, pingstats); > > /* start the ping's going ... */ > sendping4(0); > > /* listen for replies */ > while (1) { > struct sockaddr_in from; > socklen_t fromlen = (socklen_t) sizeof(from); > int c; > > c = recvfrom(pingsock, packet, sizeof(packet), 0, > (struct sockaddr *) &from, &fromlen); > if (c < 0) { > if (errno != EINTR) > bb_perror_msg("recvfrom"); > continue; > } > unpack4(packet, c, &from); > if (pingcount > 0 && nreceived >= pingcount) > break; > } > } > #if ENABLE_PING6 > extern int BUG_bad_offsetof_icmp6_cksum(void); > static void ping6(len_and_sockaddr *lsa) > { > char packet[datalen + MAXIPLEN + MAXICMPLEN]; > int sockopt; > struct msghdr msg; > struct sockaddr_in6 from; > struct iovec iov; > char control_buf[CMSG_SPACE(36)]; > > pingsock = create_icmp6_socket(); > pingaddr.sin6 = lsa->sin6; > /* untested whether "-I addr" really works for IPv6: */ > if (source_lsa) > xbind(pingsock, &lsa->sa, lsa->len); > > #ifdef ICMP6_FILTER > { > struct icmp6_filter filt; > if (!(option_mask32 & OPT_VERBOSE)) { > ICMP6_FILTER_SETBLOCKALL(&filt); > ICMP6_FILTER_SETPASS(ICMP6_ECHO_REPLY, &filt); > } else { > ICMP6_FILTER_SETPASSALL(&filt); > } > if (setsockopt(pingsock, IPPROTO_ICMPV6, ICMP6_FILTER, &filt, > sizeof(filt)) < 0) > bb_error_msg_and_die("setsockopt(ICMP6_FILTER)"); > } > #endif /*ICMP6_FILTER*/ > > /* enable broadcast pings */ > setsockopt_broadcast(pingsock); > > /* set recv buf for broadcast pings */ > sockopt = 48 * 1024; /* explain why 48k? */ > setsockopt(pingsock, SOL_SOCKET, SO_RCVBUF, &sockopt, sizeof(sockopt)); > > sockopt = offsetof(struct icmp6_hdr, icmp6_cksum); > if (offsetof(struct icmp6_hdr, icmp6_cksum) != 2) > BUG_bad_offsetof_icmp6_cksum(); > setsockopt(pingsock, SOL_RAW, IPV6_CHECKSUM, &sockopt, sizeof(sockopt)); > > /* request ttl info to be returned in ancillary data */ > setsockopt(pingsock, SOL_IPV6, IPV6_HOPLIMIT, &const_int_1, sizeof(const_int_1)); > > if (if_index) > pingaddr.sin6.sin6_scope_id = if_index; > > signal(SIGINT, pingstats); > > /* start the ping's going ... */ > sendping6(0); > > /* listen for replies */ > msg.msg_name = &from; > msg.msg_namelen = sizeof(from); > msg.msg_iov = &iov; > msg.msg_iovlen = 1; > msg.msg_control = control_buf; > iov.iov_base = packet; > iov.iov_len = sizeof(packet); > while (1) { > int c; > struct cmsghdr *mp; > int hoplimit = -1; > msg.msg_controllen = sizeof(control_buf); > > c = recvmsg(pingsock, &msg, 0); > if (c < 0) { > if (errno != EINTR) > bb_perror_msg("recvfrom"); > continue; > } > for (mp = CMSG_FIRSTHDR(&msg); mp; mp = CMSG_NXTHDR(&msg, mp)) { > if (mp->cmsg_level == SOL_IPV6 > && mp->cmsg_type == IPV6_HOPLIMIT > /* don't check len - we trust the kernel: */ > /* && mp->cmsg_len >= CMSG_LEN(sizeof(int)) */ > ) { > hoplimit = *(int*)CMSG_DATA(mp); > } > } > unpack6(packet, c, &from, hoplimit); > if (pingcount > 0 && nreceived >= pingcount) > break; > } > } > #endif > > static void ping(len_and_sockaddr *lsa) > { > printf("PING %s (%s)", hostname, dotted); > if (source_lsa) { > printf(" from %s", > xmalloc_sockaddr2dotted_noport(&lsa->sa, lsa->len)); > } > printf(": %d data bytes\n", datalen); > > #if ENABLE_PING6 > if (lsa->sa.sa_family == AF_INET6) > ping6(lsa); > else > #endif > ping4(lsa); > } > > int ping_main(int argc, char **argv); > int ping_main(int argc, char **argv) > { > len_and_sockaddr *lsa; > char *opt_c, *opt_s, *opt_I; > USE_PING6(sa_family_t af = AF_UNSPEC;) > > datalen = DEFDATALEN; /* initialized here rather than in global scope to work around gcc bug */ > > /* exactly one argument needed, -v and -q don't mix */ > opt_complementary = "=1:q--v:v--q"; > getopt32(argc, argv, OPT_STRING, &opt_c, &opt_s, &opt_I); > if (option_mask32 & OPT_c) pingcount = xatoul(opt_c); // -c > if (option_mask32 & OPT_s) datalen = xatou16(opt_s); // -s > if (option_mask32 & OPT_I) { // -I > if_index = if_nametoindex(opt_I); > if (!if_index) { > /* TODO: I'm not sure it takes IPv6 unless in [XX:XX..] format */ > /* (ping doesn't support source IPv6 addresses yet anyway) */ > source_lsa = xdotted2sockaddr(opt_I, 0); > } > } > myid = (int16_t) getpid(); > hostname = argv[optind]; > #if ENABLE_PING6 > if (option_mask32 & OPT_IPV4) > af = AF_INET; > if (option_mask32 & OPT_IPV6) > af = AF_INET6; > lsa = xhost_and_af2sockaddr(hostname, 0, af); > #else > lsa = xhost_and_af2sockaddr(hostname, 0, AF_INET); > #endif > > if (source_lsa && source_lsa->sa.sa_family != lsa->sa.sa_family) > /* leaking it here... */ > source_lsa = NULL; > > dotted = xmalloc_sockaddr2dotted_noport(&lsa->sa, lsa->len); > ping(lsa); > pingstats(0); > return EXIT_SUCCESS; > } > #endif /* FEATURE_FANCY_PING */ > > > #if ENABLE_PING6 > int ping6_main(int argc, char **argv); > int ping6_main(int argc, char **argv) > { > argv[0] = (char*)"-6"; > return ping_main(argc + 1, argv - 1); > } > #endif > > /* from ping6.c: > * Copyright (c) 1989 The Regents of the University of California. > * All rights reserved. > * > * This code is derived from software contributed to Berkeley by > * Mike Muuss. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions > * are met: > * 1. Redistributions of source code must retain the above copyright > * notice, this list of conditions and the following disclaimer. > * 2. Redistributions in binary form must reproduce the above copyright > * notice, this list of conditions and the following disclaimer in the > * documentation and/or other materials provided with the distribution. > * > * 3. * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change> > * > * 4. Neither the name of the University nor the names of its contributors > * may be used to endorse or promote products derived from this software > * without specific prior written permission. > * > * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND > * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE > * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > * SUCH DAMAGE. > */ From natanael.copa at gmail.com Thu Mar 1 05:23:17 2007 From: natanael.copa at gmail.com (Natanael Copa) Date: Thu, 01 Mar 2007 14:23:17 +0100 Subject: CONFIG_FEATURE_SH_STANDALONE_SHELL is sometimes forced in busybox-1.4.1? Message-ID: <1172755397.27284.93.camel@localhost> Hi, I have an interesting bug/feature reported by a user. I run a linux/uclibc/busybox distro and I have provided native packages like coreutils iproute2 as a packages that you can install if you need the GNU stuff. So I have the SH_STANDALONE_SHELL disabled to allow $PATH rule over busybox internals. # CONFIG_FEATURE_SH_STANDALONE_SHELL is not set In most cases this seems to work just fine. Install a package and the native verison will be used. Now a user just reported that when coreutils is installed the busybox version of 'cat' is always used, unless he write the full path /bin/cat. I verified and its true. So I checked more applets. Many applets will just run the native version but a few will always run the busybox applet. the complete list: bin/cat bin/chmod bin/chown bin/cp bin/cut bin/dd bin/echo (is ok since I have said to ash to use internal echo) bin/false bin/ln bin/ls bin/mkdir bin/pwd bin/rm bin/sort bin/touch bin/true I'm not sure if it has anything to with this but it seems like all those has a link in /usr/bin as well. Full config is attatched. -------------- next part -------------- # # Automatically generated make config: don't edit # Busybox version: 1.4.1 # Mon Feb 26 10:56:18 2007 # CONFIG_HAVE_DOT_CONFIG=y # # Busybox Settings # # # General Configuration # CONFIG_NITPICK=y CONFIG_DESKTOP=y CONFIG_FEATURE_BUFFERS_USE_MALLOC=y # CONFIG_FEATURE_BUFFERS_GO_ON_STACK is not set # CONFIG_FEATURE_BUFFERS_GO_IN_BSS is not set CONFIG_SHOW_USAGE=y CONFIG_FEATURE_VERBOSE_USAGE=y CONFIG_FEATURE_COMPRESS_USAGE=y CONFIG_FEATURE_INSTALLER=y # CONFIG_LOCALE_SUPPORT is not set CONFIG_GETOPT_LONG=y CONFIG_FEATURE_DEVPTS=y # CONFIG_FEATURE_CLEAN_UP is not set CONFIG_FEATURE_SUID=y CONFIG_FEATURE_SYSLOG=y # CONFIG_FEATURE_SUID_CONFIG is not set # CONFIG_FEATURE_SUID_CONFIG_QUIET is not set CONFIG_FEATURE_HAVE_RPC=y # CONFIG_SELINUX is not set CONFIG_BUSYBOX_EXEC_PATH="/proc/self/exe" # # Build Options # # CONFIG_STATIC is not set # CONFIG_BUILD_LIBBUSYBOX is not set # CONFIG_FEATURE_FULL_LIBBUSYBOX is not set # CONFIG_FEATURE_SHARED_BUSYBOX is not set CONFIG_LFS=y # CONFIG_BUILD_AT_ONCE is not set # # Debugging Options # # CONFIG_DEBUG is not set # CONFIG_DEBUG_PESSIMIZE is not set # CONFIG_NO_DEBUG_LIB is not set # CONFIG_DMALLOC is not set # CONFIG_EFENCE is not set # CONFIG_INCLUDE_SUSv2 is not set # # Installation Options # # CONFIG_INSTALL_NO_USR is not set CONFIG_INSTALL_APPLET_SYMLINKS=y # CONFIG_INSTALL_APPLET_HARDLINKS is not set # CONFIG_INSTALL_APPLET_DONT is not set CONFIG_PREFIX="./_install" # # Busybox Library Tuning # CONFIG_PASSWORD_MINLEN=6 CONFIG_MD5_SIZE_VS_SPEED=0 # # Applets # # # Archival Utilities # CONFIG_AR=y CONFIG_FEATURE_AR_LONG_FILENAMES=y CONFIG_BUNZIP2=y CONFIG_CPIO=y # CONFIG_DPKG is not set # CONFIG_DPKG_DEB is not set # CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set CONFIG_GUNZIP=y CONFIG_FEATURE_GUNZIP_UNCOMPRESS=y CONFIG_GZIP=y # CONFIG_RPM2CPIO is not set # CONFIG_RPM is not set CONFIG_TAR=y CONFIG_FEATURE_TAR_CREATE=y CONFIG_FEATURE_TAR_BZIP2=y CONFIG_FEATURE_TAR_LZMA=y CONFIG_FEATURE_TAR_FROM=y CONFIG_FEATURE_TAR_GZIP=y CONFIG_FEATURE_TAR_COMPRESS=y CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY=y CONFIG_FEATURE_TAR_GNU_EXTENSIONS=y # CONFIG_FEATURE_TAR_LONG_OPTIONS is not set CONFIG_UNCOMPRESS=y CONFIG_UNLZMA=y CONFIG_FEATURE_LZMA_FAST=y CONFIG_UNZIP=y # # Common options for cpio and tar # CONFIG_FEATURE_UNARCHIVE_TAPE=y # CONFIG_FEATURE_DEB_TAR_GZ is not set # CONFIG_FEATURE_DEB_TAR_BZ2 is not set # CONFIG_FEATURE_DEB_TAR_LZMA is not set # # Coreutils # CONFIG_BASENAME=y CONFIG_CAL=y CONFIG_CAT=y CONFIG_CATV=y CONFIG_CHGRP=y CONFIG_CHMOD=y CONFIG_CHOWN=y CONFIG_CHROOT=y CONFIG_CKSUM=y CONFIG_CMP=y CONFIG_COMM=y CONFIG_CP=y CONFIG_CUT=y CONFIG_DATE=y CONFIG_FEATURE_DATE_ISOFMT=y CONFIG_DD=y CONFIG_FEATURE_DD_SIGNAL_HANDLING=y CONFIG_FEATURE_DD_IBS_OBS=y CONFIG_DF=y CONFIG_DIFF=y CONFIG_FEATURE_DIFF_BINARY=y CONFIG_FEATURE_DIFF_DIR=y CONFIG_FEATURE_DIFF_MINIMAL=y CONFIG_DIRNAME=y CONFIG_DOS2UNIX=y CONFIG_UNIX2DOS=y CONFIG_DU=y CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K=y CONFIG_ECHO=y CONFIG_FEATURE_FANCY_ECHO=y CONFIG_ENV=y # CONFIG_FEATURE_ENV_LONG_OPTIONS is not set CONFIG_EXPR=y CONFIG_EXPR_MATH_SUPPORT_64=y CONFIG_FALSE=y CONFIG_FOLD=y CONFIG_HEAD=y CONFIG_FEATURE_FANCY_HEAD=y CONFIG_HOSTID=y CONFIG_ID=y CONFIG_INSTALL=y # CONFIG_FEATURE_INSTALL_LONG_OPTIONS is not set CONFIG_LENGTH=y CONFIG_LN=y # CONFIG_LOGNAME is not set CONFIG_LS=y CONFIG_FEATURE_LS_FILETYPES=y CONFIG_FEATURE_LS_FOLLOWLINKS=y CONFIG_FEATURE_LS_RECURSIVE=y CONFIG_FEATURE_LS_SORTFILES=y CONFIG_FEATURE_LS_TIMESTAMPS=y CONFIG_FEATURE_LS_USERNAME=y CONFIG_FEATURE_LS_COLOR=y CONFIG_FEATURE_LS_COLOR_IS_DEFAULT=y CONFIG_MD5SUM=y CONFIG_MKDIR=y # CONFIG_FEATURE_MKDIR_LONG_OPTIONS is not set CONFIG_MKFIFO=y CONFIG_MKNOD=y CONFIG_MV=y # CONFIG_FEATURE_MV_LONG_OPTIONS is not set CONFIG_NICE=y CONFIG_NOHUP=y # CONFIG_OD is not set CONFIG_PRINTENV=y CONFIG_PRINTF=y CONFIG_PWD=y CONFIG_REALPATH=y CONFIG_RM=y CONFIG_RMDIR=y CONFIG_SEQ=y CONFIG_SHA1SUM=y CONFIG_SLEEP=y CONFIG_FEATURE_FANCY_SLEEP=y CONFIG_SORT=y CONFIG_FEATURE_SORT_BIG=y CONFIG_STAT=y CONFIG_FEATURE_STAT_FORMAT=y CONFIG_STTY=y CONFIG_SUM=y CONFIG_SYNC=y CONFIG_TAIL=y CONFIG_FEATURE_FANCY_TAIL=y CONFIG_TEE=y CONFIG_FEATURE_TEE_USE_BLOCK_IO=y CONFIG_TEST=y CONFIG_FEATURE_TEST_64=y CONFIG_TOUCH=y CONFIG_TR=y CONFIG_FEATURE_TR_CLASSES=y CONFIG_FEATURE_TR_EQUIV=y CONFIG_TRUE=y CONFIG_TTY=y CONFIG_UNAME=y CONFIG_UNIQ=y CONFIG_USLEEP=y # CONFIG_UUDECODE is not set CONFIG_UUENCODE=y CONFIG_WATCH=y CONFIG_WC=y # CONFIG_FEATURE_WC_LARGE is not set CONFIG_WHO=y CONFIG_WHOAMI=y CONFIG_YES=y # # Common options for cp and mv # CONFIG_FEATURE_PRESERVE_HARDLINKS=y # # Common options for ls, more and telnet # CONFIG_FEATURE_AUTOWIDTH=y # # Common options for df, du, ls # CONFIG_FEATURE_HUMAN_READABLE=y # # Common options for md5sum, sha1sum # CONFIG_FEATURE_MD5_SHA1_SUM_CHECK=y # # Console Utilities # CONFIG_CHVT=y CONFIG_CLEAR=y CONFIG_DEALLOCVT=y CONFIG_DUMPKMAP=y CONFIG_LOADFONT=y CONFIG_LOADKMAP=y CONFIG_OPENVT=y CONFIG_RESET=y CONFIG_RESIZE=y CONFIG_FEATURE_RESIZE_PRINT=y CONFIG_SETCONSOLE=y # CONFIG_FEATURE_SETCONSOLE_LONG_OPTIONS is not set CONFIG_SETKEYCODES=y CONFIG_SETLOGCONS=y # # Debian Utilities # CONFIG_MKTEMP=y CONFIG_PIPE_PROGRESS=y CONFIG_READLINK=y CONFIG_FEATURE_READLINK_FOLLOW=y CONFIG_RUN_PARTS=y CONFIG_FEATURE_RUN_PARTS_LONG_OPTIONS=y CONFIG_START_STOP_DAEMON=y CONFIG_FEATURE_START_STOP_DAEMON_FANCY=y CONFIG_FEATURE_START_STOP_DAEMON_LONG_OPTIONS=y CONFIG_WHICH=y # # Editors # CONFIG_AWK=y CONFIG_FEATURE_AWK_MATH=y # CONFIG_ED is not set CONFIG_PATCH=y CONFIG_SED=y CONFIG_VI=y CONFIG_FEATURE_VI_COLON=y CONFIG_FEATURE_VI_YANKMARK=y CONFIG_FEATURE_VI_SEARCH=y CONFIG_FEATURE_VI_USE_SIGNALS=y CONFIG_FEATURE_VI_DOT_CMD=y CONFIG_FEATURE_VI_READONLY=y CONFIG_FEATURE_VI_SETOPTS=y CONFIG_FEATURE_VI_SET=y CONFIG_FEATURE_VI_WIN_RESIZE=y CONFIG_FEATURE_VI_OPTIMIZE_CURSOR=y CONFIG_FEATURE_ALLOW_EXEC=y # # Finding Utilities # CONFIG_FIND=y CONFIG_FEATURE_FIND_PRINT0=y CONFIG_FEATURE_FIND_MTIME=y CONFIG_FEATURE_FIND_MMIN=y CONFIG_FEATURE_FIND_PERM=y CONFIG_FEATURE_FIND_TYPE=y CONFIG_FEATURE_FIND_XDEV=y CONFIG_FEATURE_FIND_NEWER=y CONFIG_FEATURE_FIND_INUM=y CONFIG_FEATURE_FIND_EXEC=y CONFIG_FEATURE_FIND_USER=y CONFIG_FEATURE_FIND_NOT=y CONFIG_GREP=y CONFIG_FEATURE_GREP_EGREP_ALIAS=y CONFIG_FEATURE_GREP_FGREP_ALIAS=y CONFIG_FEATURE_GREP_CONTEXT=y CONFIG_XARGS=y CONFIG_FEATURE_XARGS_SUPPORT_CONFIRMATION=y CONFIG_FEATURE_XARGS_SUPPORT_QUOTES=y CONFIG_FEATURE_XARGS_SUPPORT_TERMOPT=y CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y # # Init Utilities # CONFIG_INIT=y # CONFIG_DEBUG_INIT is not set CONFIG_FEATURE_USE_INITTAB=y CONFIG_FEATURE_INIT_SCTTY=y CONFIG_FEATURE_EXTRA_QUIET=y # CONFIG_FEATURE_INIT_COREDUMPS is not set CONFIG_FEATURE_INITRD=y CONFIG_HALT=y CONFIG_MESG=y # # Login/Password Management Utilities # CONFIG_FEATURE_SHADOWPASSWDS=y CONFIG_USE_BB_SHADOW=y CONFIG_USE_BB_PWD_GRP=y CONFIG_ADDGROUP=y CONFIG_DELGROUP=y CONFIG_ADDUSER=y CONFIG_DELUSER=y CONFIG_GETTY=y CONFIG_FEATURE_UTMP=y CONFIG_FEATURE_WTMP=y CONFIG_LOGIN=y CONFIG_LOGIN_SCRIPTS=y CONFIG_FEATURE_SECURETTY=y CONFIG_PASSWD=y CONFIG_FEATURE_PASSWD_WEAK_CHECK=y CONFIG_SU=y CONFIG_FEATURE_SU_SYSLOG=y CONFIG_FEATURE_SU_CHECKS_SHELLS=y # CONFIG_SULOGIN is not set CONFIG_VLOCK=y # # Linux Ext2 FS Progs # # CONFIG_CHATTR is not set # CONFIG_FSCK is not set # CONFIG_LSATTR is not set # # Linux Module Utilities # CONFIG_INSMOD=y # CONFIG_FEATURE_INSMOD_VERSION_CHECKING is not set # CONFIG_FEATURE_INSMOD_KSYMOOPS_SYMBOLS is not set # CONFIG_FEATURE_INSMOD_LOADINKMEM is not set # CONFIG_FEATURE_INSMOD_LOAD_MAP is not set # CONFIG_FEATURE_INSMOD_LOAD_MAP_FULL is not set CONFIG_RMMOD=y CONFIG_LSMOD=y CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT=y CONFIG_MODPROBE=y CONFIG_FEATURE_MODPROBE_MULTIPLE_OPTIONS=y CONFIG_FEATURE_MODPROBE_FANCY_ALIAS=y # # Options common to multiple modutils # CONFIG_FEATURE_CHECK_TAINTED_MODULE=y # CONFIG_FEATURE_2_4_MODULES is not set CONFIG_FEATURE_2_6_MODULES=y # CONFIG_FEATURE_QUERY_MODULE_INTERFACE is not set # # Linux System Utilities # CONFIG_DMESG=y CONFIG_FEATURE_DMESG_PRETTY=y CONFIG_FBSET=y CONFIG_FEATURE_FBSET_FANCY=y CONFIG_FEATURE_FBSET_READMODE=y CONFIG_FDFLUSH=y CONFIG_FDFORMAT=y CONFIG_FDISK=y CONFIG_FDISK_SUPPORT_LARGE_DISKS=y CONFIG_FEATURE_FDISK_WRITABLE=y CONFIG_FEATURE_AIX_LABEL=y CONFIG_FEATURE_SGI_LABEL=y CONFIG_FEATURE_SUN_LABEL=y CONFIG_FEATURE_OSF_LABEL=y CONFIG_FEATURE_FDISK_ADVANCED=y CONFIG_FREERAMDISK=y # CONFIG_FSCK_MINIX is not set # CONFIG_MKFS_MINIX is not set # CONFIG_FEATURE_MINIX2 is not set CONFIG_GETOPT=y CONFIG_HEXDUMP=y CONFIG_HWCLOCK=y # CONFIG_FEATURE_HWCLOCK_LONG_OPTIONS is not set CONFIG_FEATURE_HWCLOCK_ADJTIME_FHS=y CONFIG_IPCRM=y CONFIG_IPCS=y CONFIG_LOSETUP=y CONFIG_MDEV=y CONFIG_FEATURE_MDEV_CONF=y CONFIG_FEATURE_MDEV_EXEC=y CONFIG_MKSWAP=y # CONFIG_FEATURE_MKSWAP_V0 is not set CONFIG_MORE=y CONFIG_FEATURE_USE_TERMIOS=y CONFIG_MOUNT=y CONFIG_FEATURE_MOUNT_NFS=y CONFIG_FEATURE_MOUNT_CIFS=y CONFIG_FEATURE_MOUNT_FLAGS=y CONFIG_FEATURE_MOUNT_FSTAB=y # CONFIG_PIVOT_ROOT is not set CONFIG_RDATE=y CONFIG_READPROFILE=y # CONFIG_SETARCH is not set CONFIG_SWAPONOFF=y # CONFIG_SWITCH_ROOT is not set CONFIG_UMOUNT=y CONFIG_FEATURE_UMOUNT_ALL=y # # Common options for mount/umount # CONFIG_FEATURE_MOUNT_LOOP=y # CONFIG_FEATURE_MTAB_SUPPORT is not set # # Miscellaneous Utilities # CONFIG_ADJTIMEX=y CONFIG_BBCONFIG=y CONFIG_CROND=y # CONFIG_DEBUG_CROND_OPTION is not set CONFIG_FEATURE_CROND_CALL_SENDMAIL=y CONFIG_CRONTAB=y CONFIG_DC=y # CONFIG_DEVFSD is not set # CONFIG_DEVFSD_MODLOAD is not set # CONFIG_DEVFSD_FG_NP is not set # CONFIG_DEVFSD_VERBOSE is not set # CONFIG_FEATURE_DEVFS is not set CONFIG_EJECT=y CONFIG_LAST=y CONFIG_LESS=y CONFIG_FEATURE_LESS_MAXLINES=9999999 CONFIG_FEATURE_LESS_BRACKETS=y CONFIG_FEATURE_LESS_FLAGS=y CONFIG_FEATURE_LESS_FLAGCS=y CONFIG_FEATURE_LESS_MARKS=y CONFIG_FEATURE_LESS_REGEXP=y # CONFIG_HDPARM is not set # CONFIG_FEATURE_HDPARM_GET_IDENTITY is not set # CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF is not set # CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF is not set # CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET is not set # CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF is not set # CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA is not set CONFIG_MAKEDEVS=y # CONFIG_FEATURE_MAKEDEVS_LEAF is not set CONFIG_FEATURE_MAKEDEVS_TABLE=y CONFIG_MOUNTPOINT=y CONFIG_MT=y CONFIG_NMETER=y CONFIG_RAIDAUTORUN=y CONFIG_READAHEAD=y CONFIG_RUNLEVEL=y CONFIG_RX=y CONFIG_STRINGS=y CONFIG_SETSID=y # CONFIG_TASKSET is not set # CONFIG_FEATURE_TASKSET_FANCY is not set CONFIG_TIME=y CONFIG_WATCHDOG=y # # Networking Utilities # CONFIG_FEATURE_IPV6=y CONFIG_ARP=y CONFIG_ARPING=y # CONFIG_DNSD is not set CONFIG_ETHER_WAKE=y CONFIG_FAKEIDENTD=y # CONFIG_FTPGET is not set # CONFIG_FTPPUT is not set # CONFIG_FEATURE_FTPGETPUT_LONG_OPTIONS is not set CONFIG_HOSTNAME=y CONFIG_HTTPD=y # CONFIG_FEATURE_HTTPD_RELOAD_CONFIG_SIGHUP is not set CONFIG_FEATURE_HTTPD_SETUID=y CONFIG_FEATURE_HTTPD_BASIC_AUTH=y CONFIG_FEATURE_HTTPD_AUTH_MD5=y CONFIG_FEATURE_HTTPD_CONFIG_WITH_MIME_TYPES=y CONFIG_FEATURE_HTTPD_CGI=y CONFIG_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR=y CONFIG_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV=y CONFIG_FEATURE_HTTPD_ENCODE_URL_STR=y CONFIG_IFCONFIG=y CONFIG_FEATURE_IFCONFIG_STATUS=y CONFIG_FEATURE_IFCONFIG_SLIP=y CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ=y CONFIG_FEATURE_IFCONFIG_HW=y CONFIG_FEATURE_IFCONFIG_BROADCAST_PLUS=y CONFIG_IFUPDOWN=y CONFIG_FEATURE_IFUPDOWN_IP=y CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN=y # CONFIG_FEATURE_IFUPDOWN_IFCONFIG_BUILTIN is not set CONFIG_FEATURE_IFUPDOWN_IPV4=y CONFIG_FEATURE_IFUPDOWN_IPV6=y # CONFIG_FEATURE_IFUPDOWN_IPX is not set # CONFIG_FEATURE_IFUPDOWN_MAPPING is not set CONFIG_INETD=y # CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_ECHO is not set # CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD is not set # CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_TIME is not set # CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME is not set # CONFIG_FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN is not set # CONFIG_FEATURE_INETD_RPC is not set CONFIG_IP=y CONFIG_FEATURE_IP_ADDRESS=y CONFIG_FEATURE_IP_LINK=y CONFIG_FEATURE_IP_ROUTE=y CONFIG_FEATURE_IP_TUNNEL=y CONFIG_FEATURE_IP_RULE=y CONFIG_FEATURE_IP_SHORT_FORMS=y CONFIG_IPADDR=y CONFIG_IPLINK=y CONFIG_IPROUTE=y CONFIG_IPTUNNEL=y CONFIG_IPRULE=y CONFIG_IPCALC=y CONFIG_FEATURE_IPCALC_FANCY=y # CONFIG_FEATURE_IPCALC_LONG_OPTIONS is not set CONFIG_NAMEIF=y CONFIG_NC=y CONFIG_NC_SERVER=y CONFIG_NC_EXTRA=y CONFIG_NETSTAT=y CONFIG_NSLOOKUP=y CONFIG_PING=y CONFIG_FEATURE_FANCY_PING=y CONFIG_PING6=y CONFIG_FEATURE_FANCY_PING6=y CONFIG_ROUTE=y CONFIG_TELNET=y CONFIG_FEATURE_TELNET_TTYPE=y CONFIG_FEATURE_TELNET_AUTOLOGIN=y # CONFIG_TELNETD is not set # CONFIG_FEATURE_TELNETD_STANDALONE is not set # CONFIG_TFTP is not set # CONFIG_FEATURE_TFTP_GET is not set # CONFIG_FEATURE_TFTP_PUT is not set # CONFIG_FEATURE_TFTP_BLOCKSIZE is not set # CONFIG_DEBUG_TFTP is not set CONFIG_TRACEROUTE=y CONFIG_FEATURE_TRACEROUTE_VERBOSE=y CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE=y CONFIG_FEATURE_TRACEROUTE_USE_ICMP=y CONFIG_APP_UDHCPD=y CONFIG_APP_DHCPRELAY=y CONFIG_APP_DUMPLEASES=y CONFIG_APP_UDHCPC=y CONFIG_FEATURE_UDHCP_SYSLOG=y # CONFIG_FEATURE_UDHCP_DEBUG is not set CONFIG_VCONFIG=y CONFIG_WGET=y CONFIG_FEATURE_WGET_STATUSBAR=y CONFIG_FEATURE_WGET_AUTHENTICATION=y CONFIG_FEATURE_WGET_IP6_LITERAL=y # CONFIG_FEATURE_WGET_LONG_OPTIONS is not set CONFIG_ZCIP=y # # Process Utilities # CONFIG_FREE=y CONFIG_FUSER=y CONFIG_KILL=y CONFIG_KILLALL=y CONFIG_KILLALL5=y CONFIG_PIDOF=y CONFIG_FEATURE_PIDOF_SINGLE=y CONFIG_FEATURE_PIDOF_OMIT=y CONFIG_PS=y CONFIG_FEATURE_PS_WIDE=y CONFIG_RENICE=y CONFIG_BB_SYSCTL=y CONFIG_TOP=y CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y CONFIG_UPTIME=y # # Shells # CONFIG_FEATURE_SH_IS_ASH=y # CONFIG_FEATURE_SH_IS_HUSH is not set # CONFIG_FEATURE_SH_IS_LASH is not set # CONFIG_FEATURE_SH_IS_MSH is not set # CONFIG_FEATURE_SH_IS_NONE is not set CONFIG_ASH=y # # Ash Shell Options # CONFIG_ASH_JOB_CONTROL=y CONFIG_ASH_READ_NCHARS=y CONFIG_ASH_READ_TIMEOUT=y CONFIG_ASH_ALIAS=y CONFIG_ASH_MATH_SUPPORT=y CONFIG_ASH_MATH_SUPPORT_64=y CONFIG_ASH_GETOPTS=y CONFIG_ASH_BUILTIN_ECHO=y CONFIG_ASH_BUILTIN_TEST=y CONFIG_ASH_CMDCMD=y CONFIG_ASH_MAIL=y CONFIG_ASH_OPTIMIZE_FOR_SIZE=y CONFIG_ASH_RANDOM_SUPPORT=y CONFIG_ASH_EXPAND_PRMT=y # CONFIG_HUSH is not set # CONFIG_LASH is not set # CONFIG_MSH is not set # # Bourne Shell Options # CONFIG_FEATURE_SH_EXTRA_QUIET=y # CONFIG_FEATURE_SH_STANDALONE_SHELL is not set CONFIG_FEATURE_COMMAND_EDITING=y CONFIG_FEATURE_COMMAND_EDITING_VI=y CONFIG_FEATURE_COMMAND_HISTORY=31 CONFIG_FEATURE_COMMAND_SAVEHISTORY=y CONFIG_FEATURE_COMMAND_TAB_COMPLETION=y CONFIG_FEATURE_COMMAND_USERNAME_COMPLETION=y CONFIG_FEATURE_SH_FANCY_PROMPT=y # # System Logging Utilities # CONFIG_SYSLOGD=y CONFIG_FEATURE_ROTATE_LOGFILE=y CONFIG_FEATURE_REMOTE_LOG=y CONFIG_FEATURE_IPC_SYSLOG=y CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=16 CONFIG_LOGREAD=y CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING=y CONFIG_KLOGD=y CONFIG_LOGGER=y # # Runit Utilities # # CONFIG_RUNSV is not set # CONFIG_RUNSVDIR is not set # CONFIG_SV is not set # CONFIG_SVLOGD is not set # CONFIG_CHPST is not set # CONFIG_SETUIDGID is not set # CONFIG_ENVUIDGID is not set # CONFIG_ENVDIR is not set # CONFIG_SOFTLIMIT is not set From vda.linux at googlemail.com Thu Mar 1 14:01:28 2007 From: vda.linux at googlemail.com (Denis Vlasenko) Date: Thu, 1 Mar 2007 23:01:28 +0100 Subject: CONFIG_FEATURE_SH_STANDALONE_SHELL is sometimes forced in busybox-1.4.1? In-Reply-To: <1172755397.27284.93.camel@localhost> References: <1172755397.27284.93.camel@localhost> Message-ID: <200703012301.28301.vda.linux@googlemail.com> On Thursday 01 March 2007 14:23, Natanael Copa wrote: > Hi, > > I have an interesting bug/feature reported by a user. > > I run a linux/uclibc/busybox distro and I have provided native packages > like coreutils iproute2 as a packages that you can install if you need > the GNU stuff. > > So I have the SH_STANDALONE_SHELL disabled to allow $PATH rule over > busybox internals. > > # CONFIG_FEATURE_SH_STANDALONE_SHELL is not set > > In most cases this seems to work just fine. Install a package and the > native verison will be used. > > Now a user just reported that when coreutils is installed the busybox > version of 'cat' is always used, unless he write the full path /bin/cat. > > I verified and its true. So I checked more applets. Many applets will > just run the native version but a few will always run the busybox > applet. the complete list: > > bin/cat > bin/chmod > bin/chown > bin/cp > bin/cut > bin/dd > bin/echo (is ok since I have said to ash to use internal echo) > bin/false > bin/ln > bin/ls > bin/mkdir > bin/pwd > bin/rm > bin/sort > bin/touch > bin/true Obviously, it is caused by this in ash.c: static int is_safe_applet(char *name) { /* It isn't a bug to have non-existent applet here... */ /* ...just a waste of space... */ static const char safe_applets[][8] = { "[" USE_AWK (, "awk" ) USE_CAT (, "cat" ) USE_CHMOD (, "chmod" ) USE_CHOWN (, "chown" ) USE_CP (, "cp" ) USE_CUT (, "cut" ) USE_DD (, "dd" ) USE_ECHO (, "echo" ) USE_FIND (, "find" ) USE_HEXDUMP(, "hexdump") USE_LN (, "ln" ) USE_LS (, "ls" ) USE_MKDIR (, "mkdir" ) USE_RM (, "rm" ) USE_SORT (, "sort" ) USE_TEST (, "test" ) USE_TOUCH (, "touch" ) USE_XARGS (, "xargs" ) }; int n = sizeof(safe_applets) / sizeof(safe_applets[0]); int i; for (i = 0; i < n; i++) if (strcmp(safe_applets[i], name) == 0) return 1; return 0; } I propose making "safe applets" usage dependent on FEATURE_SH_STANDALONE_SHELL too. [ What is "safe applet": "safe applets" are not exec'ed. we just call their _main() ] -- vda From vda.linux at googlemail.com Thu Mar 1 14:23:26 2007 From: vda.linux at googlemail.com (Denis Vlasenko) Date: Thu, 1 Mar 2007 23:23:26 +0100 Subject: [PATCH] ping.c : fix min/max packet size usage In-Reply-To: <45E69B8E.6010201@alphacore.net> References: <45E5DB9F.2030704@alphacore.net> <200703010014.19437.vda.linux@googlemail.com> <45E69B8E.6010201@alphacore.net> Message-ID: <200703012323.26398.vda.linux@googlemail.com> On Thursday 01 March 2007 10:23, Florian Fainelli wrote: > Hi Denis, > > Here is the rediff against the file you sent me, thanks for considering > this patch. Unfortunately, it introduces a regression: unpatched: # ./busybox ping -s 1000 127.0.0.1 PING 127.0.0.1 (127.0.0.1): 1000 data bytes 1008 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.0 ms 1008 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.0 ms 1008 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.0 ms 1008 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.0 ms patched: # ./busybox ping -s 1000 127.0.0.1 PING 127.0.0.1 (127.0.0.1): 1000 data bytes ^C --- 127.0.0.1 ping statistics --- 4 packets transmitted, 0 packets received, 100% packet loss -- vda From natanael.copa at gmail.com Thu Mar 1 16:43:18 2007 From: natanael.copa at gmail.com (Natanael Copa) Date: Fri, 02 Mar 2007 01:43:18 +0100 Subject: CONFIG_FEATURE_SH_STANDALONE_SHELL is sometimes forced in busybox-1.4.1? In-Reply-To: <200703012301.28301.vda.linux@googlemail.com> References: <1172755397.27284.93.camel@localhost> <200703012301.28301.vda.linux@googlemail.com> Message-ID: <1172796198.15130.4.camel@studio> On Thu, 2007-03-01 at 23:01 +0100, Denis Vlasenko wrote: > On Thursday 01 March 2007 14:23, Natanael Copa wrote: > > Hi, > > > Obviously, it is caused by this in ash.c: > > static int is_safe_applet(char *name) > { ... > I propose making "safe applets" usage dependent on > FEATURE_SH_STANDALONE_SHELL too. Sounds very good. > > [ What is "safe applet": > "safe applets" are not exec'ed. we just call their > _main() ] > -- > vda From natanael.copa at gmail.com Thu Mar 1 16:57:08 2007 From: natanael.copa at gmail.com (Natanael Copa) Date: Fri, 02 Mar 2007 01:57:08 +0100 Subject: serial console and log-in In-Reply-To: <200703010026.56844.vda.linux@googlemail.com> References: <20070220145025.bfc52cea95091b0fffcb409eab6296ba.c4ccc45496.wbe@email.secureserver.net> <200702272040.22024.vda.linux@googlemail.com> <1172674255.27284.58.camel@localhost> <200703010026.56844.vda.linux@googlemail.com> Message-ID: <1172797028.15130.13.camel@studio> On Thu, 2007-03-01 at 00:26 +0100, Denis Vlasenko wrote: > How about writing small hack which analyzes stdin (fd #0) > and closes fd #0,1,2 + reopens/dups /dev/ttyN or /dev/ttySn: ... > then exec it's argv? > > Use it like this: > > ::respawn:/somewhere/cttyhack /sbin/getty - 9600 vt100 > > Care to try? ;) Sounds good. I'll give it a shot. Thanks alot. Natanael Copa From strange at nsk.no-ip.org Thu Mar 1 17:35:00 2007 From: strange at nsk.no-ip.org (Luciano Miguel Ferreira Rocha) Date: Fri, 2 Mar 2007 01:35:00 +0000 Subject: serial console and log-in In-Reply-To: <1172797028.15130.13.camel@studio> References: <20070220145025.bfc52cea95091b0fffcb409eab6296ba.c4ccc45496.wbe@email.secureserver.net> <200702272040.22024.vda.linux@googlemail.com> <1172674255.27284.58.camel@localhost> <200703010026.56844.vda.linux@googlemail.com> <1172797028.15130.13.camel@studio> Message-ID: <20070302013500.GA30901@nsk.no-ip.org> On Fri, Mar 02, 2007 at 01:57:08AM +0100, Natanael Copa wrote: > On Thu, 2007-03-01 at 00:26 +0100, Denis Vlasenko wrote: > > > How about writing small hack which analyzes stdin (fd #0) > > and closes fd #0,1,2 + reopens/dups /dev/ttyN or /dev/ttySn: > > ... > > > then exec it's argv? > > > > Use it like this: > > > > ::respawn:/somewhere/cttyhack /sbin/getty - 9600 vt100 > > > > Care to try? ;) > > Sounds good. I'll give it a shot. Thanks alot. Well, if it's external to init, you can also grep for console= in /proc/cmdline. -- lfr 0/0 -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://busybox.net/lists/busybox/attachments/20070302/f70bc544/attachment.pgp From birju_shah0 at yahoo.com Thu Mar 1 17:54:19 2007 From: birju_shah0 at yahoo.com (Birju Shah) Date: Thu, 1 Mar 2007 17:54:19 -0800 (PST) Subject: uClibc-0.9.28 and NPTL Message-ID: <20070302015419.68237.qmail@web55201.mail.re4.yahoo.com> hey does anyone know if uClibc-0.9.28 supports NPTL on powerpc and x86? I have buildroot and I see an option for NPTL support but it doesnt seem to work. thanks birju ____________________________________________________________________________________ Bored stiff? Loosen up... Download and play hundreds of games for free on Yahoo! Games. http://games.yahoo.com/games/front From natanael.copa at gmail.com Thu Mar 1 22:49:50 2007 From: natanael.copa at gmail.com (Natanael Copa) Date: Fri, 02 Mar 2007 07:49:50 +0100 Subject: serial console and log-in In-Reply-To: <20070302013500.GA30901@nsk.no-ip.org> References: <20070220145025.bfc52cea95091b0fffcb409eab6296ba.c4ccc45496.wbe@email.secureserver.net> <200702272040.22024.vda.linux@googlemail.com> <1172674255.27284.58.camel@localhost> <200703010026.56844.vda.linux@googlemail.com> <1172797028.15130.13.camel@studio> <20070302013500.GA30901@nsk.no-ip.org> Message-ID: <1172818190.25655.5.camel@studio> On Fri, 2007-03-02 at 01:35 +0000, Luciano Miguel Ferreira Rocha wrote: > On Fri, Mar 02, 2007 at 01:57:08AM +0100, Natanael Copa wrote: > > On Thu, 2007-03-01 at 00:26 +0100, Denis Vlasenko wrote: > > > > > How about writing small hack which analyzes stdin (fd #0) > > > and closes fd #0,1,2 + reopens/dups /dev/ttyN or /dev/ttySn: > > > > ... > > > > > then exec it's argv? > > > > > > Use it like this: > > > > > > ::respawn:/somewhere/cttyhack /sbin/getty - 9600 vt100 > > > > > > Care to try? ;) > > > > Sounds good. I'll give it a shot. Thanks alot. > > Well, if it's external to init, you can also grep for console= in > /proc/cmdline. No I can't. The kernel will use ttyS0 automatically if no VGA card is found so you can guarantee that there is any console= at all on cmdline. Natanael From claus.klein at marconi.com Fri Mar 2 00:38:01 2007 From: claus.klein at marconi.com (Claus Klein) Date: Fri, 2 Mar 2007 09:38:01 +0100 Subject: sed: missing LF In-Reply-To: References: Message-ID: <200703020938.01495.claus.klein@marconi.com> On Wednesday, 28. February 2007 17:30, you wrote: > sed "/^ADDRESS/c\ADDRESS=1.2.3.4" Hallo, why use 'c\A...' from man page: c \ text Replace the selected lines with text, which has each embedded newline preceded by a backslash. --------- It is not clear to me if the \n should be embedded or not? Would it not better to use: sed -e 's/regexp/replacement/' filename -> sed -i -e 's/^ADDRESS.*$/ADDRESS=1.2.3.4/' filename That works fine: [root at bkvme2:~]# sed -e 's/^ADDRESS.*$/ADDRESS=1.2.3.4/' test.txt ADDRESS=1.2.3.4 NETMASK= GATEWAY= [root at bkvme2:~]# cat test.txt ADDRESS= NETMASK= GATEWAY= [root at bkvme2:~]# Claus Klein From hinko.kocevar at cetrtapot.si Fri Mar 2 04:08:55 2007 From: hinko.kocevar at cetrtapot.si (hinko.kocevar at cetrtapot.si) Date: Fri, 02 Mar 2007 13:08:55 +0100 Subject: Problem compiling for cris ARCH Message-ID: <45E813D7.1000801@cetrtapot.si> Hello, I'm tring to compile busybox-1.4.1 for cris architecture and it fails with: make -f scripts/Makefile.build obj=runit make -f scripts/Makefile.build obj=shell make -f scripts/Makefile.build obj=sysklogd make -f scripts/Makefile.build obj=util-linux /home/hinkok/delo/fw/car2_R1-uclibc.gen/pkg/busybox-R2/build/uclibc/static/scripts/trylink gcc_cris -mlinux -DLINUX -DLINUX_SYSTEM -D_REENTRANT -mno-mul-bug-workaround -muclibc=/home/hinkok/delo/fw/car2_R1-uclibc.gen/stage.uclibc -L/home/hinkok/delo/fw/car2_R1-uclibc.gen/stage.uclibc/lib -Wl,-rpath-link,/home/hinkok/delo/fw/car2_R1-uclibc.gen/stage.uclibc/lib -static -o busybox_unstripped -Wl,--warn-common -Wl,--sort-common -Wl,--start-group applets/built-in.o archival/lib.a archival/libunarchive/lib.a console-tools/lib.a coreutils/lib.a coreutils/libcoreutils/lib.a debianutils/lib.a e2fsprogs/lib.a editors/lib.a findutils/lib.a init/lib.a libbb/lib.a libpwdgrp/lib.a loginutils/lib.a miscutils/lib.a modutils/lib.a networking/lib.a networking/libiproute/lib.a networking/udhcp/lib.a procps/lib.a runit/lib.a shell/lib.a sysklogd/lib.a util-linux/lib.a archival/built-in.o archival/libunarchive/built-in.o console-tools/built-in.o coreutils/built-in.o coreutils/libcoreutils/built-in.o debianutils/built-in.o e2fsprogs/built-in.o editors/built-in.o findutils/built-in.o init/built-in.o libbb/built-in.o libpwdgrp/built-in.o loginutils/built-in.o miscutils/built-in.o modutils/built-in.o networking/built-in.o networking/libiproute/built-in.o networking/udhcp/built-in.o procps/built-in.o runit/built-in.o shell/built-in.o sysklogd/built-in.o util-linux/built-in.o -Wl,--end-group applets/built-in.o: In function `__negdi2': /usr/src/redhat/BUILD/cris-dist-1.62/gnu-toplev/gcc/libgcc2.c:52: multiple definition of `_start' /home/hinkok/delo/fw/car2_R1-uclibc.gen/stage.uclibc/lib/crt0.o(.text+0x0): first defined here applets/built-in.o: In function `__negdi2': /usr/src/redhat/BUILD/cris-dist-1.62/gnu-toplev/gcc/libgcc2.c:52: multiple definition of `__mainp' /home/hinkok/delo/fw/car2_R1-uclibc.gen/stage.uclibc/lib/crt0.o(.data.rel+0x0): first defined here applets/built-in.o: In function `__negdi2': /usr/src/redhat/BUILD/cris-dist-1.62/gnu-toplev/gcc/libgcc2.c:52: multiple definition of `__data_start' /home/hinkok/delo/fw/car2_R1-uclibc.gen/stage.uclibc/lib/crt0.o(.data+0x0): first defined here collect2: ld returned 1 exit status make[3]: *** [busybox_unstripped] Error 1 make[3]: Leaving directory `/home/hinkok/delo/fw/car2_R1-uclibc.gen/pkg/busybox-R2/build/uclibc/static' make[2]: *** [/home/hinkok/delo/fw/car2_R1-uclibc.gen/pkg/busybox-R2/build/uclibc/static/.build] Error 2 make[2]: Leaving directory `/home/hinkok/delo/_eclipse_work/broot2/products/car2' make[1]: *** [packages] Error 2 make[1]: Leaving directory `/home/hinkok/delo/_eclipse_work/broot2/products/car2' make: *** [car2-all] Error 2 I'm using ucLibc-0.9.27 and gcc compiler from Axis cris-axis-elf-gcc (GCC) 3.2.1 Axis release R62/1.62. Problem has something to do with crt0.o being in my stage/lib directory - if it is not there, I can't link and of the execs or libs against uClibc (maybe I'm doing something else wrong?!)... Removing crt0.o from the stage/lib outputs: make -f scripts/Makefile.build obj=shell make -f scripts/Makefile.build obj=sysklogd make -f scripts/Makefile.build obj=util-linux /home/hinkok/delo/fw/car2_R1-uclibc.gen/pkg/busybox-R2/build/uclibc/static/scripts/trylink gcc_cris -mlinux -DLINUX -DLINUX_SYSTEM -D_REENTRANT -mno-mul-bug-workaround -muclibc=/home/hinkok/delo/fw/car2_R1-uclibc.gen/stage.uclibc -L/home/hinkok/delo/fw/car2_R1-uclibc.gen/stage.uclibc/lib -Wl,-rpath-link,/home/hinkok/delo/fw/car2_R1-uclibc.gen/stage.uclibc/lib -static -o busybox_unstripped -Wl,--warn-common -Wl,--sort-common -Wl,--start-group applets/built-in.o archival/lib.a archival/libunarchive/lib.a console-tools/lib.a coreutils/lib.a coreutils/libcoreutils/lib.a debianutils/lib.a e2fsprogs/lib.a editors/lib.a findutils/lib.a init/lib.a libbb/lib.a libpwdgrp/lib.a loginutils/lib.a miscutils/lib.a modutils/lib.a networking/lib.a networking/libiproute/lib.a networking/udhcp/lib.a procps/lib.a runit/lib.a shell/lib.a sysklogd/lib.a util-linux/lib.a archival/built-in.o archival/libunarchive/built-in.o console-tools/built-in.o coreutils/built-in.o coreutils/libcoreutils/built-in.o debianutils/built-in.o e2fsprogs/built-in.o editors/built-in.o findutils/built-in.o init/built-in.o libbb/built-in.o libpwdgrp/built-in.o loginutils/built-in.o miscutils/built-in.o modutils/built-in.o networking/built-in.o networking/libiproute/built-in.o networking/udhcp/built-in.o procps/built-in.o runit/built-in.o shell/built-in.o sysklogd/built-in.o util-linux/built-in.o -Wl,--end-group /usr/local/cris/lib/gcc-lib/cris-axis-linux-gnu/3.2.1/../../../../cris-axis-linux-gnu/bin/ld: cannot open /home/hinkok/delo/fw/car2_R1-uclibc.gen/stage.uclibc/lib/crt0.o: No such file or directory collect2: ld returned 1 exit status make[3]: *** [busybox_unstripped] Error 1 make[3]: Leaving directory `/home/hinkok/delo/fw/car2_R1-uclibc.gen/pkg/busybox-R2/build/uclibc/static' make[2]: *** [/home/hinkok/delo/fw/car2_R1-uclibc.gen/pkg/busybox-R2/build/uclibc/static/.build] Error 2 make[2]: Leaving directory `/home/hinkok/delo/_eclipse_work/broot2/products/car2' make[1]: *** [packages] Error 2 make[1]: Leaving directory `/home/hinkok/delo/_eclipse_work/broot2/products/car2' make: *** [car2-all] Error 2 What can be done? best regards, hinko -- ?ETRTA POT, d.o.o., Kranj Planina 3 4000 Kranj Slovenia, Europe Tel. +386 (0) 4 280 66 03 E-mail: hinko.kocevar at cetrtapot.si Http: www.cetrtapot.si From pchaganti at gmail.com Fri Mar 2 08:39:58 2007 From: pchaganti at gmail.com (Prabhakar Chaganti) Date: Fri, 2 Mar 2007 11:39:58 -0500 Subject: Ruby Message-ID: Is anyone using Busybox with Ruby? I was able to compile Ruby package with buildroot, but it seems to be missing some files that should be in a standard ruby install. thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: http://busybox.net/lists/busybox/attachments/20070302/b252bb34/attachment.html From jnewell at wgate.com Fri Mar 2 11:15:48 2007 From: jnewell at wgate.com (James Newell) Date: Fri, 02 Mar 2007 14:15:48 -0500 Subject: Some network macro's have been removed from 2.6.19+ kernels. Message-ID: <1172862949.25461.5.camel@ndragon.eng.wgate.com> It appears IFA_RTA, IFA_PAYLOAD, IFLA_RTA, IFLA_PAYLOAD network macros used by ipaddress.c, and ll_map.c were removed by the 2.6.19+ kernel. A compiler built using the new kernel headers will fail to build busybox 1.2.2. If this has already been found, and fixed in later releases please ignore. Thanks, Jim Index: networking/libiproute/ipaddress.c =================================================================== --- networking/libiproute/ipaddress.c (revision 55) +++ networking/libiproute/ipaddress.c (working copy) @@ -19,6 +19,7 @@ #include #include +#include #include "rt_names.h" #include "utils.h" Index: include/libbb.h =================================================================== --- include/libbb.h (revision 55) +++ include/libbb.h (working copy) @@ -31,6 +31,22 @@ #include #include +#ifndef IFA_RTA +#define IFA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg)))) +#endif + +#ifndef IFA_PAYLOAD +#define IFA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifaddrmsg)) +#endif + +#ifndef IFLA_RTA +#define IFLA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg)))) +#endif + +#ifndef IFLA_PAYLOAD +#define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg)) +#endif + #ifdef CONFIG_SELINUX #include #endif From rogelio.serrano at gmail.com Fri Mar 2 11:24:40 2007 From: rogelio.serrano at gmail.com (Rogelio Serrano) Date: Sat, 3 Mar 2007 03:24:40 +0800 Subject: problems with ylwrap Message-ID: i have problem building cfengine. the ylwrap script just returns an error and i have no idea how to debug it. anybody has encountered this before? i have no idea what is causing it. i have been installing and reinstalling the entire system and still i get the same error message. i have tried countless combinations of of at least 3 versions of all utilities in all possible permutations. it just says error. i have no clue at all. im stumped -- the thing i like with my linux pc is that i can sum up my complaints in 5 items From bock at blacknet.de Fri Mar 2 11:52:10 2007 From: bock at blacknet.de (Goetz Bock) Date: Fri, 2 Mar 2007 20:52:10 +0100 Subject: Ruby In-Reply-To: References: Message-ID: <20070302195209.GZ22390@priv.blacknet.de> On Fri, Mar 02 '07 at 11:39, Prabhakar Chaganti wrote: > Is anyone using Busybox with Ruby? I was able to compile Ruby package with > buildroot, but it seems to be missing some files that should be in a > standard ruby install. Has anyone ever used a swith army knive with concret. No, sorry can't see how either relates to the other ;-) BTW: there is a buildroot mailing list. -- /"\ Goetz Bock at blacknet dot de -- secure mobile Linux everNETting \ / (c) 2006 Creative Commons, Attribution-ShareAlike 2.0 de X [ 1. Use descriptive subjects - 2. Edit a reply for brevity - ] / \ [ 3. Reply to the list - 4. Read the archive *before* you post ] From pchaganti at gmail.com Fri Mar 2 13:59:40 2007 From: pchaganti at gmail.com (Prabhakar Chaganti) Date: Fri, 2 Mar 2007 16:59:40 -0500 Subject: Ruby In-Reply-To: <20070302195209.GZ22390@priv.blacknet.de> References: <20070302195209.GZ22390@priv.blacknet.de> Message-ID: Found the issue anyways. Buildroot is installing ruby to /lib/ruby instead of /usr/lib/ruby. the binary is in /usr/bin. Symlinking fixes the issue. I had posted to the buildroot ml first, didnt hear anything, so wanted to see if any one on the busybox list had any ideas... thx On 3/2/07, Goetz Bock wrote: > > > > On Fri, Mar 02 '07 at 11:39, Prabhakar Chaganti wrote: > > Is anyone using Busybox with Ruby? I was able to compile Ruby package > with > > buildroot, but it seems to be missing some files that should be in a > > standard ruby install. > > Has anyone ever used a swith army knive with concret. > > No, sorry can't see how either relates to the other ;-) > > BTW: there is a buildroot mailing list. > -- > /"\ Goetz Bock at blacknet dot de -- secure mobile Linux everNETting > \ / (c) 2006 Creative Commons, Attribution-ShareAlike 2.0 de > X [ 1. Use descriptive subjects - 2. Edit a reply for brevity - ] > / \ [ 3. Reply to the list - 4. Read the archive *before* you post ] > _______________________________________________ > busybox mailing list > busybox at busybox.net > http://busybox.net/cgi-bin/mailman/listinfo/busybox > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://busybox.net/lists/busybox/attachments/20070302/389e2294/attachment.html From vda.linux at googlemail.com Fri Mar 2 14:54:14 2007 From: vda.linux at googlemail.com (Denis Vlasenko) Date: Fri, 2 Mar 2007 23:54:14 +0100 Subject: Bug 1244 testcase Message-ID: <200703022354.14036.vda.linux@googlemail.com> Hi Eric, Regarding http://busybox.net/bugs/view.php?id=1244 I put a Linux image suitable for qemu to http://busybox.net/~vda/init_bug_17917-17937/ I also put there a qemu binary archive, just unpack it into /usr/app/qemu-0.8.1 and run !vda_install (it will add a 'qemu' symlink to /usr/bin). Of course, if you already have qemu installed, you don't need to do it. Usage: running: qemu *.img editing: mkdir img mount -o loop *.img img [edit filesystem in img/*] umount img Contents: basically image is stolen from qemu.org site. I added /busybox binary, /sbin/init -> /busybox symlink and /etc/inittab: ::sysinit:/bin/echo sysinit ::wait:/bin/echo wait ::respawn:/bin/sh tty2::respawn:/bin/sh tty3::respawn:/bin/sh ::restart:/bin/echo restart ::shutdown:/bin/echo shutdown I didn't test restart or shutdown yet, but sysinit, wait, and respawn are all working as expected. Does it work if you replace /busybox with your bbox binary? If it works for you, can you try to modify this example and demonstrate the problem? My /etc/inittab may be too simple... -- vda From vda.linux at googlemail.com Fri Mar 2 15:11:23 2007 From: vda.linux at googlemail.com (Denis Vlasenko) Date: Sat, 3 Mar 2007 00:11:23 +0100 Subject: problems with ylwrap In-Reply-To: References: Message-ID: <200703030011.23333.vda.linux@googlemail.com> On Friday 02 March 2007 20:24, Rogelio Serrano wrote: > i have problem building cfengine. > > the ylwrap script just returns an error and i have no idea how to > debug it. anybody has encountered this before? i have no idea what is > causing it. i have been installing and reinstalling the entire system > and still i get the same error message. i have tried countless > combinations of of at least 3 versions of all utilities in all > possible permutations. > > it just says error. i have no clue at all. im stumped I guess readers of your email are even more stumped. You did not even show the error message (and a few preceding lines). How one is supposed to help you, having practically zero information? -- vda From vda.linux at googlemail.com Fri Mar 2 15:20:59 2007 From: vda.linux at googlemail.com (Denis Vlasenko) Date: Sat, 3 Mar 2007 00:20:59 +0100 Subject: sed: missing LF In-Reply-To: References: Message-ID: <200703030020.59976.vda.linux@googlemail.com> On Wednesday 28 February 2007 17:30, Thomas Necker wrote: > I have the following file test.cfg: > > ADDRESS= > NETMASK= > GATEWAY= > > When I issue the command > > sed "/^ADDRESS/c\ADDRESS=1.2.3.4" > > I get > > ADDRESS=1.2.3.4NETMASK= > GATEWAY= > > instead of > > ADDRESS=1.2.3.4 > NETMASK= > GATEWAY= > > So, a LF is missing. I'm using Busybox 1.4.0. It worked with 1.0. svn works for me. Can you test bbox svn or 1.4.1? -- vda From yang.reeve at gmail.com Fri Mar 2 16:02:04 2007 From: yang.reeve at gmail.com (Reeve Yang) Date: Sat, 3 Mar 2007 00:02:04 +0000 Subject: does current busybox has mkdosfs? Message-ID: <198592450703021602p1956b64cxffa57be47cda448c@mail.gmail.com> I need to run this command for SD card. Is it available for current version of busybox? I couldn't find it on version 1.4.1. Regards, - Reeve From vda.linux at googlemail.com Fri Mar 2 16:39:19 2007 From: vda.linux at googlemail.com (Denis Vlasenko) Date: Sat, 3 Mar 2007 01:39:19 +0100 Subject: [PATCH] ping.c : fix min/max packet size usage In-Reply-To: <78a54e1b0703011630r26879c5bh1e8dfd7f4ac3d88c@mail.gmail.com> References: <45E5DB9F.2030704@alphacore.net> <200703012323.26398.vda.linux@googlemail.com> <78a54e1b0703011630r26879c5bh1e8dfd7f4ac3d88c@mail.gmail.com> Message-ID: <200703030139.19036.vda.linux@googlemail.com> On Friday 02 March 2007 01:30, Jason Schoon wrote: > > Unfortunately, it introduces a regression: > > > > unpatched: > > > > # ./busybox ping -s 1000 127.0.0.1 > > PING 127.0.0.1 (127.0.0.1): 1000 data bytes > > 1008 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.0 ms > > 1008 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.0 ms > > 1008 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.0 ms > > 1008 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.0 ms > > > > patched: > > > > # ./busybox ping -s 1000 127.0.0.1 > > PING 127.0.0.1 (127.0.0.1): 1000 data bytes > > ^C > > --- 127.0.0.1 ping statistics --- > > 4 packets transmitted, 0 packets received, 100% packet loss > > > Agreed, I saw similar behavior using the original patch against 1.2.2.1. Try revision 17999 (or current svn). -- vda From vda.linux at googlemail.com Fri Mar 2 16:54:32 2007 From: vda.linux at googlemail.com (Denis Vlasenko) Date: Sat, 3 Mar 2007 01:54:32 +0100 Subject: Modifying init to create /dev/console ? In-Reply-To: <45E6776E.2090801@beam.ltd.uk> References: <45E3F851.4060004@beam.ltd.uk> <200702282343.40891.vda.linux@googlemail.com> <45E6776E.2090801@beam.ltd.uk> Message-ID: <200703030154.32915.vda.linux@googlemail.com> On Thursday 01 March 2007 07:49, Terry Barnaby wrote: > > kernel booted with: init=/somewhere/fix_dev.sh > > > > fix_dev.sh: > > > > #!/bin/sh > > mknod ... /dev/.... > > exec /sbin/init "$@" > > > > No hacking in init! :) > > > > Do you see any problems with this approach? > > No problems I can see with this approach apart from the kernel boot line > needing changing in all places Nope. Just rename /sbin/init to /sbin/init.binary, place above script in /sbin/init, and exec /sbin/init.binary "$@" > and I'm not sure if it will work across a > switch_root. But, I do prefer getting init to do the work. Using init, I > believe, is cleaner, simpler I think that programming in C is not simpler than four-line shell script. It's not easier and not faster to debug or to tailor for special cases like yours. > and more in keeping with what init is supposed to do I still don't know what init is supposed to do. For some reason which I still fail to understand, init has to handle this: ::shutdown:/how/to/shutdown... but not this: ::network_config:/how/to/set/up/network... ::send_mail:/how/to/send/mail... ::pizza:/how/to/order/food... Why? Why TERM/pause/KILL/pause/umount/shutdown sequence gets this special treatment in init? -- vda From rogelio.serrano at gmail.com Fri Mar 2 17:27:22 2007 From: rogelio.serrano at gmail.com (Rogelio Serrano) Date: Sat, 3 Mar 2007 09:27:22 +0800 Subject: problems with ylwrap In-Reply-To: <200703030011.23333.vda.linux@googlemail.com> References: <200703030011.23333.vda.linux@googlemail.com> Message-ID: On 3/3/07, Denis Vlasenko wrote: > On Friday 02 March 2007 20:24, Rogelio Serrano wrote: > > i have problem building cfengine. > > > > the ylwrap script just returns an error and i have no idea how to > > debug it. anybody has encountered this before? i have no idea what is > > causing it. i have been installing and reinstalling the entire system > > and still i get the same error message. i have tried countless > > combinations of of at least 3 versions of all utilities in all > > possible permutations. > > > > it just says error. i have no clue at all. im stumped > > I guess readers of your email are even more stumped. > You did not even show the error message (and a few preceding lines). > How one is supposed to help you, having practically zero information? > -- > vda > sorry here is a snippet: if gcc -DHAVE_CONFIG_H -I. -I. -I. -I/lib/openssl/include -pthread -g -O2 -Wreturn-type -Wmissing-prototypes -Wuninitialized -pthread -O2 -pipe -D_L ARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -pthread -O2 -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -MT wildcard.o -MD -MP -MF ".deps/wildcard.Tpo" -c -o wildcard.o wildcard.c; \ then mv -f ".deps/wildcard.Tpo" ".deps/wildcard.Po"; else rm -f ".deps/wildcard.Tpo"; exit 1; fi /bin/sh ../ylwrap cfparse.y y.tab.c cfparse.c y.tab.h cfparse.h y.output cfparse.output -- bison -y -d got /home/rogelio/cfengine-2\.1\.22/src/ *** [cfparse.c] Error 1 the build succeeded when i accidentally untarred on top of a configured tree. it seems ylwrap somehow deletes cfparse.c. I thought that cfparse.c was going to be generated by ylwrap. so i tried everything i can to make ylwrap generate cfparse.c. im really sick of this autotools stuff -- the thing i like with my linux pc is that i can sum up my complaints in 5 items From rogelio.serrano at gmail.com Fri Mar 2 17:51:20 2007 From: rogelio.serrano at gmail.com (Rogelio Serrano) Date: Sat, 3 Mar 2007 09:51:20 +0800 Subject: problems with ylwrap In-Reply-To: References: <200703030011.23333.vda.linux@googlemail.com> Message-ID: On 3/3/07, Rogelio Serrano wrote: > On 3/3/07, Denis Vlasenko wrote: > > On Friday 02 March 2007 20:24, Rogelio Serrano wrote: > > > i have problem building cfengine. > > > > > > the ylwrap script just returns an error and i have no idea how to > > > debug it. anybody has encountered this before? i have no idea what is > > > causing it. i have been installing and reinstalling the entire system > > > and still i get the same error message. i have tried countless > > > combinations of of at least 3 versions of all utilities in all > > > possible permutations. > > > > > > it just says error. i have no clue at all. im stumped > > > > I guess readers of your email are even more stumped. > > You did not even show the error message (and a few preceding lines). > > How one is supposed to help you, having practically zero information? > > -- > > vda > > > > sorry > > here is a snippet: > > if gcc -DHAVE_CONFIG_H -I. -I. -I. -I/lib/openssl/include -pthread > -g -O2 -Wreturn-type -Wmissing-prototypes -Wuninitialized -pthread -O2 > -pipe -D_L > ARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -pthread -O2 -pipe > -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -MT wildcard.o -MD -MP -MF > ".deps/wildcard.Tpo" > -c -o wildcard.o wildcard.c; \ > then mv -f ".deps/wildcard.Tpo" ".deps/wildcard.Po"; else rm -f > ".deps/wildcard.Tpo"; exit 1; fi > /bin/sh ../ylwrap cfparse.y y.tab.c cfparse.c y.tab.h cfparse.h > y.output cfparse.output -- bison -y -d > got /home/rogelio/cfengine-2\.1\.22/src/ > *** [cfparse.c] Error 1 > > the build succeeded when i accidentally untarred on top of a > configured tree. it seems ylwrap somehow deletes cfparse.c. I thought > that cfparse.c was going to be generated by ylwrap. so i tried > everything i can to make ylwrap generate cfparse.c. > > im really sick of this autotools stuff > > -- > the thing i like with my linux pc is that i can sum up my complaints in 5 items > its bison. its not generating anything. i installed byacc and it worked -- the thing i like with my linux pc is that i can sum up my complaints in 5 items From vapier at gentoo.org Fri Mar 2 20:36:29 2007 From: vapier at gentoo.org (Mike Frysinger) Date: Fri, 2 Mar 2007 23:36:29 -0500 Subject: uClibc-0.9.28 and NPTL In-Reply-To: <20070302015419.68237.qmail@web55201.mail.re4.yahoo.com> References: <20070302015419.68237.qmail@web55201.mail.re4.yahoo.com> Message-ID: <200703022336.30149.vapier@gentoo.org> On Thursday 01 March 2007, Birju Shah wrote: > hey does anyone know if uClibc-0.9.28 supports NPTL on powerpc and x86? no, wait for 0.9.30 -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 827 bytes Desc: not available Url : http://busybox.net/lists/busybox/attachments/20070302/faf3bd7c/attachment-0001.pgp From vapier at gentoo.org Fri Mar 2 20:37:58 2007 From: vapier at gentoo.org (Mike Frysinger) Date: Fri, 2 Mar 2007 23:37:58 -0500 Subject: Some network macro's have been removed from 2.6.19+ kernels. In-Reply-To: <1172862949.25461.5.camel@ndragon.eng.wgate.com> References: <1172862949.25461.5.camel@ndragon.eng.wgate.com> Message-ID: <200703022337.59595.vapier@gentoo.org> On Friday 02 March 2007, James Newell wrote: > It appears IFA_RTA, IFA_PAYLOAD, IFLA_RTA, IFLA_PAYLOAD network macros > used by ipaddress.c, and ll_map.c were removed by the 2.6.19+ kernel. which turned out to be a mistake and is rectified in newer versions aka, upgrade your kernel headers, dont hack busybox -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 827 bytes Desc: not available Url : http://busybox.net/lists/busybox/attachments/20070302/1ca1a617/attachment.pgp From vapier at gentoo.org Fri Mar 2 20:37:25 2007 From: vapier at gentoo.org (Mike Frysinger) Date: Fri, 2 Mar 2007 23:37:25 -0500 Subject: Problem compiling for cris ARCH In-Reply-To: <45E813D7.1000801@cetrtapot.si> References: <45E813D7.1000801@cetrtapot.si> Message-ID: <200703022337.26114.vapier@gentoo.org> On Friday 02 March 2007, hinko.kocevar at cetrtapot.si wrote: > What can be done? ask on the axis cris support forums (wherever that is) ... this really like a toolchain problem and not busybox's fault at all -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 827 bytes Desc: not available Url : http://busybox.net/lists/busybox/attachments/20070302/3931248a/attachment.pgp From vapier at gentoo.org Fri Mar 2 20:38:59 2007 From: vapier at gentoo.org (Mike Frysinger) Date: Fri, 2 Mar 2007 23:38:59 -0500 Subject: does current busybox has mkdosfs? In-Reply-To: <198592450703021602p1956b64cxffa57be47cda448c@mail.gmail.com> References: <198592450703021602p1956b64cxffa57be47cda448c@mail.gmail.com> Message-ID: <200703022339.00465.vapier@gentoo.org> On Friday 02 March 2007, Reeve Yang wrote: > Is it available for current version of busybox? mkdosfs has never been integrated into busybox ... search the archives and you can probably find a patch -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 827 bytes Desc: not available Url : http://busybox.net/lists/busybox/attachments/20070302/8d619e4e/attachment.pgp From rogelio.serrano at gmail.com Fri Mar 2 22:35:53 2007 From: rogelio.serrano at gmail.com (Rogelio Serrano) Date: Sat, 3 Mar 2007 06:35:53 +0000 Subject: problem with busybox tar Message-ID: i get an "invalid header checksum error" on some archives that are fine on gnu tar. both on glibc and uclibc one example is git-1.5.0.tar.bz2 anyone has encountered this already? im using version 1.4.1 with all the latest patches -- the thing i like with my linux pc is that i can sum up my complaints in 5 items From E.Spakman at inter.nl.net Sat Mar 3 00:35:30 2007 From: E.Spakman at inter.nl.net (Eric Spakman) Date: Sat, 3 Mar 2007 09:35:30 +0100 (CET) Subject: Bug 1244 testcase In-Reply-To: <200703022354.14036.vda.linux@googlemail.com> References: <200703022354.14036.vda.linux@googlemail.com> Message-ID: <1166.213.51.236.62.1172910930.squirrel@webmail.internl.net> Hi Denis, > Hi Eric, > > > Regarding http://busybox.net/bugs/view.php?id=1244 > > > Does it work if you replace /busybox with your bbox binary? > > > If it works for you, can you try to modify this example > and demonstrate the problem? My /etc/inittab may be too simple... -- > vda > I had some problems hacking this example, so instead I created two very small Qemu images. One images (-190207-) contains a busybox snapshot pre rev17937 and one (-020307-) contains todays busybox snapshot. The images are created as a "floppy" so need to be started with Qemu -fda. You can login with "root" and passwd just . Some insight on the bootsequence: The init scripts are in the /etc/init.d/ directory and symlinks to rcS.d, rc2.d and rc0.d are created at boottime. The inittab contains the following entries: ::sysinit:/etc/init.d/rcS ::wait:/etc/init.d/rc 2 .... ::shutdown:/etc/init.d/rc 0 The rcS script starts the (symlinked) files in /etc/rcS.d in order (system setup and a few daemons). After that the "rc 2" script starts the files in rc2.d in order (other daemons). At reboot or halt the "rc 0" script stops all daemons by running the files in rc0.d. With the 190207 image the output of the init startup sequence is shown on the console (tty1), the output of ps shows the following daemons started: syslogd klogd dhcpcd dropbear watchdog dnsmasq ulogd inetd openntpd mini_httpd cron With the 020307 image no information (except kernel messages) are shown on the console and the following daemons are not started anymore: dnsmasq ulogd openntpd Because the image is running in memory (tmpfs), you have to run "lrcfg" and type "s" to save changes in /etc/inittab. The images can be downloaded from: ftp://espakman.dyndns.org/denis/ If this isn't suitable I will continue to try to modify your example image. Regards, Eric From E.Spakman at inter.nl.net Sat Mar 3 00:37:17 2007 From: E.Spakman at inter.nl.net (Eric Spakman) Date: Sat, 3 Mar 2007 09:37:17 +0100 (CET) Subject: Bug 1244 testcase In-Reply-To: <1166.213.51.236.62.1172910930.squirrel@webmail.internl.net> References: <200703022354.14036.vda.linux@googlemail.com> <1166.213.51.236.62.1172910930.squirrel@webmail.internl.net> Message-ID: <1168.213.51.236.62.1172911037.squirrel@webmail.internl.net> Hi Denis, > The images can be downloaded from: > ftp://espakman.dyndns.org/denis/ > This should be: ftp://espakman.dyndns.org/pub/denis/ Eric From vda.linux at googlemail.com Sat Mar 3 04:27:16 2007 From: vda.linux at googlemail.com (Denis Vlasenko) Date: Sat, 3 Mar 2007 13:27:16 +0100 Subject: problem with busybox tar In-Reply-To: References: Message-ID: <200703031327.16474.vda.linux@googlemail.com> On Saturday 03 March 2007 07:35, Rogelio Serrano wrote: > i get an "invalid header checksum error" on some archives that are > fine on gnu tar. both on glibc and uclibc I assume you mean "i get an invalid header checksum error _on untarring_ some archives". > one example is git-1.5.0.tar.bz2 URL where it can be downloaded? > anyone has encountered this already? > > im using version 1.4.1 with all the latest patches -- vda From rogelio.serrano at gmail.com Sat Mar 3 04:36:08 2007 From: rogelio.serrano at gmail.com (Rogelio Serrano) Date: Sat, 3 Mar 2007 20:36:08 +0800 Subject: problem with busybox tar In-Reply-To: <200703031327.16474.vda.linux@googlemail.com> References: <200703031327.16474.vda.linux@googlemail.com> Message-ID: On 3/3/07, Denis Vlasenko wrote: > On Saturday 03 March 2007 07:35, Rogelio Serrano wrote: > > i get an "invalid header checksum error" on some archives that are > > fine on gnu tar. both on glibc and uclibc > > I assume you mean "i get an invalid header checksum error > _on untarring_ some archives". > > > one example is git-1.5.0.tar.bz2 > > URL where it can be downloaded? > http://kernel.org/pub/software/scm/git/git-1.5.0.tar.bz2 > > anyone has encountered this already? > > > > im using version 1.4.1 with all the latest patches > -- > vda > From birju_shah0 at yahoo.com Sat Mar 3 09:51:07 2007 From: birju_shah0 at yahoo.com (Birju Shah) Date: Sat, 3 Mar 2007 09:51:07 -0800 (PST) Subject: uClibc-0.9.28 and NPTL Message-ID: <20070303175107.23780.qmail@web55214.mail.re4.yahoo.com> what is the time frame for that? is there a development branch w/ NPTL support to play around w/? I tried the nptl branch but it looks like it only has support for mips thanks birju ----- Original Message ---- From: Mike Frysinger To: busybox at busybox.net Cc: Birju Shah Sent: Friday, March 2, 2007 8:36:29 PM Subject: Re: uClibc-0.9.28 and NPTL On Thursday 01 March 2007, Birju Shah wrote: > hey does anyone know if uClibc-0.9.28 supports NPTL on powerpc and x86? no, wait for 0.9.30 -mike ____________________________________________________________________________________ Need Mail bonding? Go to the Yahoo! Mail Q&A for great tips from Yahoo! Answers users. http://answers.yahoo.com/dir/?link=list&sid=396546091 From jnewell at wgate.com Sat Mar 3 10:15:05 2007 From: jnewell at wgate.com (James Newell) Date: Sat, 03 Mar 2007 13:15:05 -0500 Subject: Some network macro's have been removed from 2.6.19+ kernels. In-Reply-To: <200703022337.59595.vapier@gentoo.org> References: <1172862949.25461.5.camel@ndragon.eng.wgate.com> <200703022337.59595.vapier@gentoo.org> Message-ID: <1172945706.4739.1.camel@ndragon.eng.wgate.com> Thanks. It made me dig a little bit more and I found the discussion thread. Based on the discussion, I wouldn't be surprised to find those macros deprecated and removed in the future again. http://www.archivesat.com/Libc_for_alpha_systems/thread1771044.htm On Fri, 2007-03-02 at 23:37 -0500, Mike Frysinger wrote: > On Friday 02 March 2007, James Newell wrote: > > It appears IFA_RTA, IFA_PAYLOAD, IFLA_RTA, IFLA_PAYLOAD network macros > > used by ipaddress.c, and ll_map.c were removed by the 2.6.19+ kernel. > > which turned out to be a mistake and is rectified in newer versions > > aka, upgrade your kernel headers, dont hack busybox > -mike From vda.linux at googlemail.com Sat Mar 3 11:40:06 2007 From: vda.linux at googlemail.com (Denis Vlasenko) Date: Sat, 3 Mar 2007 20:40:06 +0100 Subject: problem with busybox tar In-Reply-To: References: <200703031327.16474.vda.linux@googlemail.com> Message-ID: <200703032040.06201.vda.linux@googlemail.com> On Saturday 03 March 2007 13:36, Rogelio Serrano wrote: > On 3/3/07, Denis Vlasenko wrote: > > On Saturday 03 March 2007 07:35, Rogelio Serrano wrote: > > > i get an "invalid header checksum error" on some archives that are > > > fine on gnu tar. both on glibc and uclibc > > > > I assume you mean "i get an invalid header checksum error > > _on untarring_ some archives". > > > > > one example is git-1.5.0.tar.bz2 > > > > URL where it can be downloaded? > > > > http://kernel.org/pub/software/scm/git/git-1.5.0.tar.bz2 tar tf git-1.5.0.tar works ok up to this chunk: 0033e000 67 69 74 2d 31 2e 35 2e 30 2f 67 69 74 77 65 62 |git-1.5.0/gitweb| 0033e010 2f 74 65 73 74 2f 00 00 00 00 00 00 00 00 00 00 |/test/..........| 0033e020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e060 00 00 00 00 30 30 30 30 37 37 35 00 30 30 30 30 |....0000775.0000| 0033e070 30 30 30 00 30 30 30 30 30 30 30 00 30 30 30 30 |000.0000000.0000| 0033e080 30 30 30 30 30 30 30 00 31 30 35 36 34 34 37 34 |0000000.10564474| 0033e090 30 32 36 00 30 30 31 34 35 35 30 00 35 00 00 00 |026.0014550.5...| 0033e0a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e0b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e0c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e0d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e0e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e0f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e100 00 75 73 74 61 72 00 30 30 72 6f 6f 74 00 00 00 |.ustar.00root...| 0033e110 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e120 00 00 00 00 00 00 00 00 00 72 6f 6f 74 00 00 00 |.........root...| 0033e130 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e140 00 00 00 00 00 00 00 00 00 30 30 30 30 30 30 30 |.........0000000| 0033e150 00 30 30 30 30 30 30 30 00 00 00 00 00 00 00 00 |.0000000........| 0033e160 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e170 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e180 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e190 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e1a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e1b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e1c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e1d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e1e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e1f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| It's ok, and so reported: git-1.5.0/gitweb/test/ Then it fails in next block (a bit of debug output is included): nam = 'git-1.5.0/gitweb/test/M??rchen' sum = 7463 xstr= 6951 str = '0015447' tar: invalid tar header checksum The block inself: 0033e200 67 69 74 2d 31 2e 35 2e 30 2f 67 69 74 77 65 62 |git-1.5.0/gitweb| 0033e210 2f 74 65 73 74 2f 4d c3 a4 72 63 68 65 6e 00 00 |/test/M..rchen..| 0033e220 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e230 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e240 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e250 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e260 00 00 00 00 30 30 30 30 36 36 34 00 30 30 30 30 |....0000664.0000| 0033e270 30 30 30 00 30 30 30 30 30 30 30 00 30 30 30 30 |000.0000000.0000| 0033e280 30 30 30 30 30 32 31 00 31 30 35 36 34 34 37 34 |0000021.10564474| 0033e290 30 32 36 00 30 30 31 35 34 34 37 00 30 00 00 00 |026.0015447.0...| 0033e2a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e2b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e2c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e2d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e2e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e2f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e300 00 75 73 74 61 72 00 30 30 72 6f 6f 74 00 00 00 |.ustar.00root...| 0033e310 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e320 00 00 00 00 00 00 00 00 00 72 6f 6f 74 00 00 00 |.........root...| 0033e330 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e340 00 00 00 00 00 00 00 00 00 30 30 30 30 30 30 30 |.........0000000| 0033e350 00 30 30 30 30 30 30 30 00 00 00 00 00 00 00 00 |.0000000........| 0033e360 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e370 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e380 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e390 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e3a0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e3b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e3c0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e3d0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e3e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 0033e3f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| GNU tar doesn't fail here: ... git-1.5.0/gitweb/test/ git-1.5.0/gitweb/test/M??rchen git-1.5.0/gitweb/test/file with spaces git-1.5.0/gitweb/test/file+plus+sign git-1.5.0/grep.c ... Hmm wait a second... GNU tar seems to use SIGNED bytes for checksumming! The fix: archival/libunarchive/get_header_tar.c: sum = ' ' * sizeof(tar.chksum); for (i = 0; i < 148 ; i++) { sum += ((signed char*)&tar)[i]; // <- 'signed' added } for (i = 156; i < 512 ; i++) { sum += ((signed char*)&tar)[i]; // <- 'signed' added } Works for me, will fix in svn now. -- vda From vda.linux at googlemail.com Sat Mar 3 12:01:53 2007 From: vda.linux at googlemail.com (Denis Vlasenko) Date: Sat, 3 Mar 2007 21:01:53 +0100 Subject: problem with busybox tar In-Reply-To: <200703032040.06201.vda.linux@googlemail.com> References: <200703032040.06201.vda.linux@googlemail.com> Message-ID: <200703032101.53339.vda.linux@googlemail.com> On Saturday 03 March 2007 20:40, Denis Vlasenko wrote: > Hmm wait a second... GNU tar seems to use SIGNED bytes for checksumming! > > The fix: archival/libunarchive/get_header_tar.c: > > sum = ' ' * sizeof(tar.chksum); > for (i = 0; i < 148 ; i++) { > sum += ((signed char*)&tar)[i]; // <- 'signed' added > } > for (i = 156; i < 512 ; i++) { > sum += ((signed char*)&tar)[i]; // <- 'signed' added > } > > Works for me, will fix in svn now. More digging in GNU tar revealed that tar file's header checksum is _supposed to be_ done over unsigned bytes, but Sun and HP-UX fucked it up. Nice... Please try attached... -- vda -------------- next part -------------- A non-text attachment was scrubbed... Name: a.patch Type: text/x-diff Size: 1911 bytes Desc: not available Url : http://busybox.net/lists/busybox/attachments/20070303/13f4143a/attachment.bin From vda.linux at googlemail.com Sat Mar 3 12:51:53 2007 From: vda.linux at googlemail.com (Denis Vlasenko) Date: Sat, 3 Mar 2007 21:51:53 +0100 Subject: Bug 1244 testcase In-Reply-To: <1166.213.51.236.62.1172910930.squirrel@webmail.internl.net> References: <200703022354.14036.vda.linux@googlemail.com> <1166.213.51.236.62.1172910930.squirrel@webmail.internl.net> Message-ID: <200703032151.53575.vda.linux@googlemail.com> On Saturday 03 March 2007 09:35, Eric Spakman wrote: > I had some problems hacking this example, so instead I created two very > small Qemu images. One images (-190207-) contains a busybox snapshot pre > rev17937 and one (-020307-) contains todays busybox snapshot. The images > are created as a "floppy" so need to be started with Qemu -fda. > > You can login with "root" and passwd just . > > Some insight on the bootsequence: > The init scripts are in the /etc/init.d/ directory and symlinks to rcS.d, > rc2.d and rc0.d are created at boottime. The inittab contains the > following entries: > ::sysinit:/etc/init.d/rcS > ::wait:/etc/init.d/rc 2 > .... > ::shutdown:/etc/init.d/rc 0 > > The rcS script starts the (symlinked) files in /etc/rcS.d in order (system > setup and a few daemons). After that the "rc 2" script starts the files in > rc2.d in order (other daemons). At reboot or halt the "rc 0" script stops > all daemons by running the files in rc0.d. I was able to run the testcases. > With the 190207 image the output of the init startup sequence is shown on > the console (tty1), the output of ps shows the following daemons started: > syslogd > klogd > dhcpcd > dropbear > watchdog > dnsmasq > ulogd > inetd > openntpd > mini_httpd > cron > > With the 020307 image no information (except kernel messages) are shown on > the console and the following daemons are not started anymore: > dnsmasq > ulogd > openntpd > > Because the image is running in memory (tmpfs), you have to run "lrcfg" > and type "s" to save changes in /etc/inittab. This does not seem to work. I was trying to add the following line: exec >/dev/tty1 2>/dev/tty1 References: <200703022354.14036.vda.linux@googlemail.com> <1166.213.51.236.62.1172910930.squirrel@webmail.internl.net> <200703032151.53575.vda.linux@googlemail.com> Message-ID: <200703032346.44193.vda.linux@googlemail.com> On Saturday 03 March 2007 21:51, Denis Vlasenko wrote: > On Saturday 03 March 2007 09:35, Eric Spakman wrote: > > Because the image is running in memory (tmpfs), you have to run "lrcfg" > > and type "s" to save changes in /etc/inittab. > > This does not seem to work. > > I was trying to add the following line: > exec >/dev/tty1 2>/dev/tty1 at the very top of /etc/init.d/rc and /etc/init.d/rcS > in order to provide them with ctty. The attached standalone utility shall be able to automatically do it for specified program. Usage: -::sysinit:/etc/init.d/rcS [args] +::sysinit:/path/to/cttyhack /etc/init.d/rcS [args] It is not meant to be a permanent solution, I just want to check whether the problem is caused by lack of ctty for sysinit actions. If it is true, then "real" fix is to determine why your sysinit actions require ctty. They should not need it, I think. cttyhack may be useful and even may be added to bbox, but it is still an ugly non-portable hack. -- vda -------------- next part -------------- A non-text attachment was scrubbed... Name: cttyhack.c Type: text/x-csrc Size: 1965 bytes Desc: not available Url : http://busybox.net/lists/busybox/attachments/20070303/499794e7/attachment.c From E.Spakman at inter.nl.net Sun Mar 4 06:50:51 2007 From: E.Spakman at inter.nl.net (Eric Spakman) Date: Sun, 4 Mar 2007 15:50:51 +0100 (CET) Subject: Bug 1244 testcase In-Reply-To: <200703032346.44193.vda.linux@googlemail.com> References: <200703022354.14036.vda.linux@googlemail.com> <1166.213.51.236.62.1172910930.squirrel@webmail.internl.net> <200703032151.53575.vda.linux@googlemail.com> <200703032346.44193.vda.linux@googlemail.com> Message-ID: <1182.213.51.236.62.1173019851.squirrel@webmail.internl.net> Hi Denis, > The attached standalone utility shall be able to automatically > do it for specified program. Usage: > > -::sysinit:/etc/init.d/rcS [args] > +::sysinit:/path/to/cttyhack /etc/init.d/rcS [args] > > > It is not meant to be a permanent solution, I just want to check > whether the problem is caused by lack of ctty for sysinit actions. > > If it is true, then "real" fix is to determine why your sysinit > actions require ctty. They should not need it, I think. > > cttyhack may be useful and even may be added to bbox, but it is still an > ugly non-portable hack. -- > vda > This hack does indeed work, but I had to add it in 3 places: ::sysinit:/sbin/cttyhack /etc/init.d/rcS ::wait:/sbin/cttyhack /etc/init.d/rc 2 ...... ::shutdown:/sbin/cttyhack /etc/init.d/rc 0 to see boot and shutdown messages and to start/stop all the daemons and programs. I have an updated Qemu image with cttyhack and changed inittab in ftp://espakman.dyndns.org/pub/denis/ It's indeed strange that some daemons seem to need a controlling tty, at least dnsmasq, openntpd and ulogd won't start without and I can imagine there are more. Shorewall contains shell scripts and that won't seem to start either without the cttyhack. But what's also annoying without a ctty is that no startup and shutdown output is shown, even when busybox init is compiled with "FEATURE_INIT_SCTTY and a "-" in the inittab. Anyway, those problems are solved with "cttyhack". What was the reason for the changes in Revision 17937, portability? Or can I read it somewhere in the mail archives? Regards, Eric From vda.linux at googlemail.com Sun Mar 4 10:04:47 2007 From: vda.linux at googlemail.com (Denis Vlasenko) Date: Sun, 4 Mar 2007 19:04:47 +0100 Subject: Bug 1244 testcase In-Reply-To: <1182.213.51.236.62.1173019851.squirrel@webmail.internl.net> References: <200703022354.14036.vda.linux@googlemail.com> <200703032346.44193.vda.linux@googlemail.com> <1182.213.51.236.62.1173019851.squirrel@webmail.internl.net> Message-ID: <200703041904.47284.vda.linux@googlemail.com> Hi Eric, On Sunday 04 March 2007 15:50, Eric Spakman wrote: > > The attached standalone utility shall be able to automatically > > do it for specified program. Usage: > > > > -::sysinit:/etc/init.d/rcS [args] > > +::sysinit:/path/to/cttyhack /etc/init.d/rcS [args] > > > > It is not meant to be a permanent solution, I just want to check > > whether the problem is caused by lack of ctty for sysinit actions. > > > > If it is true, then "real" fix is to determine why your sysinit > > actions require ctty. They should not need it, I think. > > > > cttyhack may be useful and even may be added to bbox, but it is still an > > ugly non-portable hack. > > This hack does indeed work, but I had to add it in 3 places: > ::sysinit:/sbin/cttyhack /etc/init.d/rcS > ::wait:/sbin/cttyhack /etc/init.d/rc 2 > ...... > ::shutdown:/sbin/cttyhack /etc/init.d/rc 0 > > to see boot and shutdown messages and to start/stop all the daemons and > programs. > > I have an updated Qemu image with cttyhack and changed inittab in > ftp://espakman.dyndns.org/pub/denis/ Can you explain how can one *update* these images for testing? > It's indeed strange that some daemons seem to need a controlling tty, at > least dnsmasq, openntpd and ulogd won't start without and I can imagine I suspect that daemons don't need it, but some script probably fails before they have a chance to be started. In order to find out where it breaks down, do *NOT* use cttyhack, but use "exec >/dev/tty1 2>/dev/tty1 there are more. Shorewall contains shell scripts and that won't seem to > start either without the cttyhack. > > But what's also annoying without a ctty is that no startup and shutdown > output is shown, even when busybox init is compiled with > "FEATURE_INIT_SCTTY and a "-" in the inittab. I speculate that output is not shown because there is no output. Script dies before it gets to output anything. -- vda From E.Spakman at inter.nl.net Sun Mar 4 10:58:08 2007 From: E.Spakman at inter.nl.net (Eric Spakman) Date: Sun, 4 Mar 2007 19:58:08 +0100 (CET) Subject: Bug 1244 testcase In-Reply-To: <200703041904.47284.vda.linux@googlemail.com> References: <200703022354.14036.vda.linux@googlemail.com> <200703032346.44193.vda.linux@googlemail.com> <1182.213.51.236.62.1173019851.squirrel@webmail.internl.net> <200703041904.47284.vda.linux@googlemail.com> Message-ID: <1099.213.51.236.62.1173034688.squirrel@webmail.internl.net> Hi Denis, >> I have an updated Qemu image with cttyhack and changed inittab in >> ftp://espakman.dyndns.org/pub/denis/ >> > > Can you explain how can one *update* these images for testing? > That's a bit difficult, the image contains packages that install at boottime. But I have hacked it a bit so changes to scripts in /etc/init.d/ (rc, rcS, ..) will be saved with lrcfg -> s New image in ftp://espakman.dyndns.org/pub/denis/ > >> It's indeed strange that some daemons seem to need a controlling tty, >> at least dnsmasq, openntpd and ulogd won't start without and I can >> imagine > > I suspect that daemons don't need it, but some script probably fails > before they have a chance to be started. > I don't think this is the case, if I start the scripts by hand after init is started they run and output is shown. > In order to find out where it breaks down, do *NOT* use cttyhack, > but use "exec >/dev/tty1 2>/dev/tty1 further down the script until you find the place where script starts to > fail. > I will. > Or explain how I can modify the image, so I can experiment myself. > Please try the new image. > >> there are more. Shorewall contains shell scripts and that won't seem to >> start either without the cttyhack. >> >> But what's also annoying without a ctty is that no startup and shutdown >> output is shown, even when busybox init is compiled with >> "FEATURE_INIT_SCTTY and a "-" in the inittab. >> > > I speculate that output is not shown because there is no output. > Script dies before it gets to output anything. Not entirely, also daemons and programs that do start don't show any output. They do if I go back to sysvinit or busybox SVN before revision 17937. > -- > vda > Eric From E.Spakman at inter.nl.net Sun Mar 4 11:39:51 2007 From: E.Spakman at inter.nl.net (Eric Spakman) Date: Sun, 4 Mar 2007 20:39:51 +0100 (CET) Subject: Bug 1244 testcase In-Reply-To: <200703041904.47284.vda.linux@googlemail.com> References: <200703022354.14036.vda.linux@googlemail.com> <200703032346.44193.vda.linux@googlemail.com> <1182.213.51.236.62.1173019851.squirrel@webmail.internl.net> <200703041904.47284.vda.linux@googlemail.com> Message-ID: <1180.213.51.236.62.1173037191.squirrel@webmail.internl.net> Hi Denis, >> It's indeed strange that some daemons seem to need a controlling tty, >> at least dnsmasq, openntpd and ulogd won't start without and I can >> imagine > > I suspect that daemons don't need it, but some script probably fails > before they have a chance to be started. > > In order to find out where it breaks down, do *NOT* use cttyhack, > but use "exec >/dev/tty1 2>/dev/tty1 further down the script until you find the place where script starts to > fail. > I tried it and some scripts indeed start to fail with the latest SVN version. All those scripts contain "set -e". Commenting that out make the script run again. A snippet: set -e case "$1" in start) echo -n "Starting $DESC: " start-stop-daemon --quiet --start --exec $DAEMON -- -d > /dev/null 2>&1 echo "$NAME." ;; But the console is still quiet, I need the cttyhack program to show any init bootmessages on the screen. Eric From vapier at gentoo.org Sun Mar 4 13:18:34 2007 From: vapier at gentoo.org (Mike Frysinger) Date: Sun, 4 Mar 2007 16:18:34 -0500 Subject: Some network macro's have been removed from 2.6.19+ kernels. In-Reply-To: <1172945706.4739.1.camel@ndragon.eng.wgate.com> References: <1172862949.25461.5.camel@ndragon.eng.wgate.com> <200703022337.59595.vapier@gentoo.org> <1172945706.4739.1.camel@ndragon.eng.wgate.com> Message-ID: <200703041618.35242.vapier@gentoo.org> On Saturday 03 March 2007, James Newell wrote: > Thanks. It made me dig a little bit more and I found the discussion > thread. Based on the discussion, I wouldn't be surprised to find those > macros deprecated and removed in the future again. in either case, the solution would probably involve rewriting the source code or using the libc headers rather than the linux headers sucks either way ;) -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 827 bytes Desc: not available Url : http://busybox.net/lists/busybox/attachments/20070304/3d94704a/attachment.pgp From vapier at gentoo.org Sun Mar 4 13:19:12 2007 From: vapier at gentoo.org (Mike Frysinger) Date: Sun, 4 Mar 2007 16:19:12 -0500 Subject: uClibc-0.9.28 and NPTL In-Reply-To: <20070303175107.23780.qmail@web55214.mail.re4.yahoo.com> References: <20070303175107.23780.qmail@web55214.mail.re4.yahoo.com> Message-ID: <200703041619.13081.vapier@gentoo.org> On Saturday 03 March 2007, Birju Shah wrote: this is not a busybox issue and as such, is inappropriate for this list please ask such questions on the uclibc list -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 827 bytes Desc: not available Url : http://busybox.net/lists/busybox/attachments/20070304/c6905e50/attachment.pgp From vda.linux at googlemail.com Sun Mar 4 14:20:05 2007 From: vda.linux at googlemail.com (Denis Vlasenko) Date: Sun, 4 Mar 2007 23:20:05 +0100 Subject: Bug 1244 testcase In-Reply-To: <1180.213.51.236.62.1173037191.squirrel@webmail.internl.net> References: <200703022354.14036.vda.linux@googlemail.com> <200703041904.47284.vda.linux@googlemail.com> <1180.213.51.236.62.1173037191.squirrel@webmail.internl.net> Message-ID: <200703042320.05833.vda.linux@googlemail.com> On Sunday 04 March 2007 20:39, Eric Spakman wrote: > >> It's indeed strange that some daemons seem to need a controlling tty, > >> at least dnsmasq, openntpd and ulogd won't start without and I can > >> imagine > > > > I suspect that daemons don't need it, but some script probably fails > > before they have a chance to be started. > > > > In order to find out where it breaks down, do *NOT* use cttyhack, > > but use "exec >/dev/tty1 2>/dev/tty1 > further down the script until you find the place where script starts to > > fail. > > > I tried it and some scripts indeed start to fail with the latest SVN > version. All those scripts contain "set -e". Commenting that out make the > script run again. > > A snippet: > > set -e > > case "$1" in > start) > echo -n "Starting $DESC: " > start-stop-daemon --quiet --start --exec $DAEMON -- -d > /dev/null > 2>&1 > echo "$NAME." > ;; > > > But the console is still quiet, I need the cttyhack program to show any > init bootmessages on the screen. I have an idea what's going on. Your initrd stars /sbin/init this way: ...; exec /sbin/init dev/console 2>dev/console It seems '<' redirection is opened in O_RDONLY mode by shell (both ash and bash). Then init does this: close(1); close(2); set_term(); dup(0); dup(0); Guess what? Our fd #1 and #2 are _not_ writable_ after that! I managed to add statically linked strace into your image and it definitely shows that "/bin/echo TEST" fails to write(1, ...). Please try attached fix. Sorry. -- vda -------------- next part -------------- A non-text attachment was scrubbed... Name: 3.patch Type: text/x-diff Size: 1321 bytes Desc: not available Url : http://busybox.net/lists/busybox/attachments/20070304/45d82669/attachment.bin From jnewell at wgate.com Mon Mar 5 06:16:32 2007 From: jnewell at wgate.com (James Newell) Date: Mon, 5 Mar 2007 09:16:32 -0500 Subject: Some network macro's have been removed from 2.6.19+ kernels. Message-ID: > -----Original Message----- > From: Mike Frysinger [mailto:vapier at gentoo.org] > Sent: Sunday, March 04, 2007 4:19 PM > To: James Newell > Cc: busybox at busybox.net > Subject: Re: Some network macro's have been removed from > 2.6.19+ kernels. > > On Saturday 03 March 2007, James Newell wrote: > > Thanks. It made me dig a little bit more and I found the > discussion > > thread. Based on the discussion, I wouldn't be surprised to find > > those macros deprecated and removed in the future again. > > in either case, the solution would probably involve rewriting > the source code or using the libc headers rather than the > linux headers > Agreed. > sucks either way ;) > -mike > From E.Spakman at inter.nl.net Mon Mar 5 11:07:31 2007 From: E.Spakman at inter.nl.net (Eric Spakman) Date: Mon, 5 Mar 2007 20:07:31 +0100 (CET) Subject: Bug 1244 testcase In-Reply-To: <200703042320.05833.vda.linux@googlemail.com> References: <200703022354.14036.vda.linux@googlemail.com> <200703041904.47284.vda.linux@googlemail.com> <1180.213.51.236.62.1173037191.squirrel@webmail.internl.net> <200703042320.05833.vda.linux@googlemail.com> Message-ID: <1148.213.51.236.62.1173121651.squirrel@webmail.internl.net> Hi Denis, > >>>> It's indeed strange that some daemons seem to need a controlling >>>> tty, at least dnsmasq, openntpd and ulogd won't start without and I >>>> can imagine >>> >>> I suspect that daemons don't need it, but some script probably fails >>> before they have a chance to be started. >>> >>> In order to find out where it breaks down, do *NOT* use cttyhack, >>> but use "exec >/dev/tty1 2>/dev/tty1 >> further and further down the script until you find the place where >>> script starts to fail. >>> >> I tried it and some scripts indeed start to fail with the latest SVN >> version. All those scripts contain "set -e". Commenting that out make >> the script run again. >> >> A snippet: >> >> >> set -e >> >> case "$1" in start) echo -n "Starting $DESC: " start-stop-daemon --quiet >> --start --exec $DAEMON -- -d > /dev/null >> 2>&1 >> echo "$NAME." ;; >> >> >> >> But the console is still quiet, I need the cttyhack program to show any >> init bootmessages on the screen. > > I have an idea what's going on. Your initrd stars /sbin/init this way: > ...; exec /sbin/init dev/console 2>dev/console > It seems '<' redirection is opened in O_RDONLY mode by shell > (both ash and bash). > > > Then init does this: > > > close(1); close(2); set_term(); dup(0); dup(0); > > Guess what? Our fd #1 and #2 are _not_ writable_ after that! > I managed to add statically linked strace into your image > and it definitely shows that "/bin/echo TEST" fails to write(1, ...). > > Please try attached fix. > The attached patch fixes the problem! Thanks. > > Sorry. > -- > vda > Regards, Eric From E.Spakman at inter.nl.net Mon Mar 5 11:25:36 2007 From: E.Spakman at inter.nl.net (Eric Spakman) Date: Mon, 5 Mar 2007 20:25:36 +0100 (CET) Subject: Patch: make init writing to syslog a config option In-Reply-To: <200703042320.05833.vda.linux@googlemail.com> References: <200703022354.14036.vda.linux@googlemail.com> <200703041904.47284.vda.linux@googlemail.com> <1180.213.51.236.62.1173037191.squirrel@webmail.internl.net> <200703042320.05833.vda.linux@googlemail.com> Message-ID: <1184.213.51.236.62.1173122736.squirrel@webmail.internl.net> Hi, Currently busybox init relies on busybox syslogd to write its logging. This doesn't work with external syslog programs. The patch below makes init writing syslog messages a configure option, like the su applet. Regards, Eric ----------------------------------------------------------------- diff -urpN busybox.orig/init/Config.in busybox/init/Config.in --- busybox.orig/init/Config.in 2007-03-01 09:20:09.000000000 +0100 +++ busybox/init/Config.in 2007-03-01 22:22:05.000000000 +0100 @@ -38,6 +38,11 @@ config FEATURE_INIT_SCTTY 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 diff -urpN busybox.orig/init/init.c busybox/init/init.c --- busybox.orig/init/init.c 2007-03-01 09:20:09.000000000 +0100 +++ busybox/init/init.c 2007-03-01 22:24:01.000000000 +0100 @@ -16,7 +16,7 @@ #include #include -#if ENABLE_SYSLOGD +#if ENABLE_FEATURE_INIT_SYSLOG # include #endif @@ -84,7 +84,7 @@ struct init_action { /* 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 @@ static void message(int device, const ch __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 @@ static void message(int device, const ch 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 @@ static void console_init(void) * 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.linux at googlemail.com Mon Mar 5 11:53:01 2007 From: vda.linux at googlemail.com (Denis Vlasenko) Date: Mon, 5 Mar 2007 20:53:01 +0100 Subject: Patch: make init writing to syslog a config option In-Reply-To: <1184.213.51.236.62.1173122736.squirrel@webmail.internl.net> References: <200703022354.14036.vda.linux@googlemail.com> <200703042320.05833.vda.linux@googlemail.com> <1184.213.51.236.62.1173122736.squirrel@webmail.internl.net> Message-ID: <200703052053.01822.vda.linux@googlemail.com> On Monday 05 March 2007 20:25, Eric Spakman wrote: > Currently busybox init relies on busybox syslogd to write its logging. > This doesn't work with external syslog programs. The patch below makes > init writing syslog messages a configure option, like the su applet. Applied, thanks. -- vda From vda.linux at googlemail.com Mon Mar 5 11:53:28 2007 From: vda.linux at googlemail.com (Denis Vlasenko) Date: Mon, 5 Mar 2007 20:53:28 +0100 Subject: Bug 1244 testcase In-Reply-To: <1148.213.51.236.62.1173121651.squirrel@webmail.internl.net> References: <200703022354.14036.vda.linux@googlemail.com> <200703042320.05833.vda.linux@googlemail.com> <1148.213.51.236.62.1173121651.squirrel@webmail.internl.net> Message-ID: <200703052053.28671.vda.linux@googlemail.com> On Monday 05 March 2007 20:07, Eric Spakman wrote: > >> But the console is still quiet, I need the cttyhack program to show any > >> init bootmessages on the screen. > > > > I have an idea what's going on. Your initrd stars /sbin/init this way: > > ...; exec /sbin/init dev/console 2>dev/console > > It seems '<' redirection is opened in O_RDONLY mode by shell > > (both ash and bash). > > > > > > Then init does this: > > > > > > close(1); close(2); set_term(); dup(0); dup(0); > > > > Guess what? Our fd #1 and #2 are _not_ writable_ after that! > > I managed to add statically linked strace into your image > > and it definitely shows that "/bin/echo TEST" fails to write(1, ...). > > > > Please try attached fix. > > > The attached patch fixes the problem! Good. Apllied to svn. -- vda From somlo at cmu.edu Mon Mar 5 13:58:58 2007 From: somlo at cmu.edu (Gabriel L. Somlo) Date: Mon, 5 Mar 2007 16:58:58 -0500 Subject: PATCH: ifupdown and /var/run/ifstate file Message-ID: <20070305215858.GC7452@hedwig.net.cmu.edu> Hi List, ifupdown.c records the status of the interfaces it works on in the /var/run/ifstate file. Until a while ago, it used to read this file at startup and build a list (state_list) based on its contents, before actually trying to make changes to interfaces. When an interface was marked as 'up' in the state file, ifup would cowardly refuse to bring it up *again*. Similar situation with ifdown and an interface marked as already unconfigured. While ifupdown still writes the /var/run/ifstate before exiting, it no longer reads it on startup. I wonder whether that's intentional, or was removed accidentally as part of some cleanup operation. If unintentional, please apply the enclosed patch to put the functionality back in place. Thanks much, Gabriel diff -NarU5 busybox-svn-17982.orig/networking/ifupdown.c busybox-svn-17982/networking/ifupdown.c --- busybox-svn-17982.orig/networking/ifupdown.c 2007-02-27 22:45:19.000000000 -0500 +++ busybox-svn-17982/networking/ifupdown.c 2007-03-05 13:53:52.000000000 -0500 @@ -1089,10 +1089,12 @@ int (*cmds)(struct interface_defn_t *) = NULL; struct interfaces_file_t *defn; llist_t *state_list = NULL; llist_t *target_list = NULL; const char *interfaces = "/etc/network/interfaces"; + const char *statefile = "/var/run/ifstate"; + FILE *state_fp; int any_failures = 0; cmds = iface_down; if (applet_name[2] == 'u') { /* ifup command */ @@ -1115,10 +1117,23 @@ } startup_PATH = getenv("PATH"); if (!startup_PATH) startup_PATH = ""; + /* Read the previous state from the state file */ + state_fp = fopen_or_warn(statefile, "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) { target_list = defn->autointerfaces; } else { @@ -1164,11 +1179,11 @@ bb_error_msg("interface %s already configured", iface); continue; } } else { /* ifdown */ - if (iface_state) { + if (!iface_state) { bb_error_msg("interface %s not configured", iface); continue; } } } @@ -1242,13 +1257,11 @@ } } /* Actually write the new state */ if (!NO_ACT) { - FILE *state_fp; - - state_fp = xfopen("/var/run/ifstate", "w"); + state_fp = xfopen(statefile, "w"); while (state_list) { if (state_list->data) { fprintf(state_fp, "%s\n", state_list->data); } state_list = state_list->link; From somlo at cmu.edu Mon Mar 5 16:36:29 2007 From: somlo at cmu.edu (Gabriel L. Somlo) Date: Mon, 5 Mar 2007 19:36:29 -0500 Subject: PATCH: ifupdown and /var/run/ifstate file In-Reply-To: <20070305215858.GC7452@hedwig.net.cmu.edu> References: <20070305215858.GC7452@hedwig.net.cmu.edu> Message-ID: <20070306003629.GE7452@hedwig.net.cmu.edu> Denis, The previous version of this patch was wrong/incomplete. A new working one is enclosed. Extra code is needed to deconstruct the state_list gracefully, so I added a function to unlink an element from a llist_t to be called from ifupdown. Thanks, Gabriel diff -NarU5 busybox-svn-17982.orig/include/libbb.h busybox-svn-17982/include/libbb.h --- busybox-svn-17982.orig/include/libbb.h 2007-02-27 22:45:22.000000000 -0500 +++ busybox-svn-17982/include/libbb.h 2007-03-05 19:26:06.000000000 -0500 @@ -473,10 +473,11 @@ struct llist_s *link; } llist_t; 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); enum { LOGMODE_NONE = 0, diff -NarU5 busybox-svn-17982.orig/libbb/llist.c busybox-svn-17982/libbb/llist.c --- busybox-svn-17982.orig/libbb/llist.c 2007-02-27 22:45:21.000000000 -0500 +++ busybox-svn-17982/libbb/llist.c 2007-03-05 19:26:00.000000000 -0500 @@ -43,25 +43,43 @@ } /* 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; - - data = (*head)->data; - free(*head); - *head = next; - } + return NULL; + + next = (*head)->link; + data = (*head)->data; + 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)) { while (elm) { diff -NarU5 busybox-svn-17982.orig/networking/ifupdown.c busybox-svn-17982/networking/ifupdown.c --- busybox-svn-17982.orig/networking/ifupdown.c 2007-02-27 22:45:19.000000000 -0500 +++ busybox-svn-17982/networking/ifupdown.c 2007-03-05 19:29:03.000000000 -0500 @@ -1089,10 +1089,12 @@ int (*cmds)(struct interface_defn_t *) = NULL; struct interfaces_file_t *defn; llist_t *state_list = NULL; llist_t *target_list = NULL; const char *interfaces = "/etc/network/interfaces"; + const char *statefile = "/var/run/ifstate"; + FILE *state_fp; int any_failures = 0; cmds = iface_down; if (applet_name[2] == 'u') { /* ifup command */ @@ -1115,10 +1117,23 @@ } startup_PATH = getenv("PATH"); if (!startup_PATH) startup_PATH = ""; + /* Read the previous state from the state file */ + state_fp = fopen_or_warn(statefile, "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) { target_list = defn->autointerfaces; } else { @@ -1164,11 +1179,11 @@ bb_error_msg("interface %s already configured", iface); continue; } } else { /* ifdown */ - if (iface_state) { + if (!iface_state) { bb_error_msg("interface %s not configured", iface); continue; } } } @@ -1234,21 +1249,20 @@ } else { free(iface_state->data); 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)); } } } /* Actually write the new state */ if (!NO_ACT) { - FILE *state_fp; - - state_fp = xfopen("/var/run/ifstate", "w"); + state_fp = xfopen(statefile, "w"); while (state_list) { if (state_list->data) { fprintf(state_fp, "%s\n", state_list->data); } state_list = state_list->link; From natanael.copa at gmail.com Tue Mar 6 05:00:51 2007 From: natanael.copa at gmail.com (Natanael Copa) Date: Tue, 06 Mar 2007 14:00:51 +0100 Subject: serial console and log-in In-Reply-To: <200703010026.56844.vda.linux@googlemail.com> References: <20070220145025.bfc52cea95091b0fffcb409eab6296ba.c4ccc45496.wbe@email.secureserver.net> <200702272040.22024.vda.linux@googlemail.com> <1172674255.27284.58.camel@localhost> <200703010026.56844.vda.linux@googlemail.com> Message-ID: <1173186051.31268.10.camel@localhost> On Thu, 2007-03-01 at 00:26 +0100, Denis Vlasenko wrote: > On Wednesday 28 February 2007 15:50, Natanael Copa wrote: > > > > I backported the svn init to 1.4.1 (i depend on releases). > > > > > > > > My inittab line looks like this: > > > > > > > > ::respawn:/sbin/getty - 9600 vt100 > > > > > > > > I got a login prompt but no controlling tty: > > > > > > > > -ash: cant't access tty; job control turned off > > > > > > > > ~$ echo TEST > /dev/tty > > > > -ash: cannot create /dev/tty: No such device or address > > > > > > > > That was on a VGA console. > > > > > > > > Then I tried to run it in qemu, with -nographic. It booted, it gave me a > > > > login, but same as VGA, no controlling tty. > > > > > > I expected that. It stems from the fact that /dev/console > > > cannot be a ctty. > > > > > > I'm not sure this can be classified as 'bug'. > > > > Probably not. But then I need another feature :-/ > > > > Something like running a specified row only when controlling terminal is > > serial. > > > > ttyS0:serial:respawn:/sbin/getty -L ttyS0 9600 vt100 > > > > Drawback is that it needs to use an unused field in inittab. > > How about writing small hack which analyzes stdin (fd #0) > and closes fd #0,1,2 + reopens/dups /dev/ttyN or /dev/ttySn: > > > /* From */ > struct vt_stat { > unsigned short v_active; /* active vt */ > unsigned short v_signal; /* signal to send */ > unsigned short v_state; /* vt bitmask */ > }; > enum { VT_GETSTATE = 0x5603 }; /* get global vt state info */ > > /* From */ > struct serial_struct { > int type; > int line; > unsigned int port; > int irq; > int flags; > int xmit_fifo_size; > int custom_divisor; > int baud_base; > unsigned short close_delay; > char io_type; > char reserved_char[1]; > int hub6; > unsigned short closing_wait; /* time to wait before closing */ > unsigned short closing_wait2; /* no longer used... */ > unsigned char *iomem_base; > unsigned short iomem_reg_shift; > unsigned int port_high; > unsigned long iomap_base; /* cookie passed into ioremap */ > int reserved[1]; > }; > > int fd; > struct vt_stat vt; > struct serial_struct sr; > char console[64]; > > /* identify the real console backend and try to use it */ > if (ioctl(0, TIOCGSERIAL, &sr) == 0) { > /* this is a serial console */ > snprintf(console, sizeof(console) - 1, "/dev/ttyS%d", sr.line); > } else if (ioctl(0, VT_GETSTATE, &vt) == 0) { > /* this is linux virtual tty */ > snprintf(console, sizeof(console) - 1, "/dev/tty%d", vt.v_active); > } else { > /* unable to figure it out */ > ... > } > > fd = xopen(console, O_RDWR); > dup2(fd, 0); > dup2(fd, 1); > dup2(fd, 2); > while (fd > 2) close(fd--); > > then exec it's argv? > > Use it like this: > > ::respawn:/somewhere/cttyhack /sbin/getty - 9600 vt100 > > Care to try? ;) I tried this. This works. Does the job. However, its is hackish as you said: ~ $ who USER TTY IDLE TIME HOST root - ? Mar 6 12:39 root tty2 . Mar 6 12:48 Note that TTY ends up as - Are there any drawback with this? Can this make other programs behave strange? Another hackish way to solve it would be to have a 'is_serial_tty' binary in the initramfs: /* is_serial_tty.c */ int main() { return (ioctl(0, TIOCGSERIAL, &sr) != 0); } and then copy a second inittab to new root, before running switchroot. if is_serial_tty ; then cp inittab.serial /new_root/etc fi This is also hackish and I don't know whats worst. I'm seriously thinking of writing a new init, based on the upstart ideas. (unlike runinit, it will reuse sysv init.d scripts) > -- > vda From vda.linux at googlemail.com Tue Mar 6 14:50:16 2007 From: vda.linux at googlemail.com (Denis Vlasenko) Date: Tue, 6 Mar 2007 23:50:16 +0100 Subject: PATCH: ifupdown and /var/run/ifstate file In-Reply-To: <20070