-
Notifications
You must be signed in to change notification settings - Fork 377
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
std::io::copy()
doesn't return immediately after copying the file to certain USB devices
#1858
Comments
It would be really helpful to see a video demo showing the behavior of Yazi and Yazi's file copying just calls the standard library functions Also, can you confirm if this is a duplicate of #1857? Right now, the progress bar is missing a redraw, meaning that even when a task is complete, the progress bar doesn't disappear if the user isn't interacting (like scrolling the file list). This is a known rendering bug affecting all tasks, not just copying. |
I did a test with use std::fs;
use std::io;
fn main() -> io::Result<()> {
let from_path = "/home/karim/Documents/projects/code/copy-test/test";
let to_path = "/run/media/karim/BRUH/test";
fs::copy(from_path, to_path)?;
println!("File copied successfully!");
Ok(())
} and this is how long it took compare to
Kooha-2024-10-30-14-56-10.webm
the progress bar disappears if i just and without interacting with yazi, it just takes a long time. |
How about yazi/yazi-shared/src/fs/fns.rs Lines 254 to 274 in c668723
Did the file content finish copying, but the progress bar and task list items just haven't disappeared? Or is the file content not finished at all? What file system is your USB? |
Also can it be reproduced in the release version, or does it only exist in the latest main branch? The file copying logic in the recent main branch had some changes to fix #1775, so it might be related |
I didn't use the same code snippet. use std::fs::File;
use std::io::{self, copy};
use std::path::Path;
fn main() -> io::Result<()> {
let source_path = "/home/karim/Documents/projects/code/copy-test/test";
let destination_path = "/run/media/karim/BRUH/test";
copy_file(source_path, destination_path)?;
println!("File copied successfully!");
Ok(())
}
fn copy_file<P: AsRef<Path>>(from: P, to: P) -> io::Result<u64> {
let mut reader = File::open(&from)?;
let mut writer = File::create(&to)?;
let bytes_copied = copy(&mut reader, &mut writer)?;
println!("Copied {} bytes from {:?} to {:?}", bytes_copied, from.as_ref(), to.as_ref());
Ok(bytes_copied)
} I copied the same file, but this time it was quicker. idk if this was important, but when i run the program,
I skimmed through the episode while the progress bar haven't disappeared and it seemed fine, this usb is an was FAT 32bit.
i didn't mention it but i used the latest version |
Is it 100% to happen, or just occasionally? What version of Rust are you using? - the implementation of Also, please make sure to delete the target file on the USB every time you test them to avoid any noise, so it's a fresh copy each time.
No, I mean the release version 0.3.3 (Use this link https://github.com/sxyazi/yazi/releases/tag/v0.3.3). Your version is |
100% everytime, and only
it's still the same results. |
Please compile the program with
Then paste the outputs here. |
I wish i could read these 😞😞 |
Could you please send a |
|
This is weird, I don't see what the problem is, I'm not an expert on this, my best guess is this may be related to your USB driver, or a bug in the kernel I suggest submitting it to rust to see what they say, since we have determined that this is a problem only with io::copy() but not fs::copy() |
std::io::copy()
doesn't return immediately after copying the file to certain USB devices
What system are you running Yazi on?
Linux Wayland
What terminal are you running Yazi in?
foot version: 1.18.1 +pgo +ime +graphemes -assertions
yazi --debug
outputDescribe the bug
It's not a bug per say, it's just when reading/writing to a usb stick yazi takes forever to finish an operation.
Like coping a 1gb file from yazi can take up to 30min unlike the cp command which takes seconds to minute.
Minimal reproducer
Anything else?
I don't exactly what information that could be helpful. if you need something else tell me.
Also thank for the wonderful project.
Validations
yazi --debug
) input box to the nightly that I triedmv ~/.config/yazi ~/.config/yazi-backup
)The text was updated successfully, but these errors were encountered: