Skip to content

virtualenv activate.fish fails on openbsd #2892

Open
@r5d

Description

@r5d

Currently, activate.fish uses:

echo $FISH_VERSION | head -c 1

to get fish's major version, which fails on OpenBSD as the
head in OpenBSD does not have a -c flag.

ada$ uname -a
OpenBSD ada.ricketyspace.net 7.7 GENERIC.MP#663 amd64

ada$ echo $FISH_VERSION 
4.0.2

ada$ virtualenv /usr/local/virtualenv/aonea
created virtual environment CPython3.12.10.final.0-64 in 499ms
  creator CPython3Posix(dest=/usr/local/virtualenv/aonea, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, via=copy, app_data_dir=/home/s/.local/share/virtualenv)
    added seed packages: pip==25.1.1
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

ada$ . /usr/local/virtualenv/aonea/bin/activate.fish
head: unknown option -- c
usage: head [-count | -n count] [file ...]
test: Missing argument at index 3
-lt 3
      ^
/usr/local/virtualenv/aonea/bin/activate.fish (line 64): 
if test (echo $FISH_VERSION | head -c 1) -lt 3
   ^
from sourcing file /usr/local/virtualenv/aonea/bin/activate.fish

Using fish's string sub command seems to work. I've
opened a PR for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions