guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Ludovic Courtès
Subject: [bug#30256] [PATCH 3/3] scripts: environment: Add --no-cwd.
Date: Fri, 02 Mar 2018 11:54:30 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Mike Gerwitz <address@hidden> 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’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]