Search code examples
linuxshellubuntufusefish

'testdir must be an absolute path' printed after using 'ls' command in fish shell


Every time I use the ls command in fish shell, it produces the line "testdir must be an absolute path" before then listing the contents of the directory as any normal ls invocation would do. This occurs regardless of the directory I am in or options I pass to ls.

I've scoured my system and the internet for this message, and I found it in one libfuse's test files. Running ps -ef | grep fuse produces:

mdko 3498 3430 0 20:36 ? 00:00:00 /usr/lib/gvfs/gvfsd-fuse /run/user/1000/gvfs -f -o big_writes

Indeed, running dmesg | grep fuse shows:

[    3.771372] fuse init (API version 7.26)

When I run ls in bash or zsh, the message "testdir must be an absolute path" does not appear when running ls. I've also made other minimal attempts at investigating the problem by strace-ing the ls call and the fish process, but with no success.

Where is this string coming from, and how do I stop it?

(Running Ubuntu 17.10 64-bit, fish version 2.6.0)


Solution

  • Fish provides an ls wrapper function that turns on color and indicators if the output is going to a tty (i.e. if isatty returns true).

    Most likely, you have a command or function that overrides something here.

    Check the output of type ls to see the definition of the ls function:

    ls is a function with definition
    # Defined in /usr/share/fish/functions/ls.fish @ line 6
    function ls --description 'List contents of directory'
        set -l param --color=auto
        if isatty 1
            set -a param --indicator-style=classify
        end
        command ls $param $argv
    end
    

    Since your "ls" command works in bash, that probably isn't it (run command ls --color=auto --indicator-style=classify somedir to confirm).

    So you'd check the other commands. set probably isn't it because if that was overridden you'd have bigger issues. isatty is possible, and that runs command test, which is also a candidate. Use type to figure out what fish is calling, and then change that.

    E.g. it's possible that you have a test command somewhere that isn't a POSIX-style test, but instead a thing to run the libfuse tests. If so, rename or remove that.