summaryrefslogtreecommitdiffhomepage
path: root/tests/tools/git@git.abendless.com:
diff options
context:
space:
mode:
authorSean Kurtz <seankurtz75@gmail.com>2026-11-28 00:37:39 -0600
committerSean Kurtz <seankurtz75@gmail.com>2026-11-28 00:37:39 -0600
commitd538cc8ce9c32c932e12134b7bd59a88e88d748c (patch)
tree835e1db938c5a67465ffbe556d7e58683619a54e /tests/tools/git@git.abendless.com:
parent662f3b37dcfad0fd2f193762464c1b9701c96db9 (diff)
downloadzash-d538cc8ce9c32c932e12134b7bd59a88e88d748c.tar.gz
fix(edit): quote the temporary file name for the editor
`v` and `fc -e` handed the editor "%s %s" of the editor and the mkstemp file name, unquoted: with a TMPDIR holding a space or a `$` the editor saw a path cut at the space, wrote nothing, and `fc` ran the original commands again. The name now goes through out_quote() into an OUT_MEM buffer, so the shell reads it back as one word; `sprintf` is gone. Both commands also left the file behind when the editor command raised an exception (a syntax error in $EDITOR, for one), because the raise jumps past unlink(). They now catch it, unlink, and re-raise, the same way the builtin wrapper in exec.c does. fc_edit() also ignored a write error on the temporary file and went on to run the editor; it now reports it and removes the file. Test: tests/linux/i-fc-tmpdir.sh runs fc and `v` with TMPDIR="tmp dir$x" through ptydrive, including a raising editor command, and then checks the directory is empty. Without the change the editor is handed the broken path and no file appears. Verified on Linux with make check and the test under ASan+UBSan.
Diffstat (limited to 'tests/tools/git@git.abendless.com:')
0 files changed, 0 insertions, 0 deletions