GNU bug report logs - #19742
'wrap-program' should really preserve argv[0]

Previous Next

Package: guix;

Reported by: ludo <at> gnu.org (Ludovic Courtès)

Date: Sun, 1 Feb 2015 23:32:02 UTC

Severity: normal

Done: Andreas Enge <andreas <at> enge.fr>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 19742 in the body.
You can then email your comments to 19742 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#19742; Package guix. (Sun, 01 Feb 2015 23:32:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to ludo <at> gnu.org (Ludovic Courtès):
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Sun, 01 Feb 2015 23:32:02 GMT) Full text and rfc822 format available.

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

From: ludo <at> gnu.org (Ludovic Courtès)
To: bug-guix <at> gnu.org
Subject: 'wrap-program' should really preserve argv[0]
Date: Sun, 01 Feb 2015 22:39:53 +0100
[Message part 1 (text/plain, inline)]
It should be enough, and more appropriate, to simply preserve argv[0] in
wrappers.

Ludo’.

[Message part 2 (text/x-patch, inline)]
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 4407f9a..ebe70a3 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -870,8 +870,7 @@ the previous wrapper."
     (with-output-to-file prog-tmp
       (lambda ()
         (format #t
-                "#!~a~%~a~%exec -a \"~a\" \"~a\" \"$@\"~%"
-                (which "bash")
+                "#!~a~%~a~%exec -a \"$0\" \"~a\" \"$@\"~%"
                 (string-join (map export-variable vars)
                              "\n")
                 (canonicalize-path prog)

Reply sent to Andreas Enge <andreas <at> enge.fr>:
You have taken responsibility. (Mon, 16 Feb 2015 14:27:03 GMT) Full text and rfc822 format available.

Notification sent to ludo <at> gnu.org (Ludovic Courtès):
bug acknowledged by developer. (Mon, 16 Feb 2015 14:27:03 GMT) Full text and rfc822 format available.

Message #10 received at 19742-done <at> debbugs.gnu.org (full text, mbox):

From: Andreas Enge <andreas <at> enge.fr>
To: 19742-done <at> debbugs.gnu.org
Subject: Close
Date: Mon, 16 Feb 2015 15:26:28 +0100
Applied in commit b01f89675d03202851a00c38d4995424bbb1879f.

Andreas





Information forwarded to bug-guix <at> gnu.org:
bug#19742; Package guix. (Mon, 23 Feb 2015 19:44:02 GMT) Full text and rfc822 format available.

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

From: ludo <at> gnu.org (Ludovic Courtès)
To: Andreas Enge <andreas <at> enge.fr>
Cc: 19742 <at> debbugs.gnu.org
Subject: Re: bug#19742: 'wrap-program' should really preserve argv[0]
Date: Mon, 23 Feb 2015 20:42:58 +0100
Andreas Enge <andreas <at> enge.fr> 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 original
>     program. Alternative implementation of 2ed11b3.
>
> Co-authored-by: Ludovic Courtès <ludo <at> gnu.org>
>
> Closes <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19742>.
> ---
>  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=\"/gnu/.../bar/bin\"
>    export CERT_PATH=\"$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 \"$@\"
>  
>  This is useful for scripts that expect particular programs to be in $PATH, for
>  programs that expect particular shared libraries to be in $LD_LIBRARY_PATH, 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’s better this way.  Please apply to ‘core-updates’ if not
already done.

Thanks,
Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 24 Mar 2015 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 148 days ago.

Previous Next


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