News for hackers. Stuff that matters.
Re:A surprise with how ' ' handles its program argument in p... by tombert on Wednesday November 19, 2025 @11:56PM (#45989129)
I'm not sure the reason then, but they're definitely right; it works fine with zsh, doesn't work with bash. I wrote a test script to try it myself.

I don't have fish installed and can't be bothered to go that far, but I suspect they're right about that as well.

Re:A surprise with how ' ' handles its program argument in p... by anotherhue on Thursday November 20, 2025 @12:10AM (#45989201)
env bash is all well and good for normies, but if you're already on NixOS did you know you can have nix-shell be your interpreter and back flip into any reproducible interpreted environment you like?

https://nixos.wiki/wiki/Nix-shell_shebang

Re:A surprise with how ' ' handles its program argument in p... by SAI_Peregrinus on Thursday November 20, 2025 @11:45AM (#45994640)
Or any other system with Nix installed. I use this at work to provide scripts with all their dependencies specified that work across any Linux distro & MacOS. First execution is slow since it has to fetch everything, but after that it's fast and just works.
Re:A surprise with how ' ' handles its program argument in p... by opello on Thursday November 20, 2025 @01:39AM (#45989642)
It is strange, cursory digging for an explanation was a little more complex than I bargained for...

https://github.com/torvalds/linux/blob/v6.17/fs/binfmt_scrip...

I think it makes it to calling open_exec but there's a test for BINPRM_FLAGS_PATH_INACCESSIBLE, which doesn't seem relevant since 'bash' isn't like '/dev/fd/<fd>/..', but does provoke an ENOENT.

https://github.com/torvalds/linux/blob/v6.17/fs/exec.c#L1445

Maybe someone else can explain it, I'd enjoy the details, and ran out of steam.