Skip to content
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

yazi not able to follow "default" symlinks created by Windows #471

Closed
RioNight opened this issue Jan 3, 2024 · 12 comments · Fixed by #527
Closed

yazi not able to follow "default" symlinks created by Windows #471

RioNight opened this issue Jan 3, 2024 · 12 comments · Fixed by #527
Labels
invalid This doesn't seem right

Comments

@RioNight
Copy link

RioNight commented Jan 3, 2024

What system are you running Yazi on?

Windows

What terminal are you running Yazi in?

Wezterm

Yazi version

yazi 0.1.5

Did you try the latest main branch to see if the problem has already been fixed?

Not tried, and I'll explain why below

Describe the bug

I'm using the git bash shell on Windows in Wezterm.
symlinks on created by git bash's ln are able to be followed, i.e., I can press the letter l to enter into the symlink target.

What doesn't work is pressing l to enter into the default symlinks created by Windows which appear in the user's home directory. Windows appears to create a set of default symlinks, such as Recent in the home directory, which maps to /c/<user>/KhanH/AppData/Roaming/Microsoft/Windows/Recent (this is a Git Bash path corresponding to C:\Users\<user>\AppData\Roaming\Microsoft\Windows\Recent). Instead, nothing occurs, (i.e., there is no crash on any error message).

file Recent outputs: Recent: symbolic link to /c/Users/<user>/AppData/Roaming/Microsoft/Windows/Recent. I am using git bash's file command.
cd Recent works as well.

Note: To create a symlink with git bash's ln, you need to enable Developer Mode on Windows and set this in your ~/.bashrc:
export MSYS=winsymlinks:nativestrict.

Expected Behavior

I would expect l to follow the Windows default symlinks.

To Reproduce

  1. On Windows, scoop install git wezterm yazi ...
  2. In the ~/.wezterm.lua file, set: config.default_prog = { 'c:\\users\\<user>\\scoop\\apps\\git\\current\\bin\\bash.exe -i -l' }. Check here for more details on the Wezterm config.
  3. In Wezterm + Git Bash, cd to ~
  4. Run yazi.
  5. Try to press l on any of the Windows default symlink folders. So, Recent,, "Start Menu", "Application Data", etc.

Configuration

no config

~/.wezterm.lua:

-- Pull in the wezterm API
local wezterm = require 'wezterm'

-- This table will hold the configuration.
local config = {}

-- In newer versions of wezterm, use the config_builder which will
-- help provide clearer error messages
if wezterm.config_builder then
  config = wezterm.config_builder()
end

-- This is where you actually apply your config choices

-- For example, changing the color scheme:
config.default_prog = { 'c:\\users\\<user>\\scoop\\apps\\git\\current\\bin\\bash.exe -i -l' }

-- and finally, return the configuration to wezterm
return config

Anything else?

No response

@RioNight RioNight added the bug Something isn't working label Jan 3, 2024
@sxyazi
Copy link
Owner

sxyazi commented Jan 3, 2024

Is there anyone familiar with Windows and would like to take a look at this issue?

@sxyazi
Copy link
Owner

sxyazi commented Jan 16, 2024

Hi, I made a PR trying to fix the symlink issue, #527, let me know if it works!

Note that this PR only fixes the problem with symbolic links, not shortcuts, which is the expected behavior:

1

2

@sxyazi sxyazi added the waiting on op Waiting for more information from the original poster label Jan 16, 2024
@RioNight
Copy link
Author

#527 doesn't seem to work on these files created by Windows. It works on normal symlinks created by pwsh like New-Item -Path .\pwsh-symlink -ItemType SymbolicLink -Value .\testdir\.

The mimetype of the pwsh-symlink created with the above command is inode/directory.

The mimetype of a Windows directory "default" symlink directory is also inode/directory.

~/Recent is an example of a Windows "default" symlink directory. You have it in the image you provided.

image

@github-actions github-actions bot removed the waiting on op Waiting for more information from the original poster label Jan 18, 2024
@RioNight
Copy link
Author

RioNight commented Jan 18, 2024

By the way, you can create symlinks in Windows without admin privileges by enabling Developer Mode in Windows Settings.

In bash (that comes with Git for windows), you can create a symlink normally with ln -s after putting this in your .bashrc: export MSYS=winsymlinks:nativestrict. You will still need to enable Developer Mode for this. Also, files created like this have the mime-type inode/directory.

@sxyazi
Copy link
Owner

sxyazi commented Jan 18, 2024

The mimetype of the pwsh-symlink created with the above command is inode/directory.

Hmm weird, why it's inode/directory not inode/symlink? Are there any docs about the "default" symlink on Windows? I'm not quite familiar with it...

@sxyazi sxyazi added the waiting on op Waiting for more information from the original poster label Jan 18, 2024
@sxyazi
Copy link
Owner

sxyazi commented Jan 18, 2024

Let me merge that PR first

@sxyazi sxyazi reopened this Jan 18, 2024
@RioNight
Copy link
Author

I think it might be a permission error.

One thing about these WIndows folders is that to view them in the File Explorer you need to enable something.
To configure File Explorer click on the three dots at the top, View, or Options. Somehow you should reach a popup window in which you can enable viewing of Hidden Files, File Extensions / Types, and Protected Operating System Files.
Recent is only shown when you enable viewing of Protected OS Files.

Also, cmd's dir, and pwsh's get-childitem and ls cannot list the files in Recent. They give a permission denied message.
However, bash's ls can list these files.

fx (felix) and lf both can't view it either. Here is what is shown in lf:
image

@github-actions github-actions bot removed the waiting on op Waiting for more information from the original poster label Jan 20, 2024
@RioNight
Copy link
Author

I don't know about the mime-type though. This is bash:
image

@RioNight
Copy link
Author

image

@sxyazi
Copy link
Owner

sxyazi commented Jan 21, 2024

It seems there's not much Yazi can do; it's just a weird permission problem on Windows - In fact, Yazi just simply calls Rust's fs::read_dir() to read the directory list, I can't think of anything that could be the issue with Yazi.

Closing as not Yazi.

@sxyazi sxyazi closed this as not planned Won't fix, can't repro, duplicate, stale Jan 21, 2024
@sxyazi sxyazi added invalid This doesn't seem right and removed bug Something isn't working help wanted Extra attention is needed labels Jan 21, 2024
@RioNight
Copy link
Author

I see. Could something be added on the right pane to show what's happening? Something like "permission denied". Right now yazi shows no files and treats it like an empty directory.

Copy link

I'm going to lock this issue because it has been closed for 30 days. ⏳ This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
invalid This doesn't seem right
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants