Skip to content

Commit 98b9c04

Browse files
committed
Merge branch 'proper_alignment' of https://github.com/kimono-koans/coreutils into proper_alignment
2 parents e80b3bc + 467f29b commit 98b9c04

File tree

42 files changed

+1339
-155
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1339
-155
lines changed

.github/workflows/CICD.yml

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -364,29 +364,15 @@ jobs:
364364
test -h /tmp/usr/local/bin/sha512sum
365365
test -h /tmp/usr/local/bin/shake128sum
366366
test -h /tmp/usr/local/bin/shake256sum
367-
- name: "`make install MULTICALL=y`"
367+
- name: "`make install MULTICALL=y LN=ln -svf`"
368368
shell: bash
369369
run: |
370370
set -x
371-
DESTDIR=/tmp/ make PROFILE=release MULTICALL=y install
372-
# Check that the utils are present
373-
test -f /tmp/usr/local/bin/coreutils
374-
# Check that hashsum symlinks are present
375-
test -h /tmp/usr/local/bin/b2sum
376-
test -h /tmp/usr/local/bin/b3sum
377-
test -h /tmp/usr/local/bin/md5sum
378-
test -h /tmp/usr/local/bin/sha1sum
379-
test -h /tmp/usr/local/bin/sha224sum
380-
test -h /tmp/usr/local/bin/sha256sum
381-
test -h /tmp/usr/local/bin/sha3-224sum
382-
test -h /tmp/usr/local/bin/sha3-256sum
383-
test -h /tmp/usr/local/bin/sha3-384sum
384-
test -h /tmp/usr/local/bin/sha3-512sum
385-
test -h /tmp/usr/local/bin/sha384sum
386-
test -h /tmp/usr/local/bin/sha3sum
387-
test -h /tmp/usr/local/bin/sha512sum
388-
test -h /tmp/usr/local/bin/shake128sum
389-
test -h /tmp/usr/local/bin/shake256sum
371+
DESTDIR=/tmp/ make PROFILE=release MULTICALL=y LN="ln -svf" install
372+
# Check that relative symlinks of hashsum are present
373+
[ $(readlink /tmp/usr/local/bin/b2sum) = coreutils ]
374+
[ $(readlink /tmp/usr/local/bin/md5sum) = coreutils ]
375+
[ $(readlink /tmp/usr/local/bin/sha512sum) = coreutils ]
390376
- name: "`make UTILS=XXX`"
391377
shell: bash
392378
run: |
@@ -483,9 +469,11 @@ jobs:
483469
run: |
484470
## `make install`
485471
make install DESTDIR=target/size-release/
486-
make install MULTICALL=y DESTDIR=target/size-multi-release/
472+
make install MULTICALL=y LN="ln -vf" DESTDIR=target/size-multi-release/
487473
# strip the results
488474
strip target/size*/usr/local/bin/*
475+
- name: Test for hardlinks
476+
run: [ $(stat -c %i target/size-multi-release/usr/local/bin/cp) = $(stat -c %i target/size-multi-release/usr/local/bin/coreutils) ]
489477
- name: Compute uutil release sizes
490478
shell: bash
491479
run: |
@@ -1280,6 +1268,40 @@ jobs:
12801268
- name: Lint with SELinux
12811269
run: lima bash -c "cd work && cargo clippy --all-targets --features 'feat_selinux' -- -D warnings"
12821270

1271+
test_selinux_stubs:
1272+
name: Build/SELinux-Stubs (Non-Linux)
1273+
needs: [ min_version, deps ]
1274+
runs-on: ${{ matrix.job.os }}
1275+
strategy:
1276+
fail-fast: false
1277+
matrix:
1278+
job:
1279+
- { os: macos-latest , features: feat_os_macos }
1280+
- { os: windows-latest , features: feat_os_windows }
1281+
steps:
1282+
- uses: actions/checkout@v5
1283+
with:
1284+
persist-credentials: false
1285+
- uses: dtolnay/rust-toolchain@stable
1286+
- uses: Swatinem/rust-cache@v2
1287+
1288+
- name: Build SELinux utilities as stubs
1289+
run: cargo build -p uu_chcon -p uu_runcon
1290+
1291+
- name: Verify stub binaries exist
1292+
shell: bash
1293+
run: |
1294+
if [ "${{ runner.os }}" = "Windows" ]; then
1295+
test -f target/debug/chcon.exe || exit 1
1296+
test -f target/debug/runcon.exe || exit 1
1297+
else
1298+
test -f target/debug/chcon || exit 1
1299+
test -f target/debug/runcon || exit 1
1300+
fi
1301+
1302+
- name: Verify workspace builds with stubs
1303+
run: cargo build --features ${{ matrix.job.features }}
1304+
12831305
benchmarks:
12841306
name: Run benchmarks (CodSpeed)
12851307
runs-on: ubuntu-latest

.vscode/cspell.dictionaries/workspace.wordlist.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ ENOSYS
128128
ENOTEMPTY
129129
EOPNOTSUPP
130130
EPERM
131+
EPIPE
131132
EROFS
132133

133134
# * vars/fcntl

Cargo.lock

Lines changed: 16 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,12 +600,14 @@ lto = true
600600
[profile.release-fast]
601601
inherits = "release"
602602
panic = "abort"
603+
codegen-units = 1
603604

604605
# A release-like profile that is as small as possible.
605606
[profile.release-small]
606607
inherits = "release"
607608
opt-level = "z"
608609
panic = "abort"
610+
codegen-units = 1
609611
strip = true
610612

611613
# A release-like profile with debug info, useful for profiling.

GNUmakefile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ TOYBOX_SRC := $(TOYBOX_ROOT)/toybox-$(TOYBOX_VER)
6969
#------------------------------------------------------------------------
7070
OS ?= $(shell uname -s)
7171

72+
# Windows does not allow symlink by default.
73+
# Allow to override LN for AppArmor.
74+
ifeq ($(OS),Windows_NT)
75+
LN ?= ln -f
76+
endif
77+
LN ?= ln -sf
78+
7279
ifdef SELINUX_ENABLED
7380
override SELINUX_ENABLED := 0
7481
# Now check if we should enable it (only on non-Windows)
@@ -482,18 +489,18 @@ endif
482489
ifeq (${MULTICALL}, y)
483490
$(INSTALL) -m 755 $(BUILDDIR)/coreutils $(INSTALLDIR_BIN)/$(PROG_PREFIX)coreutils
484491
$(foreach prog, $(filter-out coreutils, $(INSTALLEES)), \
485-
cd $(INSTALLDIR_BIN) && ln -fs $(PROG_PREFIX)coreutils $(PROG_PREFIX)$(prog) $(newline) \
492+
cd $(INSTALLDIR_BIN) && $(LN) $(PROG_PREFIX)coreutils $(PROG_PREFIX)$(prog) $(newline) \
486493
)
487494
$(foreach prog, $(HASHSUM_PROGS), \
488-
cd $(INSTALLDIR_BIN) && ln -fs $(PROG_PREFIX)coreutils $(PROG_PREFIX)$(prog) $(newline) \
495+
cd $(INSTALLDIR_BIN) && $(LN) $(PROG_PREFIX)coreutils $(PROG_PREFIX)$(prog) $(newline) \
489496
)
490-
$(if $(findstring test,$(INSTALLEES)), cd $(INSTALLDIR_BIN) && ln -fs $(PROG_PREFIX)coreutils $(PROG_PREFIX)[)
497+
$(if $(findstring test,$(INSTALLEES)), cd $(INSTALLDIR_BIN) && $(LN) $(PROG_PREFIX)coreutils $(PROG_PREFIX)[)
491498
else
492499
$(foreach prog, $(INSTALLEES), \
493500
$(INSTALL) -m 755 $(BUILDDIR)/$(prog) $(INSTALLDIR_BIN)/$(PROG_PREFIX)$(prog) $(newline) \
494501
)
495502
$(foreach prog, $(HASHSUM_PROGS), \
496-
cd $(INSTALLDIR_BIN) && ln -fs $(PROG_PREFIX)hashsum $(PROG_PREFIX)$(prog) $(newline) \
503+
cd $(INSTALLDIR_BIN) && $(LN) $(PROG_PREFIX)hashsum $(PROG_PREFIX)$(prog) $(newline) \
497504
)
498505
$(if $(findstring test,$(INSTALLEES)), $(INSTALL) -m 755 $(BUILDDIR)/test $(INSTALLDIR_BIN)/$(PROG_PREFIX)[)
499506
endif

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,11 @@ So, to install completions for `ls` on `bash` to
256256
cargo run completion ls bash > /usr/local/share/bash-completion/completions/ls
257257
```
258258

259+
Completion for prefixed `cp` with `uu-` on `zsh` is generated by
260+
```shell
261+
env PROG_PREFIX=uu- cargo run completion cp zsh
262+
```
263+
259264
### Manually install manpages
260265

261266
To generate manpages, the syntax is:

src/uu/base32/locales/en-US.ftl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ basenc-help-base2msbf = bit string with most significant bit (msb) first
4242
basenc-help-z85 = ascii85-like encoding;
4343
when encoding, input length must be a multiple of 4;
4444
when decoding, input length must be a multiple of 5
45+
basenc-help-base58 = visually unambiguous base58 encoding
4546
4647
# Error messages
4748
basenc-error-missing-encoding-type = missing encoding type

src/uu/base32/locales/fr-FR.ftl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ basenc-help-base2msbf = chaîne de bits avec le bit de poids fort (msb) en premi
3737
basenc-help-z85 = encodage de type ascii85 ;
3838
lors de l'encodage, la longueur d'entrée doit être un multiple de 4 ;
3939
lors du décodage, la longueur d'entrée doit être un multiple de 5
40+
basenc-help-base58 = encodage base58 visuellement non ambigu
4041
4142
# Messages d'erreur
4243
basenc-error-missing-encoding-type = type d'encodage manquant

src/uu/base32/src/base_common.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use std::io::{self, ErrorKind, Read, Seek};
1212
use std::path::{Path, PathBuf};
1313
use uucore::display::Quotable;
1414
use uucore::encoding::{
15-
BASE2LSBF, BASE2MSBF, Base64SimdWrapper, EncodingWrapper, Format, SupportsFastDecodeAndEncode,
16-
Z85Wrapper,
15+
BASE2LSBF, BASE2MSBF, Base58Wrapper, Base64SimdWrapper, EncodingWrapper, Format,
16+
SupportsFastDecodeAndEncode, Z85Wrapper,
1717
for_base_common::{BASE32, BASE32HEX, BASE64URL, HEXUPPER_PERMISSIVE},
1818
};
1919
use uucore::error::{FromIo, UResult, USimpleError, UUsageError};
@@ -285,6 +285,7 @@ pub fn get_supports_fast_decode_and_encode(
285285
b"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789=_-",
286286
)),
287287
Format::Z85 => Box::from(Z85Wrapper {}),
288+
Format::Base58 => Box::from(Base58Wrapper {}),
288289
}
289290
}
290291

src/uu/basenc/src/basenc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ fn get_encodings() -> Vec<(&'static str, Format, String)> {
3939
translate!("basenc-help-base2msbf"),
4040
),
4141
("z85", Format::Z85, translate!("basenc-help-z85")),
42+
("base58", Format::Base58, translate!("basenc-help-base58")),
4243
]
4344
}
4445

0 commit comments

Comments
 (0)