-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bash completion mangles file names containing newline characters #704
Comments
Just for the records: I think doing this properly will be very difficult. I'd guess problems like that don't show up only for files containing newlines, but also for other characters (a filename in POSIX is rather binary and may contain everything except Very problematic would also be filenames with trailing newlines, as these get stripped off in any command substitutions. |
Actually, one part of a way to fix this, could be to "simply" use shell escaped strings for any completions that contain weird characters. E.g. having a dir with files like this:
which are actually these:
can be easily quoted from a shell script like with Problem with this shell quoting is also, that it uses Another problem is of course that this might require (many...all) completions to be adapted (the escaping would need to happen before anything like command substitution in a completion script messes things up). |
The problem of newlines is related to the design of the Bash interface for the completions, (i.e., that of I don't think there are essential problems treating the filenames containing control characters (except for the newline i.e. LF) as far as we carefully implement the completions by properly setting |
The next version of Bash has https://lists.gnu.org/archive/html/bug-bash/2023-04/msg00035.html |
Describe the bug
BASH completion cannot correctly handle file names containing newline characters.
The file names are split apart at the newlines, making them useless.
To reproduce
Expected behavior
See above, before the loading of
/usr/share/bash-completion/bash_completion
Versions (please complete the following information)
GNU/linux/Ubuntu 20.04.4 LTS
] Operating system name/distribution and version:5.0.17(1)-release
] bash version,echo "$BASH_VERSION"
:2.10
] bash-completion version,(IFS=.; echo "${BASH_COMPLETION_VERSINFO[*]}")
:Additional context
I used the nonexistent command name
xxx
so as not to invoke any helper completion scripts.Debug trace
See attached typescript.txt
The text was updated successfully, but these errors were encountered: