Age | Commit message (Collapse) | Author |
|
1842: add eaccess on freebsd, dragonfly and linux r=rtzoeller a=SteveLauC
#### man pages
* [FreeBSD](https://www.freebsd.org/cgi/man.cgi?query=eaccess&sektion=2&n=1)
* [DragonFly](https://man.dragonflybsd.org/?command=access§ion=2)
* [Linux](https://man7.org/linux/man-pages/man3/euidaccess.3.html)
#### difference between `eaccess` and `access/faccessat`
IMHO, `eaccess` uses effective identifiers to perform the permission check while `access/faccessat` use real IDs.
Fixes #1373
Co-authored-by: Steve Lau <stevelauc@outlook.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Calling `unwrap` on the result of `CString::new` may cause the current
thread to panic, which is a bit surprising undocumented behavior. It
would be more reasonable to treat the erroneous name as a non-existing
user or group.
|
|
|
|
1785: Remove deprecated items r=asomers a=SteveLauC
#### What this pr does
1. Convert `assert!(x == y)` to `assert_eq!(x, y)`
2. Convert `assert!(x != y)` to `assert_ne!(x, y)`
3. Add `.unwrap()` to unused `Result/Option` (in code comments)
4. Convert `std::ixx::MAX` to `ixx::MAX`
5. Convert `Box<Trait>` to `Box<dyn Trait>`
Co-authored-by: SteveLauC <stevelauc@outlook.com>
Co-authored-by: SteveLau <stevelauc@outlook.com>
|
|
Passwords are hashed, not encrypted.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1745: Change gethostname to use a buffer of MaybeUninit values r=asomers a=nathaniel-daniel
Changing `gethostname` to accept a buffer of `MaybeUninit` bytes allows the user to avoid needlessly initializing a buffer. This is a breaking API change.
Co-authored-by: Nathaniel Daniel <nathaniel.daniel12@gmail.com>
|
|
|
|
|
|
|
|
Add the autocfg crate as a build dependency, and introduce
has_doc_alias as a conditional compilation symbol.
|
|
Signed-off-by: Costin-Robert Sin <sin.costinrobert@gmail.com>
|
|
Some of the operations inside the pipe function are safe and should
not be included inside an unsafe block.
Signed-off-by: Costin-Robert Sin <sin.costinrobert@gmail.com>
|
|
Signed-off-by: Costin-Robert Sin <sin.costinrobert@gmail.com>
|
|
1727: Add From<uid_t> and From<gid_t> r=rtzoeller a=vkkoskie
Conversions to/from primitive uid_t and gid_t to newtype Uid and Gid types are valid and infallible, but are only implemented in one direction. This provides the counterparts in the other direction.
These conversions are identical in behavior to the from_raw methods. However, using the more idiomatic From trait enables easier interoperability with other crates (e.g., deserialization with serde)
Co-authored-by: Keith Koskie <vkkoskie@gmail.com>
|
|
Implements the following traits:
* From<uid_t> for Uid
* From<gid_t> for Gid
|
|
|
|
* enabled as much functionality and defines that match
updated libc definitions for haiku
|
|
features => feature
users => user
Neither of these features have yet been included in a release, so it's
ok to rename them.
|
|
|
|
|
|
|
|
|
|
|
|
Using features reduces build time and size for consumer crates. By
default all features are enabled.
|
|
|
|
Fixes #1541
|
|
And this time, start running Clippy in CI
|
|
|
|
|
|
1473: sys/stat: add a safe wrapper for mknodat(2) r=asomers a=lucab
This introduces a new `mknodat` helper.
Ref: https://pubs.opengroup.org/onlinepubs/9699919799/functions/mknod.html
1474: Mark most C-derived enums as non_exhaustive r=asomers a=asomers
Since libc may add new variants at any time, Nix's consumers should not
use exhaustive match patterns.
Fixes #1182
1476: Constify many functions r=asomers a=asomers
Constify most functions that can be constified. The exceptions are
mostly accessors for structs that have no const constructor.
Co-authored-by: Luca BRUNO <luca.bruno@coreos.com>
Co-authored-by: Alan Somers <asomers@gmail.com>
|
|
Add From<User> for libc::passwd trait implementation to convert
a User into a libc::passwd
Implementation consumes the User struct, giving ownership over
the internal members to the libc::passwd struct
Add the User::gecos field to 64-bit Android builds, since it is
supported by libc::passwd for those builds
|
|
Since libc may add new variants at any time, Nix's consumers should not
use exhaustive match patterns.
Fixes #1182
|
|
Replaces `println!` with raw `libc::write`. `println!` isn't guaranteed
to be async-signal-safe, and almost certainly *isn't* due to internal
buffering and locking.
Adds a call to `libc::_exit` in the child arm, so that it doesn't fall
through and start executing the parent code.
Adds a call to `waitpid` in the parent arm, to clean up the child
process.
Removes the `no_run` directive, so that it's run in the doc tests.
|
|
Now that Nix's weird error types are eliminated, there's no reason not
to simply use Errno as the Error type.
|
|
For many of Nix's consumers it be convenient to easily convert a Nix
error into a std::io::Error. That's currently not possible because of
the InvalidPath, InvalidUtf8, and UnsupportedOperation types that have
no equivalent in std::io::Error.
However, very few of Nix's public APIs actually return those unusual
errors. So a more useful API would be for Nix's standard error type to
implement Into<std::io::Error>.
This commit makes Error a simple NewType around Errno. For most
functions it's a drop-in replacement. There are only three exceptions:
* clearenv now returns a bespoke error type. It was the only Nix
function whose error couldn't be cleanly mapped onto an Errno.
* sys::signal::signal now returns Error(Errno::ENOTSUP) instead of
Error::UnsupportedOperation when the user passes an incompatible
argument to `handler`.
* When a NixPath exceeds PATH_MAX, it will now return
Error(Errno::ENAMETOOLONG) instead of Error::InvalidPath.
In the latter two cases there is now some abiguity about whether the
error code was generated by Nix or by the OS. But I think the ambiguity
is worth it for the sake of being able to implement Into<io::Error>.
This commit also introduces Error::Sys() as a migration aid. Previously
that as an enum variant. Now it's a function, but it will work in many
of the same contexts as the original.
Fixes #1155
|
|
|
|
|
|
* Fix race conditions in the tests. Two tests were grabbing a mutex but
immediately dropping it. Thank you, Clippy.
* Remove vestigial Windows support. Remove some code added to support
Windows in 2015. Nix is no longer intended to ever run on Windows.
* Various other minor Clippy lints.
|