coreutils/src/uu
Jalil David Salamé Messina 3c47f27698 tr: calculate complement set early
Fixes #6163 and adds a test to verify that a regression is not caused.

Instead of inverting the conditions to check (e.g. delete characters **not** present in set1) invert
set1 when passed the complement flag (`-c`, `-C`, `--complement`). This is done by calculating set1
then "inverting" it by subtracting from the "full" (universe) set (0..=u8::MAX).

This fixes issue 6163 because it was caused by a combination of the `-c` and `-t` flag. `-c` is the
abovementioned complement flag and `-t`/`--truncate-set1` truncates set1 to the length of set2. What
happened in issue 6163 is that `set1={b'Y'}` and `set2={b'Z'}`, when truncated set1 stays the same
and we proceed. The problem is GNU utils does not consider set1 to be `{b'Y'}`, but the complement
of `{b'Y'}`, that is `U \ {b'Y'}={0, 1, ..., b'X', b'Z', ...}`, thus it is truncated to `{0}`.

We can verify this by doing: `printf '\0' | tr -c -t Y Z`, which prints `Z` to stdout as expected.

Additionally, by calculating the complement of set1 we no longer need to consider the complement
flag when doing the translate operation, this allows us to delete a lot of code.
2024-05-04 19:55:49 +02:00
..
arch Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
base32 Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
base64 Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
basename Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
basenc Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
cat Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
chcon Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
chgrp Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
chmod Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
chown Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
chroot Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
cksum cksum: fix code formatting 2024-04-05 07:14:37 +02:00
comm Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
cp clippy: fix warnings introduced with Rust 1.78 2024-05-02 16:47:44 +02:00
csplit clippy: fix warnings introduced with Rust 1.78 2024-05-02 16:47:44 +02:00
cut Fix clippy warning match_bool 2024-04-03 09:28:22 +02:00
date date: support -f - to read from stdin 2024-03-31 22:05:47 +02:00
dd Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
df clippy: fix warnings introduced with Rust 1.78 2024-05-02 16:47:44 +02:00
dir Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
dircolors Merge pull request #6131 from sylvestre/0.0.26 2024-03-31 12:47:55 +02:00
dirname Merge pull request #6131 from sylvestre/0.0.26 2024-03-31 12:47:55 +02:00
du du: give -h output the same precision as GNU coreutils 2024-04-24 16:53:08 +02:00
echo Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
env clippy: fix warnings introduced with Rust 1.78 2024-05-02 16:47:44 +02:00
expand Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
expr Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
factor clippy: fix warnings introduced with Rust 1.78 2024-05-02 16:47:44 +02:00
false Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
fmt Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
fold Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
groups Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
hashsum clippy: fix warnings introduced with Rust 1.78 2024-05-02 16:47:44 +02:00
head Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
hostid hostid: return correct exit code on error 2024-04-14 15:42:13 +02:00
hostname Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
id id: mark passwd-format and pretty-print as conflicting 2024-04-28 23:05:43 +02:00
install Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
join Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
kill clippy: fix warnings introduced with Rust 1.78 2024-05-02 16:47:44 +02:00
link Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
ln Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
logname Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
ls ls: upgrade uutils-term-grid to 0.5 (#5485) 2024-05-01 10:16:15 +02:00
mkdir Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
mkfifo Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
mknod Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
mktemp Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
more more: use dev tty instead of mio to avoid panics (#6262) 2024-04-23 16:48:21 +02:00
mv mv: avoid attempting to set xattr on redox 2024-04-12 06:16:48 +02:00
nice Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
nl clippy: fix warnings introduced with Rust 1.78 2024-05-02 16:47:44 +02:00
nohup Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
nproc Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
numfmt numfmt: accept shortcuts for stringly-enum arguments 2024-04-14 15:39:46 +02:00
od od: remove print_width_block field of OutputInfo 2024-04-15 15:16:21 +02:00
paste Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
pathchk Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
pinky Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
pr pr: return correct exit code on error 2024-04-14 15:42:13 +02:00
printenv Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
printf Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
ptx clippy: fix warnings introduced with Rust 1.78 2024-05-02 16:47:44 +02:00
pwd Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
readlink Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
realpath Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
rm Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
rmdir Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
runcon Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
seq seq: fuzz PreciseNumber::from_str (#6183) 2024-04-15 08:07:06 +02:00
shred shred: accept shortcuts for stringly-enum arguments 2024-04-14 15:39:46 +02:00
shuf Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
sleep Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
sort sort: disable clippy::suspicious_open_options on OpenBSD 2024-04-30 10:05:28 +02:00
split Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
stat Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
stdbuf fix(deps): update rust crate cpp to 0.5.9 2024-05-02 09:48:51 +00:00
stty Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
sum Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
sync Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
tac Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
tail clippy: fix warnings introduced with Rust 1.78 2024-05-02 16:47:44 +02:00
tee Merge pull request #6162 from BenWiederhake/dev-undo-custom-exit-codes 2024-04-25 08:11:41 +02:00
test Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
timeout Fix clippy warning match_bool 2024-04-03 09:28:22 +02:00
touch touch: accept shortcuts for stringly-enum arguments 2024-04-14 15:39:46 +02:00
tr tr: calculate complement set early 2024-05-04 19:55:49 +02:00
true Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
truncate Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
tsort Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
tty Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
uname Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
unexpand Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
uniq uniq: accept shortcuts for stringly-enum arguments 2024-04-14 15:39:46 +02:00
unlink Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
uptime Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
users Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
vdir Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
wc wc: accept shortcuts for stringly-enum arguments 2024-04-14 15:39:47 +02:00
who Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
whoami Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00
yes Try to release 0.0.26 to see if the artifacts are generated 2024-03-30 22:51:24 +01:00