Skip to content
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

printf -a results in printf: -a: unknown option #9132

Closed
Aiz0 opened this issue Aug 10, 2022 · 1 comment
Closed

printf -a results in printf: -a: unknown option #9132

Aiz0 opened this issue Aug 10, 2022 · 1 comment
Labels
bug Something that's not working as intended
Milestone

Comments

@Aiz0
Copy link

Aiz0 commented Aug 10, 2022

sys info:
fish, version 3.5.1
Linux 5.18.16-arch1-1
Terminal: foot

Tested with sh -c 'env HOME=$(mktemp -d) fish' and by prepending them by builtin

executing printf -a results in the following error

printf: -a: unknown option

(Type 'help printf' for related documentation)

From the fish documentation about printf
It doesn’t support any options, so there is no need for a -- separator, which makes it easier to use for arbitrary input than echo

executing printf -- -a works

typing printf -- and pressing tab fish suggest --help and --version as options

executing printf --help results in the man page for printf being brought up.

printf --version does not work (unknown option)

I would expect printf to not take any options and print -a without issue.

@faho
Copy link
Member

faho commented Aug 10, 2022

Broken in 9e08609, which misguidedly decided that printf's argument parsing must be normal (as a minor addition to a separate commit).

The workaround is easy: Just use printf %s -a. This is also recommended because the argument could accidentally include something that formats.

@faho faho added the bug Something that's not working as intended label Aug 10, 2022
@faho faho added this to the fish 3.6.0 milestone Aug 10, 2022
@faho faho closed this as completed in 37f7818 Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that's not working as intended
Projects
None yet
Development

No branches or pull requests

2 participants