Fish-shell: Occasional `command: Unknown option “-q”`

Created on 14 Feb 2017  ·  3Comments  ·  Source: fish-shell/fish-shell

  • [x] Have you checked if problem occurs with fish 2.5.0?
  • [ ] Tried fish without third-party customizations (check sh -c 'env HOME=$(mktemp -d) fish')?

fish version installed (fish --version):

2.5.0

OS/terminal used:

Arch linux. URxvt

After using fish shell session for a while it gets into a state when command built in fails whenever -q option is used. This can be noticed cancelling command line (that calls command -sq).

ogondza@arch ~ $ date
2017-02-14 15:01:20
# Up and Ctrl + C
ogondza@arch ~ $ datecommand: Unknown option “-sq”
/usr/share/fish/functions/__fish_cancel_commandline.fish (line 12):         if command -sq tput
                                                                               ^
in function “__fish_cancel_commandline”
    called on standard input


       command -- run a program

   Synopsis
       command [OPTIONS] COMMANDNAME [ARGS...]

   Description
       ...
       Additionally passing a -q or --quiet option prevents any paths from
       being printed, like the type -q, for testing only the exit status.
       ...

This can be reproduced easily once fish gets into this state using:

ogondza@arch ~ $ type command
command is a builtin
ogondza@arch ~ $ command -s test
/usr/bin/test
ogondza@arch ~ $ command -s -q test
command: Unknown option “-q”
...

The problem does not manifest in new fish session and it is unknown to me what triggers this behavior. How can I debug this further?

question

All 3 comments

This option was added via #3591 and is included in the 2.5.0 release.

The most likely cause is that you are running an older fish that loads in the newer scripts - echo $FISH_VERSION should confirm this. The solution is to stop doing that.

Edit: What I mean is that this should clear itself up once you quit the old instances and start new ones. E.g. this should disappear completely after you have rebooted.

ogondza@arch ~ $ fish -version
fish, version 2.5.0
ogondza@arch ~ $ echo $FISH_VERSION 
2.4.0

Seems that is the problem. Thanks.

Let's move the summary to FAQ or Wiki.
This just bit me after 2.4.0 to 2.6.0 upgrade.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Limeth picture Limeth  ·  3Comments

yqiang picture yqiang  ·  3Comments

luc-j-bourhis picture luc-j-bourhis  ·  3Comments

badp picture badp  ·  3Comments

spacekookie picture spacekookie  ·  3Comments