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

os error 22 on .zfs hidden directory #609

Open
darkain opened this issue Dec 1, 2019 · 5 comments
Open

os error 22 on .zfs hidden directory #609

darkain opened this issue Dec 1, 2019 · 5 comments

Comments

@darkain
Copy link

@darkain darkain commented Dec 1, 2019

root@titanic /mnt/datastore/RAWs/.zfs# exa
".": Invalid argument (os error 22)
root@titanic /mnt/datastore/RAWs/.zfs# /bin/ls
snapshot

the ZFS file system creates a super-hidden (even ls -al wont show it) .zfs folder, but you can still cd into it. once in this folder, exa doesn't work. exa however works in sub-folders of .zfs, such as .zfs/snapshots. ls, as shown above, still works.

@darkain
Copy link
Author

@darkain darkain commented Jan 6, 2020

This appears to only happen on FreeBSD (tested on 11.3)
This does NOT appear on CentOS Linux 8.0

@darkain
Copy link
Author

@darkain darkain commented Jan 7, 2020

https://github.com/ogham/exa/blob/master/src/fs/dir.rs#L38

This is the exact location of the error. I don't really have any Rust skills to debug what is going on, or how to properly trap the error. If my very basic debugging skills are correct, the read_dir works, .map works (both of them), and it bails on something involving the .collect part.

@ArniDagur
Copy link

@ArniDagur ArniDagur commented Jan 11, 2020

Can you give the output of strace exa? Using the strace CLI tool.

@darkain
Copy link
Author

@darkain darkain commented Jan 13, 2020

as stated above, this is freebsd, not linux, so there is no strace utility.

@Freaky
Copy link

@Freaky Freaky commented May 21, 2020

We have ktrace, dtrace, and truss, though.

Relevant bit:

 12974 exa      CALL  getdirentries(0x3,0x8016ad000,0x1000,0x8016172e8)
 12974 exa      RET   getdirentries 840/0x348
 12974 exa      CALL  getdirentries(0x3,0x8016ad000,0x1000,0x8016172e8)
 12974 exa      RET   getdirentries -1 errno 22 Invalid argument

GNU ls works, but produces a warning from this error. BSD ls appears to swallow it somewhere.

If I filter out that error, exa works fine in a .zfs:

        let contents = fs::read_dir(&path)?
            .map(|result| result.map(|entry|entry.path()))
            .filter(|result| result.is_ok() || result.as_ref().unwrap_err().kind() != std::io::ErrorKind::InvalidInput)
            .collect::<Result<_,_>>()?;

Maybe more generally this code should return the entries it does manage to get and there should be a mechanism to warn about encountered errors, rather than discarding the entire thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.