Commit graph

8718 commits

Author SHA1 Message Date
Daniel Hofstetter
4e311ed89b
Merge pull request #8423 from sylvestre/en-embedded
Some checks are pending
CICD / Dependencies (push) Waiting to run
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Build/stable (push) Blocked by required conditions
CICD / Build/nightly (push) Blocked by required conditions
CICD / Binary sizes (push) Blocked by required conditions
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Separate Builds (push) Waiting to run
CICD / Build/SELinux (push) Blocked by required conditions
GnuTests / Run GNU tests (native) (push) Waiting to run
GnuTests / Run GNU tests (SELinux) (push) Waiting to run
GnuTests / Aggregate GNU test results (push) Blocked by required conditions
Android / Test builds (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
L10n (Localization) / L10n/Locale Embedding Regression Test (push) Waiting to run
L10n (Localization) / L10n/Build and Test (push) Waiting to run
L10n (Localization) / L10n/Fluent Syntax Check (push) Waiting to run
L10n (Localization) / L10n/French Integration Test (push) Waiting to run
L10n (Localization) / L10n/Multi-call Binary Install Test (push) Waiting to run
L10n (Localization) / L10n/Installation Test (Make & Cargo) (push) Waiting to run
L10n (Localization) / L10n/Locale Support Verification (push) Waiting to run
WSL2 / Test (push) Waiting to run
l10n: embedded english strings + test the whole thing in github
2025-08-03 15:08:10 +02:00
Martin Kunkel
3b4b769976
tests: fix execution on WSL2, Ubuntu 24.04 (#8235)
* tests: fix execution on WSL2, Ubuntu 24.04

Skip incompatible parts of tests to ensure that
    cargo nextest run --features unix
executes successfully in WSL2, Ubuntu 24.04 distribution.

Changes
* Skip tests that required sys/kernel/profiling which is not
available in WSL2 default configuration.
* Use timezones in tests that are part of the standard tzdata
list and not only available in backwards list. Backwards list is
not installed by default in Ubuntu 24.04 (package tzdata-legacy).
* check that /proc/modules is not empty when expecting content,
because it is empty in WSL2 default configuration.
* Skip logname test not only in WSL1, also in WSL2.

* Add workflow for WSL2

This will setup WSL2 on windows-latest runner, install
Ubuntu-24.04, and run the feat_os_unix tests.

* wsl2: implemented review findings

---------

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2025-08-03 14:38:49 +02:00
Sylvestre Ledru
df2fca588c l10n: when built indiv, only embed the relevant locale file 2025-08-03 10:59:38 +02:00
Sylvestre Ledru
a432fe811f l10n: use the embedded english strings when relevant 2025-08-03 10:59:38 +02:00
Daniel Hofstetter
9938db39bc
Merge pull request #8333 from sylvestre/selinux-mv
Some checks are pending
CICD / Style/cargo-deny (push) Waiting to run
CICD / Dependencies (push) Waiting to run
CICD / Style/deps (push) Waiting to run
CICD / Documentation/warnings (push) Waiting to run
CICD / MinRustV (push) Waiting to run
CICD / Test all features separately (push) Blocked by required conditions
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Build/stable (push) Blocked by required conditions
CICD / Build/nightly (push) Blocked by required conditions
CICD / Binary sizes (push) Blocked by required conditions
CICD / Build (push) Blocked by required conditions
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Separate Builds (push) Waiting to run
CICD / Build/SELinux (push) Blocked by required conditions
GnuTests / Run GNU tests (native) (push) Waiting to run
GnuTests / Run GNU tests (SELinux) (push) Waiting to run
GnuTests / Aggregate GNU test results (push) Blocked by required conditions
Android / Test builds (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
mv: add support for selinux and add minor refactor
2025-08-01 09:36:06 +02:00
Dorian Péron
d90f3a4ec3
Merge pull request #8416 from drinkcat/cp-attr
Some checks are pending
CICD / Build (push) Blocked by required conditions
CICD / Style/cargo-deny (push) Waiting to run
CICD / Style/deps (push) Waiting to run
CICD / Test all features separately (push) Blocked by required conditions
CICD / Documentation/warnings (push) Waiting to run
CICD / MinRustV (push) Waiting to run
CICD / Dependencies (push) Waiting to run
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Build/stable (push) Blocked by required conditions
CICD / Binary sizes (push) Blocked by required conditions
CICD / Build/nightly (push) Blocked by required conditions
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Separate Builds (push) Waiting to run
CICD / Build/SELinux (push) Blocked by required conditions
GnuTests / Run GNU tests (native) (push) Waiting to run
GnuTests / Run GNU tests (SELinux) (push) Waiting to run
GnuTests / Aggregate GNU test results (push) Blocked by required conditions
Android / Test builds (push) Waiting to run
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
`cp`: Properly preserves fifos and symlink attributes
2025-07-31 18:04:17 +02:00
Sylvestre Ledru
6e930966fb selinux: introduce get_getfattr_output to verify the output of getfatt 2025-07-31 17:45:34 +02:00
Sylvestre Ledru
ad8fdbdb77 mv: implement selinux options (-Z/--context) 2025-07-31 17:45:34 +02:00
Daniel Hofstetter
7003b1d3fc
Merge pull request #8418 from drinkcat/pr-time
pr: Add support for -D/--date-format parameter
2025-07-31 16:34:44 +02:00
Nicolas Boichat
bdedd24e06
pr: Move vector creation
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2025-07-31 22:05:35 +08:00
Daniel Hofstetter
b5f453a562
Merge pull request #8417 from drinkcat/du-ls-time-test
ls: -u/-c/--time control sorting when -l is not used
2025-07-31 15:55:40 +02:00
Daniel Hofstetter
194aa89d63 rm: implement From for InteractiveMode 2025-07-31 09:49:27 +02:00
Daniel Hofstetter
f33244321a rm: use clap to handle --interactive args 2025-07-31 09:49:05 +02:00
Nicolas Boichat
d35a60e5e2 pr: Add support for -D/--date-format parameter 2025-07-31 15:45:31 +08:00
Nicolas Boichat
4878e65ea7 pr: Set date format depending on environment.
Based on GNU manual.
2025-07-31 15:45:31 +08:00
Nicolas Boichat
149529a494 pr: Switch to uucore::time formatting 2025-07-31 15:45:31 +08:00
Nicolas Boichat
ec11b68543 ls: -u/-c/--time control sorting when -l is not used
Fallback on those flags if --sort is not otherwise set.
2025-07-31 09:00:15 +02:00
Nicolas Boichat
4b11692db3 cp: Also copy attributes in copy_symlink
Most attributes can actually be applied to symlinks (mode and
xattr are exceptions), so try to copy them, if possible.

Fort those 2 exceptions, we don't need any special handling as:
 - Mode errors would be ignored anyway.
 - The source symlink cannot have any xattr anyway, so no
   attribute is attempted to be set on the destination.
2025-07-30 20:03:22 +08:00
Nicolas Boichat
4cb57fb7ac ls: cleanup imports
They were a bit jumbled with no particular logic, at least that
I could see.
2025-07-30 17:59:52 +08:00
Nicolas Boichat
4ba8d3e0a9 ls: Fix Windows build 2025-07-30 17:58:39 +08:00
Nicolas Boichat
4d48626eeb cp: File logic error when preserving attributes for fifos
There was a mismatch between the test, the comment, and the code.

The intention was to _preserve_ attributes if the source of a
fifo/pipe still exists. Perhaps the clearest way is to modify
the test (as that avoids code duplication).

Also add a basic test for that, if permissions are preserved, the
rest should also be preserved correctly.

Fixes the first part of #8402.
2025-07-30 17:37:51 +08:00
Nicolas Boichat
2d63020cd9 du: Add support for reading time-style from environment
Similar as what ls does, but du has an extra compatibility layer
described in the GNU manual (and that upstream dev helped me
understand: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79113 ).
2025-07-30 17:27:22 +08:00
Nicolas Boichat
b99615c1e3 du/ls: Move common time formats to constants in uucore/time
Along the way:
 - Fix the full-iso format, that was supposed to use %N, not %f
   (%f padded with chrono, but not with jiff, and %N is more correct
   and what GNU says in their manual)
 - The Hashmap thing in parse_time_style was too smart, to a point
   that it became too unflexible (it would have been even worse
   when we added locale support).

I was hoping the share more of the code, but that seems difficult.
2025-07-30 17:27:22 +08:00
Nicolas Boichat
1272bfc222 du: Add support for +FORMAT time-style
Also add to error text, which... GNU coreutils doesn't do for
some reason.
2025-07-30 17:27:22 +08:00
Nicolas Boichat
fc08fa1d62 ls: Print dates in the future as "old" ones
ls has different time format for recent (< 6 months) and older files.
Files in the future (even by just a second), are considered old,
which makes sense as we probably want the date to be printed in
that case.
2025-07-30 17:27:22 +08:00
Nicolas Boichat
4901f370cb ls: Add support for newline separated format for recent/older
Documented in GNU manual.

Also improve test_ls to test for both recent and older files.
2025-07-30 17:27:22 +08:00
Nicolas Boichat
e5f2f79ea1 ls: Allow reading time-style from TIME_STYLE environment variable
According to GNU manual.
2025-07-30 17:27:22 +08:00
Nicolas Boichat
a1519e1b74 ls: Add support for --time-style=posix-*
From GNU manual, if LC_TIME=POSIX, then the "locale" timestamp is
used. Else, `posix-` is stripped and the format is parsed as usual.

Also, just move the whole text to the locale file, instead
of trying to generate it manually.
2025-07-30 17:27:20 +08:00
Sylvestre Ledru
a055e856dd
fix rustfmt 2025-07-30 09:51:14 +02:00
Sylvestre Ledru
e68f73489c
Merge branch 'main' into stat-bigtime 2025-07-30 09:29:19 +02:00
Dorian Péron
614531d13c
Merge branch 'main' into refactor-mkdir-mode-parsing 2025-07-29 22:01:53 +02:00
Sylvestre Ledru
3a214f2842
Merge branch 'main' into refactor-mkdir-mode-parsing 2025-07-29 16:54:15 +02:00
Daniel Hofstetter
000be5b73a mv: use next() instead of peekable().peek()
in is_empty_dir()
2025-07-29 16:52:06 +02:00
Amirhossein Ghanipour
8c9e739694 refactor(mkdir): Simplify mode argument parsing 2025-07-29 15:11:35 +03:30
Julian Andres Klode
190ddd105c install: Fix --no-target-directory with existing file
install should silently override existing target files, but it
inadvertently checked whether the target exists rather than
for the target being a directory, hence the overwrite failed,
saying it cannot overwrite the directory with non-directory.

Bug-Ubuntu: https://bugs.launchpad.net/bugs/2118785
2025-07-29 12:24:31 +02:00
Jonas Jelten
79bbf52a21
Merge pull request #8343 from TheJJ/fix-mknod-mode
mknod: set cli specified file mode even when it's 0o666
2025-07-29 11:53:21 +02:00
Daniel Hofstetter
361f1b9ce5 who: rename var, cleanup spell-checker:ignore 2025-07-29 10:19:09 +02:00
Daniel Hofstetter
294e29deb2
Merge pull request #8392 from sylvestre/l10n-macros
Create macros for l10n translations
2025-07-29 09:46:20 +02:00
Amirhossein Ghanipour
aff71abdc4 style(pwd): simplify physical_path implementation 2025-07-29 07:14:28 +03:30
Sylvestre Ledru
a73ecd95e6 uucore: adjust it too to use the translate macro 2025-07-28 22:04:40 +02:00
Sylvestre Ledru
50fc84136f l10n: Use FluentArgs instead of HashMap directly 2025-07-28 22:04:40 +02:00
Sylvestre Ledru
862a7a705c use the new translate! macro for translation
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2025-07-28 22:04:40 +02:00
Sylvestre Ledru
bd005d12b9 uucore/locale: create a macro to simplify the translation calls 2025-07-28 21:32:54 +02:00
Nicolas Boichat
8428291461 fsext: Fix metadata_get_time for change time (ctime) before 1970
Useful for archaeologists and time travellers, do not crash if
ctime is before 1970.

Creating a file with such a change time is a bit challenging
(touch can't change that), so we can't easily add end-to-end
tests.

Steps to create a filesystem with a file `x` with birth/change
time in 1960.
```
dd if=/dev/zero bs=100M count=0 seek=1 of=ext4
mkfs.ext4 ext4
sudo mount ext4 mnt
touch mnt/x
umount mnt
echo "set_inode_field x ctime 196001010101" | debugfs -w ext4
echo "set_inode_field x ctime_extra 1234" | debugfs -w ext4
echo "set_inode_field x crtime 196001010101" | debugfs -w ext4
echo "set_inode_field x crtime_extra 0x123400" | debugfs -w ext4
sudo mount ext4 mnt
```

$ cargo run -p uu_stat mnt/x
  File: mnt/x
  size: 0         	Blocks: 0          IO Block: 1024   regular empty file
Device: 700h/1792d	Inode: 13          Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2025-07-26 19:52:00.849821694 +0800
Modify: 2025-07-26 19:52:00.849821694 +0800
Change: 1960-01-02 09:01:00.000298240 +0800
 Birth: 1960-01-02 09:01:00.000298240 +0800
2025-07-28 21:16:11 +08:00
Nicolas Boichat
6c73ef6226 uucore: time: Add options for format_system_time
Depending on the caller, we want the number of seconds, that
and an error printed out, or seconds+nanoseconds.
2025-07-28 21:16:11 +08:00
Nicolas Boichat
6eb75f2d93 stat: Stop relying on fsext::Birth
We can rely on other fsext/time functions, and stay a bit more
consistent.
2025-07-28 21:16:11 +08:00
Nicolas Boichat
9c13e3f518 stat: Use uucore::time:format_system_time function 2025-07-28 21:16:11 +08:00
Sylvestre Ledru
fb4d611445
Merge pull request #8404 from drinkcat/stat-fluent
Some checks are pending
CICD / Build (push) Blocked by required conditions
CICD / Documentation/warnings (push) Waiting to run
CICD / MinRustV (push) Waiting to run
CICD / Dependencies (push) Waiting to run
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Build/stable (push) Blocked by required conditions
CICD / Build/nightly (push) Blocked by required conditions
CICD / Binary sizes (push) Blocked by required conditions
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Separate Builds (push) Waiting to run
CICD / Build/SELinux (push) Blocked by required conditions
GnuTests / Aggregate GNU test results (push) Blocked by required conditions
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
CICD / Test all features separately (push) Blocked by required conditions
CICD / Style/cargo-deny (push) Waiting to run
CICD / Style/deps (push) Waiting to run
GnuTests / Run GNU tests (native) (push) Waiting to run
GnuTests / Run GNU tests (SELinux) (push) Waiting to run
Android / Test builds (push) Waiting to run
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
stat/locales: Fix fluent_linter errors
2025-07-28 14:07:46 +02:00
Nicolas Boichat
2c106609cc stat/locales: Fix fluent_linter errors
Arguably this should be part of the CI, but I'm not sure how
to run it outside of precommit.
2025-07-28 17:22:53 +08:00
Nicolas Boichat
49b2466a9c uucore: selinux: Add tests for symlinks and fifo
Check that we can follow (or not) symlinks to get their SElinux context.

Also, check that we can get context from a fifo (we used to hang).
2025-07-28 15:08:21 +08:00