From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#19742: 'wrap-program' should really preserve argv[0] Date: Mon, 23 Feb 2015 20:42:58 +0100 Message-ID: <878ufo5s8t.fsf@gnu.org> References: <877fw1e2fq.fsf@gnu.org> <20150215163907.GA6404@debian> 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]:33555) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YPyvD-00012C-OC for bug-guix@gnu.org; Mon, 23 Feb 2015 14:44:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YPyvC-0008Hi-NZ for bug-guix@gnu.org; Mon, 23 Feb 2015 14:44:03 -0500 Received: from debbugs.gnu.org ([140.186.70.43]:52252) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YPyvC-0008He-K9 for bug-guix@gnu.org; Mon, 23 Feb 2015 14:44:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YPyvC-0005nm-8T for bug-guix@gnu.org; Mon, 23 Feb 2015 14:44:02 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <20150215163907.GA6404@debian> (Andreas Enge's message of "Sun, 15 Feb 2015 17:39:07 +0100") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: Andreas Enge Cc: 19742@debbugs.gnu.org Andreas Enge skribis: > * guix/build/utils.scm (wrap-program): Create scripts that use $0 (which = is > usually just the base name) instead of the absolute path to the origi= nal > program. Alternative implementation of 2ed11b3. > > Co-authored-by: Ludovic Court=C3=A8s > > Closes . > --- > guix/build/utils.scm | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/guix/build/utils.scm b/guix/build/utils.scm > index c7fdd1d..a3446cb 100644 > --- a/guix/build/utils.scm > +++ b/guix/build/utils.scm > @@ -816,7 +816,7 @@ contents: > #!location/of/bin/bash > export PATH=3D\"/gnu/.../bar/bin\" > export CERT_PATH=3D\"$CERT_PATH${CERT_PATH:+:}/gnu/.../baz/certs:/qux/= certs\" > - exec -a location/of/foo location/of/.foo-real \"$@\" > + exec -a $0 location/of/.foo-real \"$@\" >=20=20 > This is useful for scripts that expect particular programs to be in $PAT= H, for > programs that expect particular shared libraries to be in $LD_LIBRARY_PA= TH, or > @@ -870,11 +870,10 @@ the previous wrapper." > (with-output-to-file prog-tmp > (lambda () > (format #t > - "#!~a~%~a~%exec -a \"~a\" \"~a\" \"$@\"~%" > + "#!~a~%~a~%exec -a \"$0\" \"~a\" \"$@\"~%" > (which "bash") > (string-join (map export-variable vars) > "\n") > - (canonicalize-path prog) Indeed, it=E2=80=99s better this way. Please apply to =E2=80=98core-update= s=E2=80=99 if not already done. Thanks, Ludo=E2=80=99.