bug-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#73405: wrap-program should use the basename of $0 as arg0


From: Maxim Cournoyer
Subject: bug#73405: wrap-program should use the basename of $0 as arg0
Date: Sat, 21 Sep 2024 14:51:43 +0900

Hi,

I believe wrap-program should be using

--8<---------------cut here---------------start------------->8---
exec -a ${0##*/} ...
--8<---------------cut here---------------end--------------->8---

instead of

--8<---------------cut here---------------start------------->8---
exec -a "$0" ...
--8<---------------cut here---------------end--------------->8---

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:

--8<---------------cut here---------------start------------->8---
#!/gnu/store/3jhfhxdf6v5ms10x5zmnl166dh3yhbr1-bash-minimal-5.1.16/bin/bash
exec -a ${0##*/} 
"/gnu/store/0ccm05058yjd5qi8hcdr70ymhf9q6cc2-cling-1.1/bin/.cling-real" "$@"
--8<---------------cut here---------------end--------------->8---

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

--8<---------------cut here---------------start------------->8---
#!/gnu/store/3jhfhxdf6v5ms10x5zmnl166dh3yhbr1-bash-minimal-5.1.16/bin/bash
exec -a "$0" 
"/gnu/store/l8875yavr1nls7n3i3yx8ah0s1lasn43-cling-1.1/bin/.cling-real" "$@"
--8<---------------cut here---------------end--------------->8---

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]