Checklist
Output of fzf --version
0.73.0 (a24deef)
OS
Shell
Problem / Steps to reproduce
In v0.73.0, every child process fzf spawns (eg,. preview) fails to start when the current item contains a NUL byte. v0.72.0 is unaffected.
The regression was introduced by #4803, which adds FZF_CURRENT_ITEM to the child environment by appending the raw item text:
|
if item := t.currentItem(); item != nil { |
|
env = append(env, "FZF_CURRENT_ITEM="+item.AsString(t.ansi)) |
|
} |
Items may contain NUL bytes (e.g. when --delimiter='\x00' is used to encode multi-field records on a single line). Go's os/exec rejects any environment entry containing NUL and the spawn fails, as the following command shows:
$ printf '\0foo\0/\n' | fzf --delimiter=$'\0' --preview 'echo ok'
- v0.72.0: preview window shows ok, fzf is usable.
- v0.73.0: the preview pane reports
exec: environment variable contains NUL.
A typical project affected is Aloxaf/fzf-tab, which is a widely-used Zsh completion plugin. It uses \n as record separator and \x00 as an inner field delimiter to encode colors per line, paired with --delimiter='\x00' --nth=2,3. This is its core data format and has worked across many previous fzf versions. After upgrading fzf to v0.73.0, all fzf-tab previews stop working and complain the os/exec error.
Checklist
man fzf)Output of
fzf --version0.73.0 (a24deef)
OS
Shell
Problem / Steps to reproduce
In v0.73.0, every child process fzf spawns (eg,. preview) fails to start when the current item contains a NUL byte. v0.72.0 is unaffected.
The regression was introduced by #4803, which adds
FZF_CURRENT_ITEMto the child environment by appending the raw item text:fzf/src/terminal.go
Lines 1441 to 1443 in de1fca9
Items may contain NUL bytes (e.g. when --delimiter='\x00' is used to encode multi-field records on a single line). Go's os/exec rejects any environment entry containing NUL and the spawn fails, as the following command shows:
exec: environment variable contains NUL.A typical project affected is Aloxaf/fzf-tab, which is a widely-used Zsh completion plugin. It uses \n as record separator and \x00 as an inner field delimiter to encode colors per line, paired with
--delimiter='\x00' --nth=2,3. This is its core data format and has worked across many previous fzf versions. After upgrading fzf to v0.73.0, all fzf-tab previews stop working and complain the os/exec error.