Skip to content

prompt_pwd -d1 -D3 fails for current directories that starts with dash  #10169

Closed
@UgurcanAkkok

Description

@UgurcanAkkok

There is an error with the prompt_pwd.fish for directories that starts with a dash "-"

Fish version:

➜ fish --version
fish, version 3.6.4
➜ echo $version
3.6.4

Arch Linux, uname: Linux dell 6.6.8-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 21 Dec 2023 19:01:01 +0000 x86_64 GNU/Linux

When i tried it with the given sh -c command, there was no failure for the prompt but when i manually call prompt_pwd -d1 -D3 it failes with the error below. The error is in https://github.com/fish-shell/fish-shell/blob/master/share/functions/prompt_pwd.fish this file.

To produce:

  1. cd into a directory that starts with a dash, for example: /tmp/tmp.nXGZLMSMrj/-a
  2. call prompt_pwd -d1 -D3

The error is:

string join: -a: unknown option

/usr/share/fish/functions/prompt_pwd.fish (line 48): 
            string join / (string replace -ar '(\.?[^/]{'"$fish_prompt_pwd_dir_length"'})[^/]*/' '$1/' $tmp) $full
            ^
in function 'prompt_pwd' with arguments '-d1 -D3'

(Type 'help string' for related documentation)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that's not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions