From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: Using 'system*' instead of 'system' in 'guix environment' Date: Thu, 08 Oct 2015 09:53:02 +0200 Message-ID: <87ziztyext.fsf@gnu.org> References: <87io6iqhbt.fsf@izanagi.i-did-not-set--mail-host-address--so-tickle-me> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zk61j-0006BI-0i for guix-devel@gnu.org; Thu, 08 Oct 2015 03:55:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zk60e-0000gz-Sm for guix-devel@gnu.org; Thu, 08 Oct 2015 03:54:10 -0400 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") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: David Thompson Cc: guix-devel@gnu.org Hi! David Thompson 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: =E2=80=9Cssh HOST some command and arguments=E2=80=9D. > 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=E2=80=99s orthogonal to the question of whether to use =E2=80=98= system=E2=80=99 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 =E2=80=98system=E2=80=99 does, but we= can use =E2=80=98system*=E2=80=99 the way I wrote above to achieve that.) So I think the new UI should essentially =E2=80=98string-join=E2=80=99 ever= ything that comes after --, and pass that to the procedure that invokes sh -c. How does that sound? Thanks for looking into it! Ludo=E2=80=99.