From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH 14/15] scripts: environment: Add --container option. Date: Sun, 11 Oct 2015 21:34:18 +0200 Message-ID: <87a8rpyzb9.fsf@gnu.org> References: <1436188604-2813-1-git-send-email-dthompson2@worcester.edu> <1436188604-2813-14-git-send-email-dthompson2@worcester.edu> <87zj38f326.fsf@gnu.org> <87oah93zbk.fsf@gnu.org> 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]:34865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlMO2-0003K6-65 for guix-devel@gnu.org; Sun, 11 Oct 2015 15:34:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZlMNx-0006Zy-66 for guix-devel@gnu.org; Sun, 11 Oct 2015 15:34:26 -0400 In-Reply-To: (David Thompson's message of "Sat, 10 Oct 2015 17:11:41 -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: "Thompson, David" Cc: guix-devel , David Thompson Hi! I think I got it. First, note that: --8<---------------cut here---------------start------------->8--- $ guix build guile-bootstrap=20 /gnu/store/aiz8db2gni401wc9fgidmcggxyb1czis-guile-bootstrap-2.0 $ cat /gnu/store/aiz8db2gni401wc9fgidmcggxyb1czis-guile-bootstrap-2.0/bin/g= uile=20 #!/gnu/store/gvwf71vddp8c1d7ydqg02p43mgdjrx6s-bash export GUILE_SYSTEM_PATH=3D/gnu/store/aiz8db2gni401wc9fgidmcggxyb1czis-guil= e-bootstrap-2.0/share/guile/2.0 export GUILE_SYSTEM_COMPILED_PATH=3D/gnu/store/aiz8db2gni401wc9fgidmcggxyb1= czis-guile-bootstrap-2.0/lib/guile/2.0/ccache exec -a "$0" /gnu/store/aiz8db2gni401wc9fgidmcggxyb1czis-guile-bootstrap-2.= 0/bin/.guile-real "$@" --8<---------------cut here---------------end--------------->8--- So: > [pid 32626] execve("/home/dave/Code/guix/test-tmp/store/w8fsskwxr793yq6w3= 368x5k1p07syi3h-guile-bootstrap-2.0/bin/guile", ["guile", "-c", "(exit 42)"= ], [/* 6 vars */]) =3D -1 ENOEXEC (Exec format error) > [pid 32626] execve("/gnu/store/sybvv7vqvqqmijpn2ql1p6yk61cr5y3k-bash-stat= ic-4.3.39/bin/bash", ["/gnu/store/sybvv7vqvqqmijpn2ql1p"..., "/home/dave/Co= de/guix/test-tmp/st"..., "-c", "(exit 42)"], [/* 6 vars */]) =3D -1 ENOENT = (No such file or directory) > [pid 32626] write(2, "In execvp of guile: No such file"..., 46In execvp o= f guile: No such file or directory > ) =3D 46 The first =E2=80=98execve=E2=80=99 fails. The =E2=80=98execve=E2=80=99 com= es from libc itself, which notices ENOEXEC and thus falls back to interpreting the executable with _PATH_BSHELL (see posix/execvpe.c.) However, the _PATH_BSHELL that is taken here is the one from /gnu/store rather than the one from /home/dave/Code/guix/test-tmp/=E2=80=A6; this is because that=E2=80=99s the _PATH_BSHELL value for the libc of the Guile that runs =E2=80=98guix environment=E2=80=99. (This is a problem in the test en= vironment because of the wrong _PATH_BSHELL, but it happens to work well out side of the test environment.) Now, I=E2=80=99m not sure why the first =E2=80=98execve=E2=80=99 shell; nor= mally shebangs are interpreted directly by the kernel, in fs/binfmt_script.c. It seems that the file mentioned in the shebang of =E2=80=98guile=E2=80=99 = is correctly mapped: > [pid 32625] mount("/home/dave/Code/guix/test-tmp/store/xh177jawf1hl22wm1r= zfq7dgn9iz67jy-bash", "/tmp/guix-directory.Datz1K//home/dave/Code/guix/test= -tmp/store/xh177jawf1hl22wm1rzfq7dgn9iz67jy-bash", 0x1d97b30, MS_RDONLY|MS_= BIND, NULL) =3D 0 > [pid 32625] mount("/home/dave/Code/guix/test-tmp/store/xh177jawf1hl22wm1r= zfq7dgn9iz67jy-bash", "/tmp/guix-directory.Datz1K//home/dave/Code/guix/test= -tmp/store/xh177jawf1hl22wm1rzfq7dgn9iz67jy-bash", 0x13c3b30, MS_RDONLY|MS_= REMOUNT|MS_BIND, NULL) =3D 0 Could it be that it lacks the executable bit? Ludo=E2=80=99.