Skip to content

Treat empty $PATH component as equivalent to "." #3914

@faho

Description

@faho

As recently discovered in #3912:

$ printf '%s\n' '#!/bin/sh' 'echo banana' > banana
$ chmod +x banana
$ set PATH "" $PATH
$ banana
# Command not found
$ set PATH "." $PATH
$ banana
banana

As far as I can see, fish just effectively ignores the empty component. The compatible behavior is to treat it like it was ".", i.e. the current directory. This is important because fish inherits these variables from the outside and exports them, so interoperability with POSIX is useful here.

This possibly also applies to $MANPATH, and was recently fixed for $CDPATH (#3901, #2106).

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions