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

Pasting files to partition which does not support file creation timestamp (btime) fail #1054

Closed
Piroro-hs opened this issue May 17, 2024 · 7 comments
Labels
invalid This doesn't seem right

Comments

@Piroro-hs
Copy link

What system are you running Yazi on?

Linux Wayland

What terminal are you running Yazi in?

Ptyxis 46.2

Did you try the latest code to see if this problem got fixed?

Tried, but the problem still

yazi --debug output

Yazi
    Version: 0.2.5 (Arch Linux 2024-04-30)
    OS: linux-x86_64 (unix)
    Debug: false

Emulator
    Emulator.via_env: ("xterm-256color", "")
    Emulator.via_csi: Ok(Unknown([]))
    Emulator.detect: Unknown([])

Adaptor
    Adaptor.matches: Wayland

Desktop
    XDG_SESSION_TYPE: Some("wayland")
    WAYLAND_DISPLAY: Some("wayland-1")
    DISPLAY: None

SSH
    shared.in_ssh_connection: false

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

Variables
    SHELL: Some("/bin/bash")
    EDITOR: Some("nano")
    ZELLIJ_SESSION_NAME: None
    YAZI_FILE_ONE: None
    YAZI_CONFIG_HOME: None

file(1)
    Version: Ok(Output { status: ExitStatus(unix_wait_status(0)), stdout: "file-5.45\nmagic file from /usr/share/file/misc/magic\nseccomp support included\n", stderr: "" })

Text Opener
    default: Some(Opener { run: "${EDITOR:=vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })
    block: Some(Opener { run: "${EDITOR:=vi} \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })

tmux
    TMUX: false

Ueberzug++
    Version: Err(Os { code: 2, kind: NotFound, message: "No such file or directory" })


--------------------------------------------------
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 "/home/piroro/.local/state/yazi" directory.

Describe the bug

Copying files to exFAT formatted USB stick fail.
Appearently creation time is not supported on exFAT.

Paste task retry: FileOpPaste { id: 44, from: /home/piroro/Videos/dob_ULTRA_EXPO_2024_asobi.mp4, to: /run/media/system/USB_Flash_Disk/dob_ULTRA_EXPO_2024_asobi.mp4, meta: Some(Metadata { file_type: FileType(FileType { mode: 33188 }), is_dir: false, is_file: true, permissions: Permissions(FilePermissions { mode: 33188 }), modified: Ok(SystemTime { tv_sec: 1704545982, tv_nsec: 0 }), accessed: Ok(SystemTime { tv_sec: 1704545982, tv_nsec: 0 }), created: Err(Error { kind: Uncategorized, message: "creation time is not available for the filesystem" }), .. }), cut: false, follow: false, retry: 1 }

Expected Behavior

Using last modification time (mtime) instead as it is more widely supported across filesystems.

To Reproduce

Copying files to exFAT formatted USB stick.

Configuration

No response

Anything else?

No response

@Piroro-hs Piroro-hs added the bug Something isn't working label May 17, 2024
@sxyazi
Copy link
Owner

sxyazi commented May 17, 2024

I'm a bit confused.

From the provided logs, it seems that there's just an issue with obtaining the creation time of a file - it's part of the Rust std::fs::Metadata struct, provided when calling the std::fs::metadata() function, but Yazi doesn't actually use the created field throughout the entire copying process, so this shouldn't cause the copy to fail.

Also this is a retry log, not a final failure log. If a copy task were to fail, it would be logged with "Failed to work on this task" at the beginning rather than "Paste task retry".

Using last modification time (mtime) instead as it is more widely supported across filesystems.

Yazi hasn't changed (even used) the creation time during the entire copy process, so I'm not sure what can be done here.

@sxyazi sxyazi added the waiting on op Waiting for more information from the original poster label May 17, 2024
@Piroro-hs
Copy link
Author

Piroro-hs commented May 17, 2024

I'll add more logs.

Output of mount (relevant lines)

[piroro@pc ~]$ mount
/dev/nvme0n1p2 on / type f2fs (rw,noatime,lazytime,background_gc=on,gc_merge,nodiscard,no_heap,user_xattr,inline_xattr,acl,inline_data,inline_dentry,flush_merge,barrier,extent_cache,mode=adaptive,active_logs=6,alloc_mode=default,checkpoint_merge,fsync_mode=posix,atgc,memory=normal,errors=continue)
systemd-1 on /run/media/system/USB_Flash_Disk type autofs (rw,relatime,fd=102,pgrp=1,timeout=1,minproto=5,maxproto=5,direct,pipe_ino=116355)
/dev/sda1 on /run/media/system/USB_Flash_Disk type exfat (rw,noatime,lazytime,fmask=0000,dmask=0000,allow_utime=0022,iocharset=utf8,errors=remount-ro)

Create test file on home (f2fs)

echo test > ~/test

Open Yazi, yank ~/test, and then paste it inside /run/media/system/USB_Flash_Disk (exFAT)
Below is a output of task inspection (however, task inspection screen is closed immediately, maybe another issue)

Paste task retry: FileOpPaste { id: 16, from: /home/piroro/test, to: /run/media/system/USB_Flash_Disk/test, meta: Some(Metadata { file_type: FileType(FileType { mode: 33188 }), is_dir: false, is_file: true, permissions: Permissions(FilePermissions { mode: 33188 }), modified: Ok(SystemTime { tv_sec: 1715964300, tv_nsec: 510034975 }), accessed: Ok(SystemTime { tv_sec: 1715964096, tv_nsec: 758899868 }), created: Err(Error { kind: Uncategorized, message: "creation time is not available for the filesystem" }), .. }), cut: false, follow: false, retry: 1 }
Paste task retry: FileOpPaste { id: 16, from: /home/piroro/test, to: /run/media/system/USB_Flash_Disk/test, meta: Some(Metadata { file_type: FileType(FileType { mode: 33188 }), is_dir: false, is_file: true, permissions: Permissions(FilePermissions { mode: 33188 }), modified: Ok(SystemTime { tv_sec: 1715964300, tv_nsec: 510034975 }), accessed: Ok(SystemTime { tv_sec: 1715964096, tv_nsec: 758899868 }), created: Err(Error { kind: Uncategorized, message: "creation time is not available for the filesystem" }), .. }), cut: false, follow: false, retry: 2 }
Paste task retry: FileOpPaste { id: 16, from: /home/piroro/test, to: /run/media/system/USB_Flash_Disk/test, meta: Some(Metadata { file_type: FileType(FileType { mode: 33188 }), is_dir: false, is_file: true, permissions: Permissions(FilePermissions { mode: 33188 }), modified: Ok(SystemTime { tv_sec: 1715964300, tv_nsec: 510034975 }), accessed: Ok(SystemTime { tv_sec: 1715964096, tv_nsec: 758899868 }), created: Err(Error { kind: Uncategorized, message: "creation time is not available for the filesystem" }), .. }), cut: false, follow: false, retry: 3 }
Paste task retry: FileOpPaste { id: 16, from: /home/piroro/test, to: /run/media/system/USB_Flash_Disk/test, meta: Some(Metadata { file_type: FileType(FileType { mode: 33188 }), is_dir: false, is_file: true, permissions: Permissions(FilePermissions { mode: 33188 }), modified: Ok(SystemTime { tv_sec: 1715964300, tv_nsec: 510034975 }), accessed: Ok(SystemTime { tv_sec: 1715964096, tv_nsec: 758899868 }), created: Err(Error { kind: Uncategorized, message: "creation time is not available for the filesystem" }), .. }), cut: false, follow: false, retry: 4 }
Paste task retry: FileOpPaste { id: 16, from: /home/piroro/test, to: /run/media/system/USB_Flash_Disk/test, meta: Some(Metadata { file_type: FileType(FileType { mode: 33188 }), is_dir: false, is_file: true, permissions: Permissions(FilePermissions { mode: 33188 }), modified: Ok(SystemTime { tv_sec: 1715964300, tv_nsec: 510034975 }), accessed: Ok(SystemTime { tv_sec: 1715964096, tv_nsec: 758899868 }), created: Err(Error { kind: Uncategorized, message: "creation time is not available for the filesystem" }), .. }), cut: false, follow: false, retry: 5 }
Failed to work on this task: Operation not permitted (os error 1)

Actually, zero-sized file /run/media/system/USB_Flash_Disk/test is created.

@github-actions github-actions bot removed the waiting on op Waiting for more information from the original poster label May 17, 2024
@Piroro-hs
Copy link
Author

Piroro-hs commented May 17, 2024

Ah, sorry I misunderstood the log.
It failed because of Operation not permitted (os error 1) ?

Here is output of ls -la /run/media/system/USB_Flash_Disk, if relevant

[piroro@pc USB_Flash_Disk]$ ls -la
total 58658816
drwxrwxrwx 4 root root      131072  5月 18 01:45  .
drwxr-xr-x 3 root root          60  5月 17 23:08  ..
drwxrwxrwx 4 root root      131072  5月 18 01:45  .Trash-1000
-rwxrwxrwx 1 root root           0  5月 18 01:45  50-router-workaround.old
-rwxrwxrwx 1 root root  6447361032  5月 18 01:31  AZUNA_LAGOON_day2.mp4
drwxrwxrwx 2 root root      131072  5月  4 23:39 'System Volume Information'
-rwxrwxrwx 1 root root  2451804820  5月 10  2022  dob_1st_day2.m2ts
-rwxrwxrwx 1 root root  1014660314  5月  3 13:03  dob_2nd_yoru.webm
-rwxrwxrwx 1 root root 18549408027  5月 18 00:34  dob_ULTRA_EXPO_2024.mp4
-rwxrwxrwx 1 root root 11198399861 11月 25 02:18  hasu_1st_tyo_day2.mp4
-rwxrwxrwx 1 root root 12439120391  5月 18 00:56  hasu_2nd_chiba_day2.mp4
-rwxrwxrwx 1 root root  5958190785  5月 18 01:22  hasu_debut.webm
-rwxrwxrwx 1 root root  2006789842  5月 18 01:10  hasu_opening_hiru.mp4
-rwxrwxrwx 1 root root           0  5月 18 01:45  test

@sxyazi
Copy link
Owner

sxyazi commented May 17, 2024

Yes, this is the real reason for the failure.

Unfortunately, I don't think there's anything Yazi can do here - this error is returned by the operating system and Yazi simply calls std::fs::copy(). You need to ensure that the Yazi process has the right permission to write files to USB.

@sxyazi sxyazi added invalid This doesn't seem right waiting on op Waiting for more information from the original poster and removed bug Something isn't working labels May 17, 2024
@Piroro-hs
Copy link
Author

Piroro-hs commented May 17, 2024

OK, creating small program using std::fs::copy and straceing reveals that failure is happening at changing file permission (fchmod) in std::fs::copy, as created file on USB stick is owned by root. cp command can handle this case so it would be great if some kind of fallback is implemented in yazi.

@github-actions github-actions bot removed the waiting on op Waiting for more information from the original poster label May 17, 2024
@sxyazi
Copy link
Owner

sxyazi commented May 18, 2024

I'm not sure about the specific cause of the issue you encountered, but I believe it's largely related to correct permission settings. I didn't encounter any problems in my testing with an ExFAT USB; all files were successfully copied:

screenshot-000009.mp4

Don't get me wrong - I don't mind adding additional fallback if it suits your use case and I'd be happy to accept a PR for it. Since I couldn't replicate the issue, it's difficult to pinpoint.

@sxyazi sxyazi closed this as not planned Won't fix, can't repro, duplicate, stale May 18, 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 Jun 18, 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

No branches or pull requests

2 participants