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

funcsave -q is not actually quiet #8830

Closed
anhnamtran opened this issue Mar 24, 2022 · 1 comment
Closed

funcsave -q is not actually quiet #8830

anhnamtran opened this issue Mar 24, 2022 · 1 comment
Labels
regression Something that used to work, but was broken, especially between releases
Milestone

Comments

@anhnamtran
Copy link

Fish Version: 3.4.0
OS Version: Linux 5.4.0-104-generic #118~18.04.1-Ubuntu SMP Thu Mar 3 13:53:15 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
TERM: xterm-256color

I've tried fish without any third-party customizations by executing:

sh -c 'env HOME=$(mktemp -d) fish'

And running the following:

username@host /h/username> function testFunc; echo "Test"; end; funcsave -q testFunc

Expected behavior

username@host /h/username> function testFunc; echo "Test"; end; funcsave -q testFunc
username@host /h/username>

Actual behavior

username@host /h/username> function testFunc; echo "Test"; end; funcsave -q testFunc
funcsave: wrote /tmp/tmp.Jhyt5f19Lo/.config/fish/functions/testFunc.fish
username@host /h/username>

The actual behavior is synonymous to running the command without the -q flag.

Reasoning
I believe this is a small-ish bug, the 3.4.0 version of funcsave incorrectly defines/checks the -q flag. That is, line 2 defines the opt as just q, while line 32 checks for _flag_quiet.

Per the argparse documentation for 3.4.0

x means that only -x is valid. It is a boolean that can be used more than once. If it is seen then _flag_x will be set to the count of how many times the flag was seen.

So either funcsave needs to declare q/quiet for the opts, or check _flag_q instead.

I've tested it by editing the funcsave.fish in my /usr/share/fish/functions/funcsave.fish to have q/quiet and the behavior was fixed.

@faho
Copy link
Member

faho commented Mar 24, 2022

It appears this long option was removed in ed8c78c? That seems unfortunately misguided.

Terribly sorry about that, I'm putting it right back in.

@faho faho closed this as completed in 2c702de Mar 24, 2022
@faho faho added this to the fish 3.4.1 milestone Mar 24, 2022
@faho faho added the regression Something that used to work, but was broken, especially between releases label Mar 24, 2022
faho added a commit that referenced this issue Mar 24, 2022
This reverts ed8c78c, emphatically.

Fixes #8830

(cherry picked from commit 2c702de)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression Something that used to work, but was broken, especially between releases
Projects
None yet
Development

No branches or pull requests

2 participants