Fish nix
completion function reliably erases/writes over the shell prompt. #513
Labels
No labels
Area/build-packaging
Area/cli
Area/evaluator
Area/fetching
Area/flakes
Area/language
Area/profiles
Area/protocol
Area/releng
Area/remote-builds
Area/repl
Area/store
bug
crash 💥
Cross Compilation
devx
docs
Downstream Dependents
E/easy
E/hard
E/help wanted
E/reproducible
E/requires rearchitecture
imported
Needs Langver
OS/Linux
OS/macOS
performance
regression
release-blocker
RFD
stability
Status
blocked
Status
invalid
Status
postponed
Status
wontfix
testing
testing/flakey
ux
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lix-project/lix#513
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Describe the bug
The new progress bar (which outputs terminal escape sequences on stderr) can impact shell completion, causing e.g.
fish
prompts to be erased and/or written over.I've only tested
fish
(the main shell I use), but I suspect other shells might also affected.Steps To Reproduce
fish
nix
(with a space at the end) and press TABAnother way to see this issue is running these commands:
Expected behavior
When performing completions, the progress bar shouldn't be shown on stderr, as its
\r\e[K
line erase sequences end up applying to the prompt (or to theA
in the commands above).Either
nix
should behave differently whenNIX_GET_COMPLETIONS
is set (i.e. turning off the progress bar),or the completion script wrapping the command should redirect stderr (which is what a lot of completion scripts do when wrapping commands they don't control, but that's probably suboptimal here).(EDIT: see comment below, looks like
NIX_GET_COMPLETIONS
disabling the progress bar already was the case, and was accidentally bypassed by a string->enum refactor)nix --version
outputI've come up with this hacky workaround for now:
However, @solson brought to my attention that this was more accidental than I thought:
NIX_GET_COMPLETIONS
env var does get checked inparseLogFormat
:https://git.lix.systems/lix-project/lix/src/tag/2.91.0/src/libmain/loggers.cc#L10-L11
setLogFormat
(other than--log-format
, which runs too late) pass a string,so
parseLogFormat
(which respects the env var) never gets called normally(and even with e.g.
--log-format=raw
, the damage has already been done by that point)main
call reveals that it recently changed: (which accidentally bypassed theNIX_GET_COMPLETIONS
env var check)cc @alois31 @qyriad
I also tried using
asciinema rec -c "NIX_GET_COMPLETIONS=1 nix '' >/dev/null"
to see what Lix is actually printing:(This is asciinema's internal format with I guess timestamps, some tag, and then the captured terminal output.)
So it's apparently printing
\r\e[K
quite a number of times when the progress bar is enabled, which might be considered a separate issue even if the progress bar gets re-disabled forNIX_GET_COMPLETIONS
. (I'm not sure.)This issue was mentioned on Gerrit on the following CLs: