Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Error reported when truncating names having special characters #212

Open
SilverBut opened this issue Dec 20, 2019 · 2 comments
Open

Error reported when truncating names having special characters #212

SilverBut opened this issue Dec 20, 2019 · 2 comments

Comments

@SilverBut
Copy link

SilverBut commented Dec 20, 2019

Bug Report

Current Behavior

Here is a guide to reproduce this bug:

user in ~ at host 
➜ cd /tmp

user in /tmp at host 
➜ mkdir -p /tmp/-test/1/2/3

user in /tmp at host 
➜ cd ./-test

user in /tmp/-test at host 
➜ cd ./1
string join: Unknown option “-test”
~/.local/share/omf/themes/spacefish/functions/__sf_util_truncate_dir.fish (line 6): 
string join / $folders[(math 0 - $truncate_to)..-1]
^
in command substitution
	called on line 19 of file ~/.local/share/omf/themes/spacefish/functions/__sf_util_truncate_dir.fish

in function “__sf_util_truncate_dir”
	called on line 6 of file ~/.local/share/omf/themes/spacefish/functions/__sf_section_dir.fish
	with parameter list “/tmp/-test/1 3”

in command substitution
	called on line 48 of file ~/.local/share/omf/themes/spacefish/functions/__sf_section_dir.fish

in function “__sf_section_dir”
	called on line 1 of file -

from sourcing file -
	called on line 61 of file /usr/share/fish/functions/eval.fish

in function “eval”
	called on line 31 of file ~/.config/fish/functions/fish_prompt.fish

in function “fish_prompt”
	called on standard input

in command substitution
	called on standard input


       string

   Synopsis
       string escape [(-n | --no-quoted)] [--style=xxx] [STRING...]
       string join [(-q | --quiet)] SEP [STRING...]
       string join0 [(-q | --quiet)] [STRING...]
       string length [(-q | --quiet)] [STRING...]
       string lower [(-q | --quiet)] [STRING...]
       string match [(-a | --all)] [(-e | --entire)] [(-i | --ignore-case)] [(-r | --regex)]
                    [(-n | --index)] [(-q | --quiet)] [(-v | --invert)] PATTERN [STRING...]
       string repeat [(-n | --count) COUNT] [(-m | --max) MAX] [(-N | --no-newline)]
                     [(-q | --quiet)] [STRING...]
       string replace [(-a | --all)] [(-f | --filter)] [(-i | --ignore-case)] [(-r | --regex)]
                      [(-q | --quiet)] PATTERN REPLACEMENT [STRING...]
       string split [(-m | --max) MAX] [(-n | --no-empty)] [(-q | --quiet)] [(-r | --right)] SEP
                    [STRING...]
       string split0 [(-m | --max) MAX] [(-n | --no-empty)] [(-q | --quiet)] [(-r | --right)]
                     [STRING...]
       string sub [(-s | --start) START] [(-l | --length) LENGTH] [(-q | --quiet)]
                  [STRING...]
       string trim [(-l | --left)] [(-r | --right)] [(-c | --chars CHARS)]
                   [(-q | --quiet)] [STRING...]
       string unescape [--style=xxx] [STRING...]
       string upper [(-q | --quiet)] [STRING...]

string: Type “help string” for related documentation

Expected Behavior

The error shall not be reported.

Relevant Fish Configuration

Here are all configurations related to spacefish but I don't think they are relevent. Write them in case you need to see them:

set SPACEFISH_USER_SHOW "always"
set SPACEFISH_HOST_SHOW "always"

Environment

  • Spacefish version: 2.7.0
  • Fish version: fish, version 3.0.2
  • Fish plugin manager: oh-my-fish
  • Terminal emulator: not related
  • Operating system: Arch Linux
@SilverBut
Copy link
Author

Seems some variable is not correctly escaped while truncating folder names. Let me check if I can have a quick (maybe dirty) solution first.

@SilverBut
Copy link
Author

SilverBut commented Dec 20, 2019

Update: this fix seems works. The target file is ~/.local/share/omf/themes/spacefish/functions/__sf_util_truncate_dir.fish.

Would someone come and check this patch? My Yubikey is offline recently and need some one to submit it for me. Thanks.

14c14
< 			echo (string join / $folders[(math 0 - $truncate_to)..-1])
---
> 			echo (string join / -- $folders[(math 0 - $truncate_to)..-1])

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant