From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2946 Path: news.gmane.org!not-for-mail From: Rob Landley Newsgroups: gmane.linux.toybox,gmane.linux.lib.musl.general,gmane.linux.lib.musl.general Subject: Re: [musl] toybox: Rough edges in pending Date: Tue, 19 Mar 2013 12:33:29 -0500 Message-ID: <1363714409.15703.35@driftwood> References: <20130319110939.GJ19010@port70.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="Flowed"; DelSp="Yes" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1363714418 10798 80.91.229.3 (19 Mar 2013 17:33:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 19 Mar 2013 17:33:38 +0000 (UTC) Cc: musl-ZwoEplunGu1jrUoiu81ncdBPR1lH4CV8@public.gmane.org, toybox-oU9gvf+ajcRUPo+8YfT7LV6hYfS7NtTn@public.gmane.org To: musl-ZwoEplunGu1jrUoiu81ncdBPR1lH4CV8@public.gmane.org Original-X-From: toybox-bounces-oU9gvf+ajcRUPo+8YfT7LV6hYfS7NtTn@public.gmane.org Tue Mar 19 18:34:04 2013 Return-path: Envelope-to: glt-toybox@m.gmane.org Original-Received: from che.dreamhost.com ([66.33.216.23]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UI0QF-0002W2-KB for glt-toybox@m.gmane.org; Tue, 19 Mar 2013 18:34:03 +0100 Original-Received: from che.dreamhost.com (localhost [127.0.0.1]) by che.dreamhost.com (Postfix) with ESMTP id 4CE6EFFC6; Tue, 19 Mar 2013 10:33:43 -0700 (PDT) Original-Received: from mail-ie0-f173.google.com (mail-ie0-f173.google.com [209.85.223.173]) by che.dreamhost.com (Postfix) with ESMTP id 8F3DAFFC6 for ; Tue, 19 Mar 2013 10:33:37 -0700 (PDT) Original-Received: by mail-ie0-f173.google.com with SMTP id 9so958145iec.4 for ; Tue, 19 Mar 2013 10:33:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:date:from:subject:to:cc:in-reply-to:x-mailer:message-id :mime-version:content-type:content-disposition :content-transfer-encoding:x-gm-message-state; bh=aPeNCKId2o348d76SDJ7XbjlDuH8qF2WpQjG65wN6MY=; b=RzkK+AOAFmvEI13mCdq6406wgPaCfejxZz1X8ndwVwcf/cRJJ1Fki8FzWNqUlLARfD K4l9fKKk9nGFqAuVbjYBGBirrV1iqF6TZ7zq04D9rXbwMurcdyxUsWZmbKZYc3YMz/cN u8KzEi5nVKG3/uIz3MxWtiGtmH3Lh7Jmi4+mhn7WOCqzeoQjDnd/M0zjV6FN6YZUWoEG 7eNMR6tV/SfrHnIklj+hC1uGyyg0pdtycJ2+hFQb4Ce2LjYpP9UrgKrNp7gkeCKB5ALM pcXKoNKtBN7sVGxmcv84S1umtPVPROf6ZdSRYnK+xutb2Snqno9K/9FGQymVRupvdejZ VpUw== X-Received: by 10.50.33.177 with SMTP id s17mr2473410igi.45.1363714413155; Tue, 19 Mar 2013 10:33:33 -0700 (PDT) Original-Received: from driftwood (c-50-148-218-118.hsd1.mn.comcast.net. [50.148.218.118]) by mx.google.com with ESMTPS id xc3sm1261899igb.10.2013.03.19.10.33.30 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Mar 2013 10:33:32 -0700 (PDT) In-Reply-To: <20130319110939.GJ19010-4P1ElwuDYu6sTnJN9+BGXg@public.gmane.org> (from nsz-4P1ElwuDYu6sTnJN9+BGXg@public.gmane.org on Tue Mar 19 06:09:39 2013) X-Mailer: Balsa 2.4.11 Content-Disposition: inline X-Gm-Message-State: ALoCoQljGIfElnFFFZ9gm2CditRqlUww3IBGA7jFwW5sThpMWh7yuLlK+OMRGamYQA5JfTPYvBib X-BeenThere: toybox-oU9gvf+ajcRUPo+8YfT7LV6hYfS7NtTn@public.gmane.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: All-in-one linux command line utility package List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: toybox-bounces-oU9gvf+ajcRUPo+8YfT7LV6hYfS7NtTn@public.gmane.org Original-Sender: toybox-bounces-oU9gvf+ajcRUPo+8YfT7LV6hYfS7NtTn@public.gmane.org Xref: news.gmane.org gmane.linux.toybox:268 gmane.linux.lib.musl.general:2946 Archived-At: On 03/19/2013 06:09:39 AM, Szabolcs Nagy wrote: > * Szabolcs Nagy [2013-03-19 10:42:25 +0100]: > > * Isaac Dunham [2013-03-18 23:50:43 -0700]: > > > execve("./toybox-musl", ["./toybox-musl", "sh", "-c", "ls"], [/* > 22 vars */]) = 0 > > ... > > > ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 opost isig icanon > echo ...}) = 0 > > > vfork(Config.in README kconfig scripts toybox_unstripped > toys.h > > > LICENSE configure lib toybox toynet.h www > > > Makefile generated main.c toybox-musl toys > > > ) = 27832 > > > --- SIGCHLD (Child exited) @ 0 (0) --- > > > wait4(27832, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = > 27832 > > > pause(^C > > > > exit tries to flush some stdio buffers but it is locked > > > > maybe an issue around the way vfork is used by the shell > > > this is what toybox sh does: > > cmd->pid = vfork(); > if (!cmd->pid) xexec(cmd->argv); > else waitpid(cmd->pid, &status, 0); > > > it's an incorrect use of vfork It is indeed. I was going to add some plumbing to xexec() to exec /proc/self/exe in the internal toy called from toysh case, but toysh is unfinished and I'm not sure it's the best approach and potentially implementing the nofork logic with longjmp() for error handling works into that, although I have to prototype bits of that to figure out whether it's worth the effort. (It's complicated. In bash you can't ctrl-z to suspend "read" because it's a shell builtin and doesn't have a separate process context to suspend, even though it can block. I feel it _should_ be possible to suspend this but that involves potentially calling fork() from the ctrl-z handler and is the shell not letting you do something obvious better than complicating the implementation? There's _details_ to getting this all right, and I haven't reopened the toysh can of worms because I'd need more than a month to reach the next good stopping point. The first week of which is a close re-reading of the SUSv4 shell stuff and the bash man page and digging up my old test cases. I have lots of lower hanging fruit to clear first.) Rob