justinmayer/virtualfish

`-N` / `--no-config option` in `check_fish_version` raises error in older Fish versions (checked with 3.1.2)

Closed this issue · 3 comments

  • [ x] I am using Fish shell version 3.1 or higher.
  • [x ] I am using Python version 3.8 or higher.
  • [ x] I have searched the issues (including closed ones) and believe that this is not a duplicate.
  • If related to a plugin, I prefixed the issue title with the name of the plugin.
  • OS version and name: Raspbian GNU/Linux 11 (bullseye)
  • Fish shell version: 3.1.2
  • VirtualFish version: 2.5.7

Issue

I ran vf install on an old raspberry pi and got this traceback:

zenodotus@alexandria ~> vf install
fish: invalid option -- 'N'
Traceback (most recent call last):
  File "/home/zenodotus/.local/bin/vf", line 8, in <module>
    sys.exit(main())
  File "/home/zenodotus/.local/lib/python3.9/site-packages/virtualfish/loader/cli.py", line 47, in main
    check_fish_version()
  File "/home/zenodotus/.local/lib/python3.9/site-packages/virtualfish/loader/cli.py", line 32, in check_fish_version
    fish_version = subprocess.check_output(cmd).decode("utf-8").strip()
  File "/usr/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['fish', '-N', '-c', 'echo $version']' returned non-zero exit status 1.

The fix Handle invisible characters when checking Fish version introduced the -N flag to the version check (to address check_fish_version() and tabs in fish configuration) but this flag doesn't exist in earlier versions of fish.

If I'm reading the fish changelog right they introduced that flag in version 3.3.0, which is old, but not as old as the minimum version being checked for.

This is, admittedly, a really old version of fish, so I don't know if keeping virtualfish compatible that far back is in the plan, but I was able to install virtualfish by starting a python prompt and running the install function by itself and so far it seems to work fine, other than this.

@necromuralist: Thank you for raising this topic. Another workaround could be to install an older VirtualFish version: python -m pip install virtualfish==2.5.5

@melomac: It appears the fix you suggested has had the side effect of raising the minimum required Fish version, which was not clear at the time we made that change.

It would seem we can either (1) find a way to handle invisible characters some other way (without the -N flag), or (2) explicitly increase the minimum required Fish version to use the project.

I am sorry the proposed fix for #238 raised different concerns 🙏

And I don't mind if we revert the -N option.

What about running fish --version instead of fish -c 'echo $version' ?

Example with tabs -4 and a 284-column window:

~> fish --version | xxd -p
666973682c2076657273696f6e20332e372e310a

~> fish --version 
fish, version 3.7.1

~> fish -c 'echo $version' | xxd -p
0d1b5b33671b48202020201b48202020201b48202020201b48202020201b
48202020201b48202020201b48202020201b48202020201b48202020201b
48202020201b48202020201b48202020201b48202020201b48202020201b
48202020201b48202020201b48202020201b48202020201b48202020201b
48202020201b48202020201b48202020201b48202020201b48202020201b
48202020201b48202020201b48202020201b48202020201b48202020201b
48202020201b48202020201b48202020201b48202020201b48202020201b
48202020201b48202020201b48202020201b48202020201b48202020201b
48202020201b48202020201b48202020201b48202020201b48202020201b
48202020201b48202020201b48202020201b48202020201b48202020201b
48202020201b48202020201b48202020201b48202020201b48202020201b
48202020201b48202020201b48202020201b48202020201b48202020201b
48202020201b48202020201b48202020201b48202020201b48202020201b
48202020201b48202020201b48202020201b48202020201b48202020201b
48202020201b48202020201b480d332e372e310a

By the way, thanks again for virtualfish 🤘

Fixed via #247 and released as VirtualFish 2.5.9.