Skip to content

On Windows, modifying scores via zoxide edit results in a double slashed duplicate of the path #539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ciwolsey opened this issue Mar 8, 2023 · 27 comments · Fixed by #1034

Comments

@ciwolsey
Copy link

ciwolsey commented Mar 8, 2023

Runnining zoxide edit on Windows and then attempting to increment or decrement a score causes the path to be added to the database again but with double slashes.

@ciwolsey ciwolsey changed the title and then incrementing or decrementing the score of a path causes a duplicate path with double slashes to be added to the database Modifying scores via zoxide edit results in double slashed duplication of the path Mar 8, 2023
@ciwolsey ciwolsey changed the title Modifying scores via zoxide edit results in double slashed duplication of the path Modifying scores via zoxide edit results in a double slashed duplicate of the path Mar 8, 2023
@ciwolsey ciwolsey changed the title Modifying scores via zoxide edit results in a double slashed duplicate of the path On Windows, modifying scores via zoxide edit results in a double slashed duplicate of the path Mar 8, 2023
@ciwolsey
Copy link
Author

ciwolsey commented Mar 8, 2023

Maybe this could be related to #538?

@WitchGod
Copy link

Confirming this is also happeing to me. Same as #538. Originally did it in Powershell 7/Core then got to replicate it in 5.1. Looks like a Windows bug. With the database serialized, I don't think it's an easy edit via source editor as well.

@princemaple
Copy link

Happening to me as well. Windows11, nushell.

@Bocom
Copy link

Bocom commented Jun 13, 2023

Happening to me as well, both this and #538, on Windows 11 and PowerShell 7.

@ArcusCerebellumus
Copy link

+1

@YDX-2147483647
Copy link
Contributor

FYI, Swarnim Arun is drafting #569, which may fix all problems by distinguish Path/PathBuf from str/String. (And I suggest we stop +1 again and use the reaction emoji buttons 👍/🚀/…)

@hme3
Copy link

hme3 commented Apr 28, 2024

Any solution or workaround?

@LoicRiegel
Copy link
Contributor

Just tested on my side with zoxide 0.9.7 with both powershell 5.1 and nushell 0.102.0 on Windows 11 and it works: zoxide edit -> increment / decrement some paths -> I see no duplicate being added...
The issue was created a long time ago now, I guess it's been fixed in the meantime?

@MrDwarf7
Copy link

MrDwarf7 commented Mar 5, 2025

This seems to have been resolved, I no longer experience this either. (Was previously using Windows Terminal, now wezterm, $v tables below.

 ❯ echo $PSVersionTable && Write-Host && wezterm -V && zoxide -V # -->

Name                           Value
----                           -----
PSVersion                      7.6.0-preview.2
PSEdition                      Core
GitCommitId                    7.6.0-preview.2
OS                             Microsoft Windows 10.0.26100
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

wezterm 20240203-110809-5046fc22
zoxide 0.9.7

This can likely be closed unless others are still experiencing this.

Edit:
Add zoxide version output lol

@YDX-2147483647
Copy link
Contributor

I also confirm that this issue is resolved.

#539 (comment) was posted on 2024-02-16, but https://github.com/ajeetdsouza/zoxide/releases/tag/v0.9.3 published on 2024-02-13 works as expected today. I guess the Windows system somehow changed and fixed the issue silently.

@LoicRiegel
Copy link
Contributor

If we close this, we could also close duplicate or related issues. #538 was mentioned above for instance, but there might be more.
PR 569 is still in draft and unmerged (commit is from May 2023!) so I have no idea what to do with it

@ciwolsey
Copy link
Author

ciwolsey commented Mar 8, 2025

I haven't experienced this issue for a long time now so it seems to be fixed and this can probably be closed off. Thanks all.

@tommdq
Copy link

tommdq commented Apr 2, 2025

I'm using zoxide with powershell and wezterm and still having this issue.

@ciwolsey
Copy link
Author

ciwolsey commented Apr 2, 2025

@tommdq which version of zoxide?

@tommdq
Copy link

tommdq commented Apr 2, 2025

@tommdq which version of zoxide?

Image

0.9.7 . It keeps adding double \ and creating a new path

@ciwolsey
Copy link
Author

ciwolsey commented Apr 2, 2025

@tommdq very strange, I'm also on that 0.9.7 using Powershell but with Windows Terminal and no longer have the problem.

@YDX-2147483647
Copy link
Contributor

#539 (comment) was posted on 2024-02-16, but v0.9.3 (release) published on 2024-02-13 works as expected today. I guess the Windows system somehow changed and fixed the issue silently.

As I said before, this issue depends on the context.

@tommdq Could you share us with your $PSVersionTable? The following is mine, and it works.

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.5.0
PSEdition                      Core
GitCommitId                    7.5.0
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

@tommdq
Copy link

tommdq commented Apr 3, 2025

#539 (comment) was posted on 2024-02-16, but v0.9.3 (release) published on 2024-02-13 works as expected today. I guess the Windows system somehow changed and fixed the issue silently.

As I said before, this issue depends on the context.

@tommdq Could you share us with your $PSVersionTable? The following is mine, and it works.

$PSVersionTable

Name Value


PSVersion 7.5.0
PSEdition Core
GitCommitId 7.5.0
OS Microsoft Windows 10.0.19045
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

The only difference is my windows version:

Image

20250403-0217-34.1832692.mp4

I can delete but the increment and the decrement only keep creating new paths
I'm using wezterm and also have WSL with ubuntu and zoxide edit works as expected there.

@YDX-2147483647
Copy link
Contributor

In February 2024, my zoxide behaved exactly like yours. ╮(╯_╰)╭ At least, we've ruled out the pwsh version as the cause.

I'm using wezterm

Could you try to zoxide edit without wezterm?

  1. Win+R, pwsh -NoProfile, enter.
  2. Set up zoxide by executing Invoke-Expression (& { (zoxide init powershell | Out-String) }).
  3. Try zoxide edit.

(It works on my machine.)

@tommdq
Copy link

tommdq commented Apr 3, 2025

In February 2024, my zoxide behaved exactly like yours. ╮(╯_╰)╭ At least, we've ruled out the pwsh version as the cause.

I'm using wezterm

Could you try to zoxide edit without wezterm?

1. Win+R, `pwsh -NoProfile`, enter.

2. Set up zoxide by executing `Invoke-Expression (& { (zoxide init powershell | Out-String) })`.

3. Try `zoxide edit`.

(It works on my machine.)

Thanks for your help! I tried running PowerShell without a profile, as you suggested, but the result is still the same. Could it be related to the version of pwsh I'm using? (7.5.0)

@ciwolsey
Copy link
Author

ciwolsey commented Apr 3, 2025

Just for reference zoxide is now working for me using Windows Terminal / Powershell / 0.97. Here is my $PSVersion to help in your debugging:

Name                           Value
----                           -----
PSVersion                      5.1.26100.3624
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.26100.3624
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Looks like one difference is that I'm running the Desktop version while you are running the core version. I'm going to update to the core version and see if the issue reappears for me.

@ciwolsey
Copy link
Author

ciwolsey commented Apr 3, 2025

I updated, my $PSVersionTable now looks like:

Name                           Value
----                           -----
PSVersion                      7.5.0
PSEdition                      Core
GitCommitId                    7.5.0
OS                             Microsoft Windows 10.0.26100
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

It's still working as it should, no double slashes or extra entries appearing when modifying score via 'zoxide edit'.

Have you tried switching to Windows terminal?

Update: I even tried using powershell and wezterm and it's still working fine for me

@YDX-2147483647
Copy link
Contributor

YDX-2147483647 commented Apr 3, 2025

Could it be related to the version of pwsh I'm using? (7.5.0)

Hmm, I also uses pwsh 7.5.0 core, and it works.
I think we can conclude that tommdq's issue is related to neither the shell (pwsh version) nor the terminal emulator (wezterm / windows terminal).


zoxide edit depends on https://github.com/junegunn/fzf.

zoxide/src/cmd/edit.rs

Lines 44 to 47 in e1e2f41

impl Edit {
fn get_fzf() -> Result<FzfChild> {
Fzf::new()?
.args([

zoxide/src/util.rs

Lines 33 to 34 in e1e2f41

#[cfg(windows)]
let program = which::which("fzf.exe").map_err(|_| anyhow!(Self::ERR_FZF_NOT_FOUND))?;

Which version do you use? I use the following.

> fzf --version
0.61.0 (e15cba0c)

@Aqaao
Copy link

Aqaao commented Apr 4, 2025

zoxide edit depends on https://github.com/junegunn/fzf.

Right. I updated my fzf (from 0.49 to 0.61) and it working fine now.

@YDX-2147483647
Copy link
Contributor

from 0.49 to 0.61

A quick bisect reveals that the first working version of fzf is https://github.com/junegunn/fzf/releases/tag/0.51.0, released on 2024-05-01, and its CHANGELOG said:

Fixed argument escaping for Windows cmd.exe. No redundant escaping of backslashes.
https://github.com/junegunn/fzf/blob/master/CHANGELOG.md#0510

The key change was committed by junegunn in junegunn/fzf@8d74446 and junegunn/fzf@194a763, which closed junegunn/fzf#3651 (comment) and junegunn/fzf#2609.

Now everything is clear. Time to close this issue!

@tommdq
Copy link

tommdq commented Apr 4, 2025

That was it. After updating fzf to version 0.61.0 zoxide edit is working as expected. Thanks to everyone !!! Issue solved

@LoicRiegel
Copy link
Contributor

It would be nice to document it somewhere. Several tickets like this were opened.

There is this in the readme

Install fzf (optional)

[fzf](https://github.com/junegunn/fzf) is a command-line fuzzy finder, used by zoxide for completions / interactive selection. It can be installed from [here](https://github.com/junegunn/fzf#installation).

Note zoxide only supports fzf v0.33.0 and above.

Maybe change it to something like:

Note zoxide only supports fzf v0.33.0 and above (0.51.0 or above on Windows).

YDX-2147483647 added a commit to YDX-2147483647/zoxide that referenced this issue Apr 4, 2025
Before v0.51.0, fzf generates redundant escaping of backslashes for Windows, which breaks `zoxide edit`.
https://github.com/junegunn/fzf/releases/tag/0.51.0

Closes ajeetdsouza#539

Co-authored-by: Loïc Riegel <[email protected]>
YDX-2147483647 added a commit to YDX-2147483647/zoxide that referenced this issue Apr 4, 2025
Before v0.51.0, fzf generates redundant escaping of backslashes for Windows, which breaks `zoxide edit`.
https://github.com/junegunn/fzf/releases/tag/0.51.0

Closes ajeetdsouza#539

Co-authored-by: Loïc Riegel <[email protected]>
YDX-2147483647 added a commit to YDX-2147483647/zoxide that referenced this issue Apr 4, 2025
Before v0.51.0, fzf generates redundant escaping of backslashes for Windows, which breaks `zoxide edit`.
https://github.com/junegunn/fzf/releases/tag/0.51.0

Closes ajeetdsouza#539

Co-authored-by: Loïc Riegel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.