Repository navigation
coreutils: refresh WASIX build and fix tail and nohup - #1
Open
syrusakbary wants to merge 10000 commits into
Open
syrusakbary wants to merge 10000 commits into
syrusakbary wants to merge 10000 commits into
Conversation
The `uucore` package now builds successfully with Clippy for the `i686-unknown-haiku` target: ```console $ RUSTC_BOOTSTRAP=1 cargo clippy -q -Zbuild-std -p uucore --all-targets --target i686-unknown-haiku >/dev/null 2>&1; echo $? 0 ```
Instead of scattering #[cfg(unix)] / #[cfg(windows)] through nohup.rs, keep the platform-specific code in its own file behind a small shared interface: prepare(), run() and set_output_file_mode(). The unix-only CannotDetach/CannotReplace variants move to a unix PlatformError, so NohupError in nohup.rs is now platform independent.
A DETACHED_PROCESS child has no console, so leaving stderr on inherit() dropped its output. Point it at the child's stdout the way replace_fds() does with dup2_stderr(stdout()) on Unix: at nohup.out when stdout is a terminal, at the existing redirection otherwise. find_stdout() appends to nohup.out and reports it on stderr, so it is called once and the handle is cloned for stderr rather than reopened.
…ace and mount paths; df(windows): resolve paths by mount prefix
Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
Apply escape quoting and TTY control-character display in Config instead of patching quoting_style in the dir and vdir wrappers. Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
The rest of the input only got its own split when something was left
after the patterns, or when every pattern was a line number with
--suppress-matched. GNU always ends with that split, so a suppressed
match on the last line or an offset reaching the end of the input left
one file short. A {*} regex is the exception: it has already consumed
the input by the time it stops matching.
num-prime's `factors` shared one Pollard's rho budget across the whole factorization, so a number with many factors of similar size came back as an unfactored remainder and factor exited 1 with "Factorization incomplete. Remainders exists.". That is fixed upstream, along with the two performance bugs that made those numbers take tens of seconds. * tests/by-util/test_factor.rs (factors_many_primes_of_similar_size_completely, factors_a_wide_prime_power): New tests, for the two shapes that used to fail: a 301-bit product of ten primes just above 2^30, and 34359738421^7, which Pollard's rho cannot split at all and which hung until perfect powers were peeled off first. The `remaining.is_some()` branch in write_factors_str is kept even though it is now unreachable: `factorize` would be tidier, but it simply retries `factors` until it succeeds, so a future regression there would spin silently instead of saying anything.
and use "char" instead of "Option<char>"
When stdin is a terminal, nohup replaces it with /dev/null. It was opened read-only, so a command that went on to read stdin got a silent EOF and exited 0 (`nohup cat`, `nohup date --file -`). GNU opens /dev/null write-only on purpose: "Make the substitute file descriptor unreadable, so that commands that mistakenly attempt to read from standard input can report an error." Do the same, so such a read fails with EBADF and the command exits 1 as it does under GNU nohup. Fixes uutils#14556
conv=block built each padded record in memory, so a valid but huge cbs aborted on the allocation. It also restarted the record at each read, splitting records that span reads, and dropped a last record made only of spaces. Keep the current record across reads and write the padding in pieces. The sync flag of ConversionMode is no longer needed: conv=sync padding is already done when reading. Fixes uutils#14814
Signed-off-by: Zhiwei Liang <zhiwei.liang@zliang.me>
VmHWM is reported as the maximum of the stored watermark and the current RSS, so a reading taken while another test thread holds pages can come out higher than a later one, and after - before underflowed. Take the measurement in a child process running this test alone, and compute the growth with a saturating subtraction.
The unit test read /proc/self/status, which is shared with every other test in the binary, so it had to re-exec itself to get a quiet process. Running the real dd instead and reading the child's own peak RSS through wait4 drops that machinery and removes the race.
The existing who tests compare against the host's GNU who and the host's utmp, which is nearly empty on CI, so most of platform/unix.rs never ran. Write a small utmp file with one record of each type (boot, run level, clock change, init, login, user, dead) and check the output of each selector against it. This showed that `who -r` printed "last=N" for any previous run level other than 'N', instead of the level itself (GNU prints "last=3" for a 3 -> 5 switch). Closes uutils#9060
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refresh the WASIX fork to uutils/coreutils 0.13.0 (upstream main at a6d1eb3). The old package advertised commands it had not compiled, including tail and nohup. Build 83 real entry points with locked cargo-wasix dependencies, enable polling tail and signal-preserving nohup, and generate the package commands from the compiled binary.
License notices are mounted at
/opt/coreutils/licensesso/usr/bincommand installation works. Includes a regression for/usr/bin/coreutils, WASIX command/behavior tests, a native SIGHUP regression test, and CI that rebuilds from a clean target and compares the Wasm and WebC bytes. Package: wasmer/coreutils 1.0.27; build and publishing instructions are in WASIX.md.