Skip to content

Commit

Permalink
readIntoSocket: fix with store URIs containing an &
Browse files Browse the repository at this point in the history
The third argument to `open()` in `-|` mode is passed to a shell if it's
a string. In my case the store URI contains
`?secret-key=${signingKey.directory}/secret&compression=zstd`

For the `nix store cat` case this means that

* until `&` the process will be started in the background. This fails
  immediately because no path to cat is specified.
* `compression=zstd` is a variable assignment
* the `$path` argument to `store cat` is attempted to be executed as
  another command

Passing just the list solves the problem.

(cherry picked from commit 3ee51db)
  • Loading branch information
Ma27 authored and mweinelt committed Feb 12, 2025
1 parent d6a3ef4 commit 90399cb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/lib/Hydra/Helper/Nix.pm
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,7 @@ sub readIntoSocket{
my $sock;

eval {
my $x= join(" ", @{$args{cmd}});
open($sock, "-|", $x) or die q(failed to open socket from command:\n $x);
open($sock, "-|", @{$args{cmd}}) or die q(failed to open socket from command:\n $x);
};

return $sock;
Expand Down

0 comments on commit 90399cb

Please sign in to comment.