Compare commits

...

1 commit

Author SHA1 Message Date
Maximilian Bosch 1a1008ea30
readIntoSocket: fix with store URIs containing an &
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.
2024-08-18 13:29:47 +02:00

View file

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