Age | Commit message (Collapse) | Author |
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
Hopefully improve unistd::alarm::set's doc test's reliability
|
|
|
|
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
|
|
We have one UNIX group that contains most of our users whose size is
about 20 kB, so `Group::from_name` is failing with ERANGE.
The discussion on PR #864 suggests that 1 MB is a reasonable maximum -
it follows what FreeBSD's libc does. (glibc appears to have no maximum
on the _r function and will just double the buffer until malloc fails,
but that's not particularly Rusty.)
|
|
Co-authored-by: Dominik Hassler <hadfl@omnios.org>
Co-authored-by: Joshua M. Clulow <josh@sysmgr.org>
|
|
|
|
Closes #1339.
|
|
Allow nix to compile on Fuchsia by conditionally avoiding libc
functionality that does not exist for Fuchsia.
|
|
On Cirrus CI, this test would sometimes fail, probably due to pause
being awoken by SIGRT_1. sigwait is a superior alternative to pause.
Fixes #1354
|
|
Travis has been super-slow lately (> 6 hours per build). Cirrus is much
faster: about 20 minutes. Cirrus also has slightly better test
coverage, mainly because it doesn't use SECCOMP.
Also,
* Fix the Redox CI build. The old Travis configuration didn't actually
build for Redox, so we never noticed that Redox can't be built with a
stable compiler. Thanks to @coolreader18 for finding this.
* Disable the udp_offload tests on cross-tested platforms. These tests
are failing with ENOPROTOOPT in Cirrus-CI. I suspect it's due to a
lack of support in QEMU. These tests were skipped on Travis because
its kernel was too old.
* Fix require_kernel_version on Cirrus-CI. Cirrus reports the Linux
kernel version as 4.19.112+, which the semver crate can't handle.
* Fix test_setfsuid on Cirrus. When run on Cirrus, it seems like the
file in /tmp gets deleted as soon as it's closed. Probably an
overzealous temporary file cleaner. Use /var/tmp, because no
temporary file cleaner should run in there.
* Skip mount tests on Cirrus. They fail for an unknown reason.
Issue #1351
* Skip the AF_ALG tests on Cirrus-CI
Issue #1352
|
|
Fix tests. No change in documentation.
Resolves #1030.
|
|
|
|
These were previously missing on musl and mips targets because of
missing definitions in the libc crate.
|
|
|
|
|
|
|
|
1255: Remove several deprecated constants and functions r=asomers a=asomers
* `unistd::daemon` on Apple
* `unistd::pipe2` on Apple
* `sys::event::FilterFlag::NOTE_EXIT_REPARENTED` on Apple
* `sys::event::FilterFlag::NOTE_REAP` on Apple
* `sys::ptrace::ptrace` on Android and Linux
All have been deprecated for more than two releases and one year.
Co-authored-by: Alan Somers <asomers@gmail.com>
|
|
|
|
* `unistd::daemon` on Apple
* `unistd::pipe2` on Apple
* `sys::event::FilterFlag::NOTE_EXIT_REPARENTED` on Apple
* `sys::event::FilterFlag::NOTE_REAP` on Apple
* `sys::ptrace::ptrace` on Android and Linux
All have been deprecated for more than two releases and one year.
|
|
|
|
|
|
- Make sure all tests pass the CI
- Redox does not (yet) have passwd functions, so remove it
|
|
|
|
FIFOs are not supported (yet?) by RedoxFS, so disable it
|
|
|
|
Some things are not implemented yet in redox, so a lot of annotations
were added to remove functions when compiling for redox. Those functions
will hopefully be added in time, but for now it's better to have partial
support than none.
Blocked by https://github.com/rust-lang/libc/pull/1438
|
|
std::convert::Infallible has been available since Rust 1.34 and nix
currently targets Rust 1.36 or later so this should not cause
problems.
Fixes #1238
|
|
See https://netbsd.gw.com/cgi-bin/man-cgi?pipe2+2+NetBSD-current and
http://man7.org/linux/man-pages/man2/pipe.2.html
|
|
Functions such as Group::from_anything use reserve_double_buffer_size
in a loop, expecting it to return ERANGE if the passed limit is
reached.
However, the returned vector is passed as pointer to a libc function
that writes data into memory and doesn't update the length of the
Vec. Because of this, the previous code would never return ERANGE and
the calling loops would never exit if they hit a case where the
required buffer was larger than the maximum buffer.
This fixes the problem by checking the capacity rather than the
length.
Signed-off-by: Steven Danna <steve@chef.io>
|
|
|