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

Permanently deleting folder crashes on Windows #1320

Closed
ndtoan96 opened this issue Jul 20, 2024 · 5 comments
Closed

Permanently deleting folder crashes on Windows #1320

ndtoan96 opened this issue Jul 20, 2024 · 5 comments
Labels
bug Something isn't working upstream

Comments

@ndtoan96
Copy link
Contributor

ndtoan96 commented Jul 20, 2024

What system are you running Yazi on?

Windows

What terminal are you running Yazi in?

Windows Terminal

yazi --debug output

##### ↓↓↓ Paste the output here: ↓↓↓ #####
Yazi
    Version: 0.2.5 (66e83f3 2024-07-20)
    Debug  : false
    OS     : windows-x86_64 (windows)

Ya
    Version: program not found

Emulator
    Emulator.via_env: ("", "")
    Emulator.via_csi: Ok(Unknown([]))
    Emulator.detect : Unknown([])

Adapter
    Adapter.matches: Chafa

Desktop
    XDG_SESSION_TYPE: None
    WAYLAND_DISPLAY : None
    DISPLAY         : None

SSH
    shared.in_ssh_connection: false

WSL
    /proc/sys/fs/binfmt_misc/WSLInterop: false

Variables
    SHELL              : None
    EDITOR             : Some("hx")
    ZELLIJ_SESSION_NAME: None
    YAZI_FILE_ONE      : Some("C:\\Program Files\\Git\\usr\\bin\\file.exe")
    YAZI_CONFIG_HOME   : None

Text Opener
    default: Some(Opener { run: "%EDITOR% \"%*\"", block: true, orphan: false, desc: "EDITOR", for_: None, spread: true })
    block  : Some(Opener { run: "%EDITOR% \"%*\"", block: true, orphan: false, desc: "EDITOR", for_: None, spread: true })

tmux
    TMUX   : false
    Version: program not found

Dependencies
    file             : 5.45
    ueberzugpp       : program not found
    ffmpegthumbnailer: program not found
    magick           : program not found
    fzf              : 0.43.0
    fd               : 8.7.1
    rg               : 13.0.0
    chafa            : program not found
    zoxide           : 0.9.4
    unar             : program not found
    jq               : program not found


--------------------------------------------------
When reporting a bug, please also upload the `yazi.log` log file - only upload the most recent content by time.
You can find it in the "C:\\Users\\ASUS\\AppData\\Roaming\\yazi\\state" directory.

Did you try the latest nightly build to see if the problem got fixed?

Yes, and I updated the debug information above (yazi --debug) to the nightly that I tried

Describe the bug

When deleting a folder permanently (i.e. D), the app just crashes with error STATUS_ILLEGAL_INSTRUCTION. I checked the log in yazi/state but no error was logged there. Interestingly, it only crashes with --release build, while --debug build works fine.

Expected Behavior

The app does not crash.

To Reproduce

  1. Create an empty folder (or with files, it does not matter)
  2. Use D to delete the folder permanently
  3. Wait a little to see the app crashes

Configuration

No response

Anything else?

Recording.2024-07-21.005523.mp4

No response

@ndtoan96 ndtoan96 added the bug Something isn't working label Jul 20, 2024
@ndtoan96
Copy link
Contributor Author

Seems like this is a really old bug, I checked out version 0.2.4 and it's still there.

@sxyazi
Copy link
Owner

sxyazi commented Jul 21, 2024

I can reproduce it on my Windows VM, after some investigating, it seems to be a bug in the notify-rs library — on Windows, when the directory being watched no longer exists, it causes the program to crash.

Also I noticed this behavior only occurs on Windows with release mode; macOS and Linux don't have this issue.

I can reproduce it with the following code through cargo run --release:

fn main() {
  let p = Path::new("C:\\Users\\ika\\Desktop\\abc");
  std::fs::create_dir(p).unwrap();

  let mut watcher = ::notify::RecommendedWatcher::new(|_| {}, Default::default()).unwrap();
  watcher.watch(p, ::notify::RecursiveMode::NonRecursive).unwrap();

  // Try to comment on this line you'll see "Exited successfully" printed normally
  std::fs::remove_dir_all(p).unwrap();

  std::thread::sleep(Duration::from_secs(5));
  println!("Exited successfully");
}

Unfortunately it's unclear how to fix it right now, I'll report it upstream notify-rs/notify#624

@sxyazi sxyazi added help wanted Extra attention is needed upstream labels Jul 21, 2024
@sxyazi sxyazi changed the title Permanently deleting folder crashes the app Permanently deleting folder crashes on Windows Jul 21, 2024
@sxyazi sxyazi removed the help wanted Extra attention is needed label Jul 27, 2024
@sxyazi
Copy link
Owner

sxyazi commented Jul 30, 2024

Hi, I've temporarily pinned notify to an unreleased commit in 1e1ae63#diff-5bc5ff0b737104e617ec3aef2e05502b7f8aeafe84a73914ca5d0692c954b800 as a workaround which includes a fix for that UB, let me know if it works for you!

@sxyazi sxyazi added the waiting on op Waiting for more information from the original poster label Jul 30, 2024
@ndtoan96
Copy link
Contributor Author

Hi, I've temporarily pinned notify to an unreleased commit in 1e1ae63#diff-5bc5ff0b737104e617ec3aef2e05502b7f8aeafe84a73914ca5d0692c954b800 as a workaround which includes a fix for that UB, let me know if it works for you!

Thank you, I just tested an it works.

@github-actions github-actions bot removed the waiting on op Waiting for more information from the original poster label Jul 31, 2024
@sxyazi sxyazi closed this as completed Jul 31, 2024
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 Aug 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working upstream
Projects
None yet
Development

No branches or pull requests

2 participants