Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/GnuComment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ jobs:
issue_number: issue_number,
body: 'GNU testsuite comparison:\n```\n' + content + '```'
});
}
}
1 change: 0 additions & 1 deletion .markdownlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ MD013: false
# Disable 'Fenced code blocks should have a language specified'
# Doesn't provide much in src/ to enforce it
MD040: false

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ cargo build --release --features windows
cargo build --release --features unix
```

To build SELinux-specific features, including `chcon` and `runcon`, ensure that `libselinux`
To build SELinux-specific features, including `chcon` and `runcon`, ensure that `libselinux`
and `libclang` are installed on your system. Then, run the following command:
```
cargo build --release --features unix,feat_selinux
Expand Down
1 change: 0 additions & 1 deletion README.package.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,3 @@ uutils coreutils is a cross-platform reimplementation of the GNU coreutils in
[Rust](http://www.rust-lang.org).

This package does not have its specific `README.md`.

2 changes: 1 addition & 1 deletion docs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ book
src/utils
src/SUMMARY.md
src/platform_table.md
tldr.zip
tldr.zip
Empty file modified docs/compiles_table.py
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion docs/src/test_coverage.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@
}
.counts {
margin-right: 10px;
}
}
1 change: 0 additions & 1 deletion src/uu/dirname/locales/fr-FR.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ dirname-after-help = Afficher chaque NOM avec son dernier composant non-slash et
supprimés ; si NOM ne contient pas de '/', afficher '.' (signifiant le répertoire courant).
dirname-missing-operand = opérande manquant
dirname-zero-help = séparer la sortie avec NUL plutôt qu'avec un saut de ligne

1 change: 0 additions & 1 deletion src/uu/rm/BENCHMARKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,3 @@ With Cargo Flamegraph you can easily make a flamegraph of `rm`:
```shell
cargo flamegraph --cmd coreutils -- rm [additional parameters]
```

1 change: 0 additions & 1 deletion src/uu/sleep/locales/fr-FR.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ sleep-error-missing-operand = opérande manquant

# Messages d'aide
sleep-help-number = faire une pause de NOMBRE secondes

1 change: 0 additions & 1 deletion src/uu/tr/BENCHMARKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,3 @@ hyperfine 'tr -d aeiou < mixed_input > /dev/null' './target/release/tr -d aeiou
- Uses lookup tables instead of hash maps for O(1) operations
- 32KB I/O buffers for improved throughput
- Should be competitive with GNU `tr` for most operations

20 changes: 10 additions & 10 deletions src/uu/tsort/BENCHMARKING.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Benchmarking `tsort`
<!-- spell-checker:ignore (words) randint tsort DAG uu_tsort GNU -->
Much of what makes `tsort` fast is the efficiency of its algorithm and implementation for topological sorting.
Our implementation of `tsort` also outputs a cycle whenever such ordering does not exist, just like GNU `tsort`.
Much of what makes `tsort` fast is the efficiency of its algorithm and implementation for topological sorting.
Our implementation of `tsort` also outputs a cycle whenever such ordering does not exist, just like GNU `tsort`.

## Strategies

To test `tsort`'s performance for its nominal use case, we need to test it with a DAG. One of the worst cases is when all nodes are just representing a succession of independent steps.
We should also test cycle detection for good measure.
To test `tsort`'s performance for its nominal use case, we need to test it with a DAG. One of the worst cases is when all nodes are just representing a succession of independent steps.
We should also test cycle detection for good measure.

### Random acyclic graph (DAG)

Expand All @@ -25,16 +25,16 @@ for i in range(100*N):

### Random graph with cycles

The following will output a graph with multiples edges, it also allows some degree of tuning to test different cases.
The following will output a graph with multiples edges, it also allows some degree of tuning to test different cases.

```python
import random

# Parameters for the graph
num_nodes = 100
num_edges = 150
cycle_percentage = 0.10
max_cycle_size = 6
num_nodes = 100
num_edges = 150
cycle_percentage = 0.10
max_cycle_size = 6

num_cycles = int(num_edges * cycle_percentage)

Expand All @@ -52,7 +52,7 @@ for _ in range(num_cycles):
```

## Running Benchmarks
The above scripts will output the generated graphs to the standard output. They can therefore be used directly as tests. In order to run a Benchmark, the output should be redirected to a file.
The above scripts will output the generated graphs to the standard output. They can therefore be used directly as tests. In order to run a Benchmark, the output should be redirected to a file.
Use [`hyperfine`](https://github.com/sharkdp/hyperfine) to compare the performance of different `tsort` versions. For example, you can compare the performance of GNU `tsort` and another implementation with the following command:

```sh
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/.gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* -text diff
* -text diff
Empty file modified util/analyze-gnu-results.py
100644 → 100755
Empty file.
Empty file modified util/android-scripts/collect-info.sh
100644 → 100755
Empty file.
Empty file modified util/android-scripts/run-tests.sh
100644 → 100755
Empty file.
Empty file modified util/compare_test_results.py
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion util/deps.nu
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export def all_dep_info [] {
let features = [unix, feat_selinux]

let lock = open Cargo.lock | from toml | get package

$lock
# Add number of versions
| join ($lock | group-by name | transpose | update column1 { length } | rename name num_versions) name
Expand Down
Empty file modified util/dwr.sh
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions util/gnu-patches/tests_cksum_base64.patch
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ Index: gnu/tests/cksum/cksum-base64.pl
+++ gnu/tests/cksum/cksum-base64.pl
@@ -92,8 +92,8 @@ my $prog = 'cksum';
my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose);

# Ensure hash names from cksum --help match those in @pairs above.
-my $help_algs = join ' ', map { m{^ ([[:alpha:]]\S+)} }
- grep { m{^ ([[:alpha:]]\S+)} } split ('\n', `cksum --help`);
+my $help_algs = join ' ', map { m{^\s*-\s*([[:alpha:]]\S+):} ? $1 : () }
+ grep { m{^\s*-\s*([[:alpha:]]\S+):} } split ('\n', `cksum --help`);
my $test_algs = join ' ', map {$_->[0]} @pairs;
$help_algs eq $test_algs or die "$help_algs not equal to\n$test_algs";

14 changes: 7 additions & 7 deletions util/gnu-patches/tests_cut_error_msg.patch
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Index: gnu/tests/cut/cut.pl
--- gnu.orig/tests/cut/cut.pl
+++ gnu/tests/cut/cut.pl
@@ -29,13 +29,15 @@ my $mb_locale = $ENV{LOCALE_FR_UTF8};

my $prog = 'cut';
my $try = "Try '$prog --help' for more information.\n";
-my $from_field1 = "$prog: fields are numbered from 1\n$try";
Expand All @@ -22,29 +22,29 @@ Index: gnu/tests/cut/cut.pl
+my $inval_pos = "$prog: range '--' was invalid: failed to parse range\n";
+my $no_endpoint = "$prog: range '-' was invalid: invalid range with no endpoint\n";
+my $nofield = "$prog: invalid input: The '--delimiter' ('-d') option only usable if printing a sequence of fields\n";

my @Tests =
(
@@ -44,16 +46,16 @@ my @Tests =

# This failed (as it should) even before coreutils-6.9.90,
# but cut from 6.9.90 produces a more useful diagnostic.
- ['zero-1', '-b0', {ERR=>$from_pos1}, {EXIT => 1} ],
+ ['zero-1', '-b0', {ERR=>$from_field_0}, {EXIT => 1} ],

# Up to coreutils-6.9, specifying a range of 0-2 was not an error.
# It was treated just like "-2".
- ['zero-2', '-f0-2', {ERR=>$from_field1}, {EXIT => 1} ],
+ ['zero-2', '-f0-2', {ERR=>$from_field_0_2}, {EXIT => 1} ],

# Up to coreutils-8.20, specifying a range of 0- was not an error.
- ['zero-3b', '-b0-', {ERR=>$from_pos1}, {EXIT => 1} ],
- ['zero-3c', '-c0-', {ERR=>$from_pos1}, {EXIT => 1} ],
- ['zero-3f', '-f0-', {ERR=>$from_field1}, {EXIT => 1} ],
+ ['zero-3b', '-b0-', {ERR=>$from_field_0_dash}, {EXIT => 1} ],
+ ['zero-3c', '-c0-', {ERR=>$from_field_0_dash}, {EXIT => 1} ],
+ ['zero-3f', '-f0-', {ERR=>$from_field_0_dash}, {EXIT => 1} ],

['1', '-d:', '-f1,3-', {IN=>"a:b:c\n"}, {OUT=>"a:c\n"}],
['2', '-d:', '-f1,3-', {IN=>"a:b:c\n"}, {OUT=>"a:c\n"}],
@@ -96,11 +98,10 @@ my @Tests =
Expand All @@ -62,7 +62,7 @@ Index: gnu/tests/cut/cut.pl
# Empty field list
['empty-fl', qw(-f ''), {IN=>":\n"}, {OUT=>""}, {EXIT=>1},
@@ -199,7 +200,7 @@ my @Tests =

# None of the following invalid ranges provoked an error up to coreutils-6.9.
['inval1', qw(-f 2-0), {IN=>''}, {OUT=>''}, {EXIT=>1},
- {ERR=>"$prog: invalid decreasing range\n$try"}],
Expand Down
4 changes: 2 additions & 2 deletions util/gnu-patches/tests_du_move_dir_while_traversing.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ Index: gnu/tests/du/move-dir-while-traversing.sh
@@ -91,9 +91,7 @@ retry_delay_ nonempty .1 5 || fail=1
# Before coreutils-8.10, du would abort.
returns_ 1 du -a $t d2 2> err || fail=1

-# check for the new diagnostic
-printf "du: fts_read failed: $t/3/a/b: No such file or directory\n" > exp \
- || fail=1
-compare exp err || fail=1
+# check that it doesn't crash
+grep -Pq "^du: cannot read directory '$t/3/a/b.*': No such file or directory" err || fail=1

Exit $fail
6 changes: 3 additions & 3 deletions util/gnu-patches/tests_invalid_opt.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Index: gnu/tests/misc/invalid-opt.pl
@@ -74,23 +74,13 @@ foreach my $prog (@built_programs)
defined $out
or $out = '';

- my $err = $expected_err{$prog};
- defined $err
- or $err = $x == 0 ? '' : "$prog: invalid option -- /\n$try";
Expand All @@ -22,11 +22,11 @@ Index: gnu/tests/misc/invalid-opt.pl
+ # Strip all stderr output
+ # Our output is better and more consistent
+ my $err_subst = 's/(.|\n)*//ms';

my @Tests = (["$prog-invalid-opt", '-/', {OUT=>$out},
{ERR_SUBST => $err_subst},
- {EXIT=>$x}, {ERR=>$err}]);
+ {EXIT=>$x}]);

my $save_temps = $ENV{DEBUG};
my $verbose = $ENV{VERBOSE};
6 changes: 3 additions & 3 deletions util/gnu-patches/tests_ls_no_cap.patch
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ index 99f0563bc..f7b9e7885 100755
+++ b/tests/ls/no-cap.sh
@@ -27,11 +27,11 @@ setcap 'cap_net_bind_service=ep' file ||
skip_ "setcap doesn't work"

LS_COLORS=ca=1; export LS_COLORS
-strace -e capget ls --color=always > /dev/null 2> out || fail=1
-$EGREP 'capget\(' out || skip_ "your ls doesn't call capget"
+strace -e listxattr ls --color=always > /dev/null 2> out || fail=1
+$EGREP 'listxattr\(' out || skip_ "your ls doesn't call listxattr"

LS_COLORS=ca=:; export LS_COLORS
-strace -e capget ls --color=always > /dev/null 2> out || fail=1
-$EGREP 'capget\(' out && fail=1
+strace -e listxattr ls --color=always > /dev/null 2> out || fail=1
+$EGREP 'listxattr\(' out && fail=1

Exit $fail
10 changes: 5 additions & 5 deletions util/gnu-patches/tests_sort_merge.pl.patch
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ Index: gnu/tests/sort/sort-merge.pl
{ERR=>"$prog: invalid --batch-size argument '0'\n".
- "$prog: minimum --batch-size argument is '2'\n"}, {EXIT=>2}],
+ "$prog: minimum --batch-size argument is '2'\nTry 'sort --help' for more information.\n"}, {EXIT=>2}],

['nmerge-1', "-m --batch-size=1", @inputs,
{ERR=>"$prog: invalid --batch-size argument '1'\n".
- "$prog: minimum --batch-size argument is '2'\n"}, {EXIT=>2}],
+ "$prog: minimum --batch-size argument is '2'\nTry 'sort --help' for more information.\n"}, {EXIT=>2}],

['nmerge-neg', "-m --batch-size=-1", @inputs,
- {ERR=>"$prog: invalid --batch-size argument '-1'\n"}, {EXIT=>2}],
+ {ERR=>"$prog: invalid --batch-size argument '-1'\nTry 'sort --help' for more information.\n"}, {EXIT=>2}],

['nmerge-nan', "-m --batch-size=a", @inputs,
- {ERR=>"$prog: invalid --batch-size argument 'a'\n"}, {EXIT=>2}],
+ {ERR=>"$prog: invalid --batch-size argument 'a'\nTry 'sort --help' for more information.\n"}, {EXIT=>2}],

['nmerge-big', "-m --batch-size=$bigint", @inputs,
{ERR_SUBST=>'s/(current rlimit is) \d+/$1/'},
{ERR=>"$prog: --batch-size argument '$bigint' too large\n".
- "$prog: maximum --batch-size argument with current rlimit is\n"},
+ "$prog: maximum --batch-size argument with current rlimit is\nTry 'sort --help' for more information.\n"},
{EXIT=>2}],

# This should work since nmerge >= the number of input files
64 changes: 32 additions & 32 deletions util/show-utils.BAT
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
@setLocal
@echo off
@rem ::# spell-checker:ignore (CMD) ERRORLEVEL
@rem ::# spell-checker:ignore (utils) cksum coreutils dircolors hashsum mkdir mktemp printenv printf readlink realpath rmdir shuf tsort unexpand
@rem ::# spell-checker:ignore (jq) deps startswith
set "ME=%~0"
set "ME_dir=%~dp0."
set "ME_parent_dir=%~dp0.\.."
@rem refs: <https://forge.rust-lang.org/release/platform-support.html> , <https://docs.rs/platforms/0.2.1/platforms/platform/tier1/index.html>
@rem :: default ("Tier 1" cross-platform) utility list
set "default_utils=base32 base64 basename cat cksum comm cp cut date dircolors dirname echo env expand expr factor false fmt fold hashsum head join link ln ls mkdir mktemp more mv nl od paste printenv printf ptx pwd readlink realpath rm rmdir seq shred shuf sleep sort split sum tac tail tee test tr true truncate tsort unexpand uniq wc yes"
set "project_dir=%ME_parent_dir%"
cd "%project_dir%"
@:: `jq` available?
set "JQ="
set "ERRORLEVEL="
jq --version 1>NUL 2>&1
if NOT ERRORLEVEL 1 ( set "JQ=jq" )
if NOT DEFINED JQ (
echo WARN: missing `jq` ^(install with `scoop install jq`^)^; falling back to default ^(only fully cross-platform^) util list 1>&2
echo %default_utils%
) else (
cargo metadata %* --format-version 1 | jq -r "[.resolve.nodes[] | { id: .id, deps: [.deps[] | { name:.name, pkg:.pkg }] }] | .[] | select(.id|startswith(\"coreutils\")) | [.deps[] | select((.name|startswith(\"uu_\")) or (.pkg|startswith(\"uu_\")))] | [.[].pkg | match(\"^^\\w+\";\"g\")] | [.[].string | sub(\"^uu_\"; \"\")] | sort | join(\" \")"
REM cargo metadata %* --format-version 1 | jq -r "[.resolve.nodes[] | { id: .id, deps: [.deps[] | { name:.name, pkg:.pkg }] }] | .[] | select(.id|startswith(\"coreutils\")) | [.deps[] | select((.name|startswith(\"uu_\")) or (.pkg|startswith(\"uu_\")))] | [.[].pkg | match(\"^^\\w+\";\"g\")] | [.[].string] | sort | join(\" \")"
)
@setLocal
@echo off

@rem ::# spell-checker:ignore (CMD) ERRORLEVEL
@rem ::# spell-checker:ignore (utils) cksum coreutils dircolors hashsum mkdir mktemp printenv printf readlink realpath rmdir shuf tsort unexpand
@rem ::# spell-checker:ignore (jq) deps startswith

set "ME=%~0"
set "ME_dir=%~dp0."
set "ME_parent_dir=%~dp0.\.."

@rem refs: <https://forge.rust-lang.org/release/platform-support.html> , <https://docs.rs/platforms/0.2.1/platforms/platform/tier1/index.html>

@rem :: default ("Tier 1" cross-platform) utility list
set "default_utils=base32 base64 basename cat cksum comm cp cut date dircolors dirname echo env expand expr factor false fmt fold hashsum head join link ln ls mkdir mktemp more mv nl od paste printenv printf ptx pwd readlink realpath rm rmdir seq shred shuf sleep sort split sum tac tail tee test tr true truncate tsort unexpand uniq wc yes"

set "project_dir=%ME_parent_dir%"
cd "%project_dir%"

@:: `jq` available?
set "JQ="
set "ERRORLEVEL="
jq --version 1>NUL 2>&1
if NOT ERRORLEVEL 1 ( set "JQ=jq" )

if NOT DEFINED JQ (
echo WARN: missing `jq` ^(install with `scoop install jq`^)^; falling back to default ^(only fully cross-platform^) util list 1>&2
echo %default_utils%
) else (
cargo metadata %* --format-version 1 | jq -r "[.resolve.nodes[] | { id: .id, deps: [.deps[] | { name:.name, pkg:.pkg }] }] | .[] | select(.id|startswith(\"coreutils\")) | [.deps[] | select((.name|startswith(\"uu_\")) or (.pkg|startswith(\"uu_\")))] | [.[].pkg | match(\"^^\\w+\";\"g\")] | [.[].string | sub(\"^uu_\"; \"\")] | sort | join(\" \")"
REM cargo metadata %* --format-version 1 | jq -r "[.resolve.nodes[] | { id: .id, deps: [.deps[] | { name:.name, pkg:.pkg }] }] | .[] | select(.id|startswith(\"coreutils\")) | [.deps[] | select((.name|startswith(\"uu_\")) or (.pkg|startswith(\"uu_\")))] | [.[].pkg | match(\"^^\\w+\";\"g\")] | [.[].string] | sort | join(\" \")"
)
Empty file modified util/size-experiment.py
100644 → 100755
Empty file.
Loading
Loading