This would have prevented #6323.
While we don't want to pepper `command` everywhere, `psub` is kind of
a core thing, so we should try to proof it against common problems.
Prior to this fix, we would write to a fifo via cat >$filename & .
However in some cases (and soon in all cases) we open the file before
the fork, not after. This results in a deadlock because the file open
cannot succeed until a write begins.
Switch to using tee to write to the file. Because tee opens the file itself,
fish is no longer responsible and the deadlock is resolved.
Prior to this fix, we would write to a fifo via cat >$filename & .
However in some cases (and soon in all cases) we open the file before
the fork, not after. This results in a deadlock because the file open
cannot succeed until a write begins.
Switch to using tee to write to the file. Because tee opens the file itself,
fish is no longer responsible and the deadlock is resolved.
The recent change to switch `psub` to use `argparse` caused it to use
a fifo by default because it inadvertently fixed a long standing bug in
the fish script. This changes the behavior back to `psub --file` being
the default behavior and introduces a `--fifo` flag. It also updates the
documentation to make it clearer when and why `--fifo` mode should not
be used.
Fixes#4222
I hate doing this but I am tired of touching a fish script as part of
some change and having `make style` radically change it. Which makes
editing fish scripts more painful than it needs to be. It is time to do
a wholesale reformatting of these scripts to conform to the documented
style as implemented by the `fish_indent` program.
Fix for CVE-2014-2906.
Closes a race condition in funced which would allow execution of
arbitrary code; closes a race condition in psub which would allow
alternation of the data stream.
Note that `psub -f` does not work (#1040); a fix should be committed
separately for ease of maintenance.
Closes#1437