From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eriLB-0007ob-Gv for guix-patches@gnu.org; Fri, 02 Mar 2018 05:55:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eriL8-0007qA-DP for guix-patches@gnu.org; Fri, 02 Mar 2018 05:55:05 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:60488) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eriL8-0007q3-93 for guix-patches@gnu.org; Fri, 02 Mar 2018 05:55:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eriL7-00017y-Qa for guix-patches@gnu.org; Fri, 02 Mar 2018 05:55:01 -0500 Subject: [bug#30256] [PATCH 3/3] scripts: environment: Add --no-cwd. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <87vag2wopo.fsf@gnu.org> <7bc71eaa3cff48ec7dc0d4fe406dde9482b716a9.1516937216.git.mtg@gnu.org> Date: Fri, 02 Mar 2018 11:54:30 +0100 In-Reply-To: <7bc71eaa3cff48ec7dc0d4fe406dde9482b716a9.1516937216.git.mtg@gnu.org> (Mike Gerwitz's message of "Thu, 25 Jan 2018 22:29:45 -0500") Message-ID: <87tvtyhhnd.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Mike Gerwitz Cc: 30256@debbugs.gnu.org Mike Gerwitz 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 fo= r 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=E2=80=99s just a minor issue: > --- a/tests/guix-environment.sh > +++ b/tests/guix-environment.sh > @@ -84,6 +84,14 @@ HOME=3D"$tmpdir" guix environment --bootstrap --contai= ner --user=3Dfoognu \ > --share=3D"$tmpdir/umock" \ > -- guile -c "$usertest" >=20=20 > +# if not sharing CWD, chdir home > +( > + cd "$tmpdir" \ > + && guix environment --bootstrap --container --no-cwd --user=3Dfoo \ > + --ad-hoc guile-bootstrap --pure \ > + -- /bin/sh -c 'test $(pwd) =3D=3D "/home/foo" -a ! -d '"$tmp= dir" > +) > + 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=3Dfoo= --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-u= rls=3D"$GUIX_BINARY_SUBSTITUTE_URL" $ echo $? 1 --8<---------------cut here---------------end--------------->8--- Thoughts? TIA, Ludo=E2=80=99.