wrap-program should use the basename of $0 as arg0

  • Open
  • quality assurance status badge
Details
One participant
  • Maxim Cournoyer
Owner
unassigned
Submitted by
Maxim Cournoyer
Severity
normal
M
M
Maxim Cournoyer wrote on 21 Sep 07:51 +0200
(name . bug-guix)(address . bug-guix@gnu.org)
87a5g1o8pc.fsf@gmail.com
Hi,

I believe wrap-program should be using

Toggle snippet (3 lines)
exec -a ${0##*/} ...

instead of

Toggle snippet (3 lines)
exec -a "$0" ...

as the later will use the full file name of the command
(/gnu/store/.../bin/something) instead of just the command name, which
is more conventional.

I made this discovery while investigating a segfault that occured in a
wrapped 'cling'; adjusting the wrapper script to read as:

Toggle snippet (4 lines)
#!/gnu/store/3jhfhxdf6v5ms10x5zmnl166dh3yhbr1-bash-minimal-5.1.16/bin/bash
exec -a ${0##*/} "/gnu/store/0ccm05058yjd5qi8hcdr70ymhf9q6cc2-cling-1.1/bin/.cling-real" "$@"

where the value of -a becomes 'cling' instead of its full file name
resolved the issue. The original wrapper reads like:

Toggle snippet (4 lines)
#!/gnu/store/3jhfhxdf6v5ms10x5zmnl166dh3yhbr1-bash-minimal-5.1.16/bin/bash
exec -a "$0" "/gnu/store/l8875yavr1nls7n3i3yx8ah0s1lasn43-cling-1.1/bin/.cling-real" "$@"

It's probably rare that this "problem" would manifest itself so
critically, but still, I think it'd be good to adjust our wrap-program
procedure. I'll send a patch.

--
Thanks,
Maxim
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 73405@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 73405
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch