GNU bug report logs - #30256
[PATCH 3/3] scripts: environment: Add --no-cwd.

Previous Next

Package: guix-patches;

Reported by: Mike Gerwitz <mtg <at> gnu.org>

Date: Fri, 26 Jan 2018 03:31:03 UTC

Severity: normal

Tags: moreinfo, patch

Merged with 30254

Done: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 30256 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Mike Gerwitz <mtg <at> gnu.org>
Cc: 30256 <at> debbugs.gnu.org
Subject: Re: [bug#30256] [PATCH 3/3] scripts: environment: Add --no-cwd.
Date: Fri, 02 Mar 2018 11:54:30 +0100
Mike Gerwitz <mtg <at> gnu.org> skribis:

> * doc/guix.texi (Invoking guix environment): Add --no-cwd.
> * guix/scripts/environment.scm (show-help, %options): Add --no-cwd.
> (launch-environment/container): Add 'map-cwd?' param; only add mapping for cwd
> if #t.  Only change to cwd within container if #t, otherwise home.
> (guix-environment): Error if --no-cwd without --container.  Provide '(not
> no-cwd?)' to launch-environment/container as 'map-cwd?'.
> * tests/guix-environment.sh: Add test for no-cwd.

This one LGTM as well (with the test moved to
guix-environment-container.sh).  There’s just a minor issue:

> --- a/tests/guix-environment.sh
> +++ b/tests/guix-environment.sh
> @@ -84,6 +84,14 @@ HOME="$tmpdir" guix environment --bootstrap --container --user=foognu \
>       --share="$tmpdir/umock" \
>       -- guile -c "$usertest"
>  
> +# if not sharing CWD, chdir home
> +(
> +  cd "$tmpdir" \
> +    && guix environment --bootstrap --container --no-cwd --user=foo  \
> +            --ad-hoc guile-bootstrap --pure \
> +            -- /bin/sh -c 'test $(pwd) == "/home/foo" -a ! -d '"$tmpdir"
> +)
> +

This test would fail for me because my test store is at
~ludo/src/guix/test-tmp/store and my CWD is ~/src/guix.  So when using
both --user and --no-cwd, the effect is that
~ludo/src/guix/test-tmp/store is not available at all within the
container, and thus execve("/bin/sh") fails with ENOENT:

--8<---------------cut here---------------start------------->8---
$ ./test-env guix environment --bootstrap --container --no-cwd --user=foo --ad-hoc guile-bootstrap
accepted connection from pid 29684, user ludo
accepted connection from pid 29695, user ludo
./test-env: line 1: 29683 Terminated              "/home/ludo/src/guix/pre-inst-env" "/home/ludo/src/guix/guix-daemon" --disable-chroot --substitute-urls="$GUIX_BINARY_SUBSTITUTE_URL"
$ echo $?
1
--8<---------------cut here---------------end--------------->8---

Thoughts?

TIA,
Ludo’.




This bug report was last modified 3 years and 315 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.