SUPERCILEX / fuc

Modern, performance focused unix commands
Apache License 2.0
340 stars 8 forks source link

os error 22 while copying a simple directory #31

Closed sc420 closed 8 months ago

sc420 commented 8 months ago

I encountered the following error when copying a directory that contains only a text file. I'm using CentOS 7.5. rmz works just fine.

user@hostname:~$ cpz --version
cpz 1.1.10
user@hostname:~$ rustc --version
rustc 1.75.0 (82e1608df 2023-12-21)
user@hostname:~$ cpz test test2
Error: An I/O error occurred
│
╰─▶ Invalid argument (os error 22)
    ╰╴Failed to copy file: "test/abc.txt"
user@hostname:~$ cat test/abc.txt
ABC
user@hostname:~$ ls test
abc.txt
user@hostname:~$ 
SUPERCILEX commented 8 months ago

Are you on a 32 bit system maybe? And what version of linux (uname -a)?

SUPERCILEX commented 8 months ago

Also, are you able to compile this project yourself? If so, can you change this line to use isize::MAX and see if that fixes things? https://github.com/SUPERCILEX/fuc/blob/66d5296b858bb238f1ca7fad958075f97bbac0ac/fuc_engine/src/ops/copy.rs#L401

sc420 commented 8 months ago

My uname -a outputs Linux hostname 4.14.78-9.x86_64 #18 SMP Tue Feb 2 07:46:57 PST 2021 x86_64 x86_64 x86_64 GNU/Linux, so it's a 64 bit system.

When building the cpz I encountered some error, but the error is gone after I changed isize::MAX to usize::MAX on line 401 based on your suggestion, and then the build was successful.

But the compiled program still has trouble copying the simple directory:

user@hostname:~/scratch/github/fuc/target/debug$ ./cpz test test2
Error: An I/O error occurred
├╴at cpz/src/main.rs:70:18
│
╰─▶ Invalid argument (os error 22)
    ├╴at cpz/src/main.rs:68:45
    ╰╴Failed to copy file: "test/abc.txt"
SUPERCILEX commented 8 months ago

Oh wait sorry, I forgot that the types won't be compatible. Do usize::MAX / 2 instead.

sc420 commented 8 months ago

It worked! Will this fix be in the new version?

SUPERCILEX commented 8 months ago

Do you want to submit a PR? :grin: Otherwise no worries I can do it.

sc420 commented 8 months ago

oh sure, if the fix is that simple and OS independent