From: ludo@gnu.org (Ludovic Courtès)
To: David Thompson <dthompson2@worcester.edu>
Cc: guix-devel@gnu.org
Subject: Re: Using 'system*' instead of 'system' in 'guix environment'
Date: Thu, 08 Oct 2015 09:53:02 +0200 [thread overview]
Message-ID: <87ziztyext.fsf@gnu.org> (raw)
In-Reply-To: <87io6iqhbt.fsf@izanagi.i-did-not-set--mail-host-address--so-tickle-me> (David Thompson's message of "Wed, 07 Oct 2015 21:28:38 -0400")
Hi!
David Thompson <dthompson2@worcester.edu> skribis:
> In an effort to finish up a patch to add a --container flag to 'guix
> environment', I've encountered a serious problem. The --exec flag
> allows the user to pass an arbitrary command to be run using 'system'.
> Unlike 'system*', 'system' spawns a command interpreter first and passes
> the command string in. This is very problematic when using a container,
> because there's a very good chance that the command interpreter of the
> running Guile process is not mounted inside the container.
Oooh, good catch!
How about using something like:
(system* (or (the-container-shell) (getenv "SHELL") "/bin/sh")
"-c" the-string)
?
> If the above explanation is confusing, the 'sudo' program provides a
> good example of the UI I'm after:
>
> sudo guile -c '(do-root-things)'
Or similarly: “ssh HOST some command and arguments”.
> But for now we're stuck with this:
>
> guix environment --ad-hoc guile -E "guile -c '(do-root-things)'"
>
> Now, we can't actually do exactly what 'sudo' does because 'guix
> environment' already recognizes operands as package names, not program
> arguments. Perhaps we can use '--' to separate the package list from
> the command to run:
>
> guix environment --ad-hoc guile -- guile -c '(do-root-things)'
>
> Does that look okay? Any other ideas?
I really like the UI that you propose; using -- to separate the
arguments sounds good.
I think it’s orthogonal to the question of whether to use ‘system’ or
not though.
Currently one can do things like:
guix environment foo -E 'cd /bar ; frob'
and I think we should keep this capability, which means running the
command via /bin/sh -c (which is what ‘system’ does, but we can use
‘system*’ the way I wrote above to achieve that.)
So I think the new UI should essentially ‘string-join’ everything that
comes after --, and pass that to the procedure that invokes sh -c.
How does that sound?
Thanks for looking into it!
Ludo’.
next prev parent reply other threads:[~2015-10-08 7:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-08 1:28 Using 'system*' instead of 'system' in 'guix environment' David Thompson
2015-10-08 7:53 ` Ludovic Courtès [this message]
2015-10-08 12:41 ` Thompson, David
2015-10-08 14:59 ` Ludovic Courtès
2015-10-08 15:42 ` Thompson, David
2015-10-08 16:05 ` Taylan Ulrich Bayırlı/Kammer
2015-10-08 16:32 ` Thompson, David
2015-10-08 17:10 ` Taylan Ulrich Bayırlı/Kammer
2015-10-08 16:53 ` Ludovic Courtès
2015-10-08 17:12 ` Thompson, David
2015-10-09 1:29 ` Thompson, David
2015-10-09 12:23 ` Ludovic Courtès
2015-10-09 16:21 ` Thompson, David
2015-10-08 15:09 ` Taylan Ulrich Bayırlı/Kammer
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ziztyext.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=dthompson2@worcester.edu \
--cc=guix-devel@gnu.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.savannah.gnu.org/cgit/guix.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).