Re: Ash + telnetd: telnet client hangs after exit
Denys Vlasenko wrote: > ... > function old new delta > telnetd_main13551350 -5 > make_new_session 532 521 -11 > free_session 118 101 -17 > -- > (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-33) Total: -33 bytes >textdata bss dec hex filename > 6763282538 12104 690970 a8b1a busybox_old > 6762952538 12104 690937 a8af9 busybox_unstripped > > Please review attached (or see current svn). It seems fine. I'm surprised that your changes to telnetd_main removed only 5 bytes. The compiler seems to be quite clever already. But with your changes it is also obvious to the human reader that kill_session does the same each time. Regards Ralf Friedl ___ busybox mailing list busybox@busybox.net http://busybox.net/cgi-bin/mailman/listinfo/busybox
Re: [PATCH] httpd: Support configurable start page
--- Alex Landau <[EMAIL PROTECTED]> wrote: > Hi, > > The attached patch adds an option to set the default page to display for a > URL like > http://hostname/ instead of index.html. The option is compile-time selectable > and the > filename is config-file choosable. The file may also be a CGI script (if CGI > is > compiled > in). > > Any comments? > > Thanks, > Alex Bump. Same for httpd proxy. Tonight's top picks. What will you watch tonight? Preview the hottest shows on Yahoo! TV. http://tv.yahoo.com/ ___ busybox mailing list busybox@busybox.net http://busybox.net/cgi-bin/mailman/listinfo/busybox
Re: Ash + telnetd: telnet client hangs after exit
On Wednesday 17 October 2007 10:19, Ralf Friedl wrote: > Denys Vlasenko wrote: > > ... > > function old new delta > > telnetd_main13551350 -5 > > make_new_session 532 521 -11 > > free_session 118 101 -17 > > -- > > (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-33) Total: -33 > > bytes > >textdata bss dec hex filename > > 6763282538 12104 690970 a8b1a busybox_old > > 6762952538 12104 690937 a8af9 busybox_unstripped > > > > Please review attached (or see current svn). > It seems fine. > > I'm surprised that your changes to telnetd_main removed only 5 bytes. > The compiler seems to be quite clever already. Sadly, no. movl$0, 56(%eax)#, .nblock movl$0, 64(%eax)#, .numZ movl$0, 68(%eax)#, .state_out_pos movl$-1, 80(%eax) #, .blockCRC xorl%edx, %edx # i If only gcc realized that by zeroing edx first, it could have used movl %edx,(mem), and save 12 bytes... Another example: isempty_RL: - movl$1, %edx#, D.7967 + movb$1, %dl #, D.7967 -- three bytes shorter cmpl$255, 48(%eax) #, .state_in_ch ja .L215 #, - xorl%edx, %edx # D.7967 -- not needed (2 bytes) cmpl$0, 52(%eax)#, .state_in_len setle %dl #, D.7967 .L215: - movl%edx, %eax # D.7967, + movzbl %dl, %eax # D.7967, -- one byte longer ret And so on and so forth... -- vda ___ busybox mailing list busybox@busybox.net http://busybox.net/cgi-bin/mailman/listinfo/busybox
Re: [PATCH] httpd: Support configurable start page
On Wednesday 17 October 2007 10:56, Alex Landau wrote: > --- Alex Landau <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > The attached patch adds an option to set the default page to display for a > > URL like > > http://hostname/ instead of index.html. The option is compile-time > > selectable and the > > filename is config-file choosable. The file may also be a CGI script (if > > CGI is > > compiled > > in). > > > > Any comments? I removed dup() below: cgi_io_loop_and_exit(proxy_fd, dup(proxy_fd), length); Is it needed? Also I edited code parts which looked like "if ((A = expr) == B) ... ", and removed trailing whitespace. Here you allocate 8k buffer and copy there all headers from client: char *headers = xmalloc(IOBUF_SIZE); ... /* Read until blank line for HTTP version specified, else parse immediate */ while (1) { alarm(HEADER_READ_TIMEOUT); if (!get_line()) break; /* EOF or error or empty line */ if (DEBUG) bb_error_msg("header: '%s'", iobuf); #if ENABLE_FEATURE_HTTPD_PROXY if (headers_ptr - headers < IOBUF_SIZE) { int len = strlen(iobuf); if (len > IOBUF_SIZE - (headers_ptr - headers) - 2) len = IOBUF_SIZE - (headers_ptr - headers) - 2; memcpy(headers_ptr, iobuf, len); headers_ptr += len; headers_ptr[0] = '\r'; headers_ptr[1] = '\n'; headers_ptr += 2; } #endif But you use it only if request happens to be one of the proxied requests: proxy_entry = find_proxy_entry(urlcopy); if (proxy_entry != NULL) { write(proxy_fd, headers, headers_ptr - headers); write(proxy_fd, "\r\n", 2); cgi_io_loop_and_exit(proxy_fd, proxy_fd, length); } Can you check find_proxy_entry(urlcopy) earlier and do xmalloc and copying only if needed? I am attaching modified httpd.c, please base your further work on it. Thanks Alex for your work. -- vda httpd.c.bz2 Description: BZip2 compressed data ___ busybox mailing list busybox@busybox.net http://busybox.net/cgi-bin/mailman/listinfo/busybox
Re: [PATCH] httpd: Support configurable start page
--- Denys Vlasenko <[EMAIL PROTECTED]> wrote: > On Wednesday 17 October 2007 10:56, Alex Landau wrote: > > --- Alex Landau <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > > > The attached patch adds an option to set the default page to display for > > > a URL like > > > http://hostname/ instead of index.html. The option is compile-time > > > selectable and > the > > > filename is config-file choosable. The file may also be a CGI script (if > > > CGI is > > > compiled > > > in). > > > > > > Any comments? > > I removed dup() below: > > cgi_io_loop_and_exit(proxy_fd, dup(proxy_fd), length); > > Is it needed? Yes, it is. cgi_io_loop_and_exit() expects 2 distinct file descriptors (ala pipe()) and closes one of them to notify the CGI about an EOF in the postdata. This will close the connection in the proxy case. I've put it back. > > Also I edited code parts which looked like "if ((A = expr) == B) ... ", > and removed trailing whitespace. > > Here you allocate 8k buffer and copy there all headers from client: > > char *headers = xmalloc(IOBUF_SIZE); > ... > > But you use it only if request happens to be one of the proxied > requests: > > proxy_entry = find_proxy_entry(urlcopy); > if (proxy_entry != NULL) { > > write(proxy_fd, headers, headers_ptr - headers); > write(proxy_fd, "\r\n", 2); > cgi_io_loop_and_exit(proxy_fd, proxy_fd, length); > } > > Can you check find_proxy_entry(urlcopy) earlier and do xmalloc > and copying only if needed? > Sure, how could I miss it? Thanks! > I am attaching modified httpd.c, please base your further work on it. > Ditto. > Thanks Alex for your work. I hope someone besides me will find these features useful. :-) > -- > vda > Alex Tonight's top picks. What will you watch tonight? Preview the hottest shows on Yahoo! TV. http://tv.yahoo.com/ httpd.c.bz2 Description: 824490146-httpd.c.bz2 ___ busybox mailing list busybox@busybox.net http://busybox.net/cgi-bin/mailman/listinfo/busybox
Re: [PATCH] httpd: Support configurable start page
On Wednesday 17 October 2007 18:42, Denys Vlasenko wrote: > index.cgi support broke. I understand that now I need to supply > a config file for it, but it still doesn't work... Hmm, by the way: can't existing index.cgi support cover your needs instead of FEATURE_HTTPD_START_PAGE? -- vda ___ busybox mailing list busybox@busybox.net http://busybox.net/cgi-bin/mailman/listinfo/busybox
Re: [PATCH] httpd: Support configurable start page
On Wednesday 17 October 2007 12:45, Alex Landau wrote: > > I am attaching modified httpd.c, please base your further work on it. > > > > Ditto. *c++ = '\0'; if (strncmp(c, "http://";, 7) == 0) c += 7; host_port = c; if (host_port == NULL) { bb_error_msg("config error '%s' in '%s'", buf, cf); continue; } host_port cannot be NULL. What do you really want to test there? index.cgi support broke. I understand that now I need to supply a config file for it, but it still doesn't work: ./busybox httpd -c httpd.conf -f -vvv -p httpd.conf == S:cgi-bin/index.cgi cgi-bin/index.cgi is a binary I built from httpd_indexcgi.c (you may find it alongside httpd.c in busybox source). strace: [pid 3509] chdir("/path/to/cgi-bin") = 0 [pid 3509] execve("/path/to/cgi-bin/index.cgi", ["index.cgi"], [/* 66 vars */]) = 0 [pid 3509] chdir("..") = 0 [pid 3509] chdir("cgi-bin/index.cgi") = -1 ENOTDIR (Not a directory) <== ??? [pid 3509] _exit(1)= ? Process 3509 detached [pid 3508] <... poll resumed> [{fd=0, events=0}, {fd=3, events=POLLIN, revents=POLLHUP}, {fd=0, events=0}], 3, -1) = 1 [pid 3508] read(3, "", 4088) = 0 [pid 3508] shutdown(1, 1 /* send */) = 0 [pid 3508] fcntl64(0, F_GETFL) = 0x2 (flags O_RDWR) [pid 3508] fcntl64(0, F_SETFL, O_RDWR|O_NONBLOCK) = 0 [pid 3508] read(0, "", 8192) = 0 [pid 3508] write(2, "172.28.3.151:45324: closed\n", 27172.28.3.151:45324: closed ) = 27 [pid 3508] exit_group(0) = ? Process 3508 detached Obviously you pass different QUERY_STRING now, and this doesn't work in httpd_indexcgi.c anymore: if (chdir("..") || (QUERY_STRING[1] && chdir(QUERY_STRING + 1)) ) { return 1; } See attached httpd.c -- vda httpd.c.bz2 Description: BZip2 compressed data ___ busybox mailing list busybox@busybox.net http://busybox.net/cgi-bin/mailman/listinfo/busybox
start-stop-daemon does not recognise --start
start-stop-daemon claims to offer --start, but then doesn't accept it: start-stop-daemon: unrecognized option `--start' BusyBox v1.7.2 (2007-10-17 15:06:10 EST) multi-call binary Usage: start-stop-daemon [OPTIONS] [--start|--stop] ... [-- arguments...] Start and stop services Options: -S|--start Start -K|--stop Stop -a|--startas pathname Starts process specified by path Force process into background -u|--user username|uid Stop this user's processes -x|--exec executableProgram to either start or check -m|--make-pidfile Create the -p file and enter pid in it -n|--name process-name Stop processes with this name -p|--pidfile pid-file Save or load pid using a pid-file -q|--quiet Quiet -o|--oknodo Exit status 0 if nothing done -v|--verboseVerbose -N|--nicelevel NAdd N to process's nice level -s|--signal signal Signal to send (default TERM) -c|--chuid user[:[group]] Change to specified user/group Hamish -- Hamish Moffatt VK3SB <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> ___ busybox mailing list busybox@busybox.net http://busybox.net/cgi-bin/mailman/listinfo/busybox
Re: start-stop-daemon does not recognise --start
On Thu, Oct 18, 2007 at 09:58:41AM +1000, Hamish Moffatt wrote: > start-stop-daemon claims to offer --start, but then doesn't accept it: Actually all the long options seems to be broken. Hamish -- Hamish Moffatt VK3SB <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> ___ busybox mailing list busybox@busybox.net http://busybox.net/cgi-bin/mailman/listinfo/busybox
passwd - no stty echo after Ctrl-C
Platform: mipsel BB version: 1.7.2 or i386 When issuing Ctrl-C during password entry, I still have invisible characters at the ash prompt. The output is okay, though. As soon as I call "stty echo" manually, the shell prompt is okay again. Reproduce like this on i386: bash $ ./busybox ash ash $ ./busybox passwd Changing password for root New password: [Ctrl-C] ash $ ash $ stty echo # repair Can this be fixed? Regards -- Alexander Kriegisch ___ busybox mailing list busybox@busybox.net http://busybox.net/cgi-bin/mailman/listinfo/busybox