On Sun, Nov 15, 2026 at 09:46:35PM +0000, Heime wrote:
> hagbard@fuckup:~$ file 
> /gnu/store/5fxm6zc8gjyqz8lwplfppbzjk31d0b7z-texinfo-7.3/bin/texi2any 
> 
> /gnu/store/5fxm6zc8gjyqz8lwplfppbzjk31d0b7z-texinfo-7.3/bin/texi2any: a 
> /gnu/store/c6kh9i8hyi2ydkcykwi6fwfj0808hh82-bash-minimal-5.2.37/bin/bash 
> script, ASCII text executable, with very long lines (406)
> 
> hagbard@fuckup:~$ cat 
> /gnu/store/5fxm6zc8gjyqz8lwplfppbzjk31d0b7z-texinfo-7.3/bin/texi2any 
> 
> #!/gnu/store/c6kh9i8hyi2ydkcykwi6fwfj0808hh82-bash-minimal-5.2.37/bin/bash
> export 
> PERL5LIB="/gnu/store/qrlpxj5j2wbkb83kj6ba4ch64ap3962k-perl-archive-zip-1.68/lib/perl5/site_perl/5.36.0:/gnu/store/xpsd42896r2g8jzds4ljl84h4riwm810-perl-unicode-eastasianwidth-12.0/lib/perl5/site_perl:/gnu/store/m6b4d0fwbcbfpa17m1nw5crxj0jk6shl-perl-text-unidecode-1.30/lib/perl5/site_perl:/gnu/store/zxl0248qf05jpc6m7av83zch5ciqvv1p-perl-libintl-perl-1.32/lib/perl5/site_perl${PERL5LIB:+:}$PERL5LIB"
> exec -a "$0" 
> "/gnu/store/5fxm6zc8gjyqz8lwplfppbzjk31d0b7z-texinfo-7.3/bin/.texi2any-real" 
> "$@"
> 
>  
> > It may also be an issue with $0 in Perl, as this may not be set with the
> > argument of "exec -a".  It may be relevant that texi2any is a Perl program
> > beginning with the hash-bang "#!" to load the Perl interpreter.  I'm not
> > sure exactly what happens with the argv array in that case but it's possible
> > that argv[0] is lost.

This seems to be the case.  exec -a is ineffective when the executed program
file starts with #!.

I don't think we can do anything to fix this.

I suggest contacting the Guix developers to ask if they know of any
workarounds.

This appears to be a good explanation:
https://stackoverflow.com/questions/78225038/changing-argument-0-to-a-shell-script-not-working/78225379#78225379

The man page of "execve" is referenced:

       An interpreter script is a text file that has execute permission
       enabled and whose first line is of the form:

       #!interpreter [optional-arg]

       The interpreter must be a valid pathname for an executable file.

       interpreter will be invoked with the following arguments:

       interpreter [optional-arg] path arg...

       where arg...  is the series of words pointed to by the argv
       argument of execve(), starting at argv[1].  Note that there is no
       way to get the argv[0] that was passed to the execve() call.

https://man7.org/linux/man-pages/man2/execve.2.html

Reply via email to