From: Rob Landley <rob-VoJi6FS/r0vR7s880joybQ@public.gmane.org>
To: musl-ZwoEplunGu1jrUoiu81ncdBPR1lH4CV8@public.gmane.org
Cc: musl-ZwoEplunGu1jrUoiu81ncdBPR1lH4CV8@public.gmane.org,
toybox-oU9gvf+ajcRUPo+8YfT7LV6hYfS7NtTn@public.gmane.org
Subject: Re: [musl] toybox: Rough edges in pending
Date: Tue, 19 Mar 2013 12:33:29 -0500 [thread overview]
Message-ID: <1363714409.15703.35@driftwood> (raw)
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)
On 03/19/2013 06:09:39 AM, Szabolcs Nagy wrote:
> * Szabolcs Nagy <nsz-4P1ElwuDYu6sTnJN9+BGXg@public.gmane.org> [2013-03-19 10:42:25 +0100]:
> > * Isaac Dunham <idunham-N9AOi2cAC9ZBDgjK7y7TUQ@public.gmane.org> [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 <unfinished ...>
> >
> > 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
next prev parent reply other threads:[~2013-03-19 17:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-19 6:50 Isaac Dunham
2013-03-19 9:42 ` Szabolcs Nagy
2013-03-19 11:09 ` Szabolcs Nagy
[not found] ` <20130319110939.GJ19010-4P1ElwuDYu6sTnJN9+BGXg@public.gmane.org>
2013-03-19 17:33 ` Rob Landley [this message]
2013-03-19 17:20 ` [Toybox] " Rob Landley
2013-03-19 19:32 ` [musl] " Isaac Dunham
2013-03-20 6:22 ` [Toybox] " Rob Landley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1363714409.15703.35@driftwood \
--to=rob-voji6fs/r0vr7s880joybq@public.gmane.org \
--cc=musl-ZwoEplunGu1jrUoiu81ncdBPR1lH4CV8@public.gmane.org \
--cc=toybox-oU9gvf+ajcRUPo+8YfT7LV6hYfS7NtTn@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).