rbtcollins / fs_at Goto Github PK
View Code? Open in Web Editor NEWFilesystem 'at' implementations for Unix and Windows
Filesystem 'at' implementations for Unix and Windows
Got an error:
error[E0432]: unresolved import `libc::openat64`
--> /cargo/registry/src/github.com-1ecc6299db9ec823/fs_at-0.1.1/src/unix.rs:17:13
|
17 | use libc::openat64;
| ^^^^^^--------
| | |
| | help: a similar name exists in the module: `openat`
| no `openat64` in the root
For more information about this error, try `rustc --explain E0432`.
error: could not compile `fs_at` due to previous error
I guess it similar with #55. See more at: https://github.com/rust-lang/rustup/actions/runs/4397256299/jobs/7700257156
When trying to build the create on iOS, the build fails with the error:
Compiling fs_at v0.1.7
error[E0425]: cannot find value `O_PATH` in crate `libc`
--> /Users/felix.barz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/fs_at-0.1.7/src/unix.rs:139:55
|
139 | libc::O_RDONLY | libc::O_NOFOLLOW | libc::O_PATH | libc::O_CLOEXEC | libc::O_NOCTTY;
| ^^^^^^ not found in `libc`
For more information about this error, try `rustc --explain E0425`.
error: could not compile `fs_at` (lib) due to previous error
When checking the sources, whe can see that open_path_at
is disabled for macos: https://github.com/rbtcollins/fs_at/blob/main/src/unix.rs#L136
This should also be disable for iOS. When adding target_os = "ios"
to the exclusions (including a few other places), the library compiles again.
https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/ntifs/nf-ntifs-ntsetinformationfile windows - FileLinkInformation can link to an existing file
RootDirectory permits safe construction of the link object itself, and the existing file handle is provided in the call to NtSetInformationFile, so this is safe.
For unix, linkat takes two dir handles, so similarly safe.
This is not a direct dependency.
$ cargo tree -i proc-macro2
proc-macro2 v1.0.56
├── quote v1.0.26
│ ├── syn v1.0.109
│ │ └── test-log v0.2.11 (proc-macro)
│ │ [dev-dependencies]
│ │ └── fs_at v0.1.9 (C:\Users\robertc\Documents\src\fs_at)
│ └── test-log v0.2.11 (proc-macro) (*)
├── syn v1.0.109 (*)
└── test-log v0.2.11 (proc-macro) (*)
So this doesn't affect users on nightly, but we can't test on nightly at the moment.
Running `/home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name proc_macro2 --edition=2018 /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.56/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no --cfg 'feature="default"' --cfg 'feature="proc-macro"' -C metadata=516e696159394256 -C extra-filename=-516e696159394256 --out-dir /home/runner/work/fs_at/fs_at/target/debug/deps -L dependency=/home/runner/work/fs_at/fs_at/target/debug/deps --extern unicode_ident=/home/runner/work/fs_at/fs_at/target/debug/deps/libunicode_ident-3357ee1867c8a168.rmeta --cap-lints allow --cfg use_proc_macro --cfg wrap_proc_macro --cfg proc_macro_span`
error[E0635]: unknown feature `proc_macro_span_shrink`
--> /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.56/src/lib.rs:92:30
|
92 | feature(proc_macro_span, proc_macro_span_shrink)
| ^^^^^^^^^^^^^^^^^^^^^^
For more information about this error, try `rustc --explain E0635`.
error: could not compile `proc-macro2` (lib) due to previous error
Caused by:
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
Cargo.toml
cfg-if 1.0.0
cvt 0.1.1
log 0.4.21
env_logger 0.11.3
fs-set-times 0.20.1
rayon 1.8.1
tempfile 3.10.0
test-log 0.2.15
libc 0.2.153
nix 0.26.2
aligned 0.4.1
once_cell 1.19.0
windows-sys 0.48.0
.github/workflows/publish.yaml
actions/cache v3
.github/workflows/rust.yml
actions/checkout v3
Swatinem/rust-cache v2
actions/checkout v3
Swatinem/rust-cache v2
actions/checkout v3
Swatinem/rust-cache v2
This is partially done, but a little stuck on:
@Xaeroxe offered in XAMPPRocky/remove_dir_all#42 to help out; this is a call for that help :)
Continuing the thread from #12 and sourcefrog/conserve#174.
In a tree that might have symlinks I'd want an option to open files with O_NOFOLLOW
on Linux. (It's in Nix and libc; it doesn't seem to be in std?) (I filed #14.)
If the entry is a symlink, that will fail with ELOOP
. I could then try to read it with readlinkat
. If it then changes back to a file, readlinkat
will give you an error.
I don't think I see the harm in DirEntry
giving you an indication of the file type so that you know where to begin. There is a chance of a race, that when you read the dir it's a symlink and then it changes to be a file, or vice versa. But the worst that happens is that the call you use to read the file or link will fail. So I don't think the race is meaningful?
A different approach would be to begin with open O_PATH
on Linux, and then you can stat it, find out what type of thing it is, and then proceed to either "really open it" or read the link. In this case you only pass the filename once, which seems nice.
O_PATH
seems to be Linux specific https://stackoverflow.com/q/61337371.
This also seems to need more syscalls. The arguably straightforward way is
If readdir does not tell you the type, on Linux, you can do
This just seems like more steps though.
On non-Linux Unix... actually I don't see how you can do anything other than attempt to open it or readlink it? But you might as well have a clue which of them is going to work?
For https://github.com/sourcefrog/conserve to use this very much I think it would want a way to open and read directories relative to a different directory fd.
This might already be possible but I don't think I see it?
On Linux this would be something like openat
then getdents64
? Or on more generic Unix perhaps openat
, fdopendir
, readdir
?
#40 was solved by reimplementing things that windows-sys doesn't yet have. Tracking bug for burning that down. See links to github in the source to see what is pending.
See the code but in short we're working around race conditions such as privileged access target control via symlinks; while there aren't any TOCTOU's present, there is the possibility for creating a directory in an arbitrary path (which mkdir
itself has and there is resistance to fixing in the Linux kernel community).
At this point there doesn't seem to be a better path, but should one arise we should use it.
We should use posix semantics to delete on windows.
Rust platform support claims windows 7 and up.
I can't find any reference to the necessary structure to request this the way the stdlib does in the MS docs. The closest I've come just notes its existence, not when APIs started accepting it, nor what will happen on older Windows versions if the structure class, or bits in the flag that were defined more recently are passed in.
@ChrisDenton sorry for tagging you out of the blue but I'm hoping you can give a little guidance / point to docs about the thing to do here.
My inclination was to first version-check the runtime OS for windows 10, and then and only then attempt the new information class, falling back on error to the older class, but the Rust stdlib seems to unconditionally use the new information class, so if thats safe it seems more straightforward...
Line 17 in fba9c86
When using this crate on a project built for target_os="ios"
the above line is causing a build failure.
error[E0432]: unresolved import `libc::openat64`
-->~/.cargo/registry/src/github.com-1ecc6299db9ec823/fs_at-0.1.1/src/unix.rs:17:13
|
17 | use libc::openat64;
| ^^^^^^--------
| | |
| | help: a similar name exists in the module: `openat`
| no `openat64` in the root
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.