diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 20945609230..ad12ede6833 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -137,7 +137,7 @@ jobs: shell: bash run: | RUSTDOCFLAGS="-Dwarnings" cargo doc ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} --no-deps --workspace --document-private-items - - uses: DavidAnson/markdownlint-cli2-action@v14 + - uses: DavidAnson/markdownlint-cli2-action@v15 with: fix: "true" globs: | @@ -1012,16 +1012,8 @@ jobs: UTILITY_LIST="$(./util/show-utils.sh ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }})" CARGO_UTILITY_LIST_OPTIONS="$(for u in ${UTILITY_LIST}; do echo -n "-puu_${u} "; done;)" outputs CARGO_UTILITY_LIST_OPTIONS - - name: Test uucore - run: cargo nextest run --profile ci --hide-progress-bar -p uucore - env: - RUSTC_WRAPPER: "" - RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" - RUSTDOCFLAGS: "-Cpanic=abort" - RUST_BACKTRACE: "1" - # RUSTUP_TOOLCHAIN: ${{ steps.vars.outputs.TOOLCHAIN }} - name: Test - run: cargo nextest run --profile ci --hide-progress-bar ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} + run: cargo nextest run --profile ci --hide-progress-bar ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} -p uucore -p coreutils env: RUSTC_WRAPPER: "" RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 34dcf910d18..86b5a89e83a 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -33,7 +33,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Restore AVD cache - uses: actions/cache/restore@v3 + uses: actions/cache/restore@v4 id: avd-cache with: path: | @@ -57,7 +57,7 @@ jobs: util/android-commands.sh init "${{ matrix.arch }}" "${{ matrix.api-level }}" "${{ env.TERMUX }}" - name: Save AVD cache if: steps.avd-cache.outputs.cache-hit != 'true' - uses: actions/cache/save@v3 + uses: actions/cache/save@v4 with: path: | ~/.android/avd/* @@ -73,7 +73,7 @@ jobs: trim: true - name: Restore rust cache id: rust-cache - uses: actions/cache/restore@v3 + uses: actions/cache/restore@v4 with: path: ~/__rust_cache__ # The version vX at the end of the key is just a development version to avoid conflicts in @@ -99,7 +99,7 @@ jobs: if [[ "${{ steps.rust-cache.outputs.cache-hit }}" != 'true' ]]; then util/android-commands.sh sync_image; fi; exit 0 - name: Save rust cache if: steps.rust-cache.outputs.cache-hit != 'true' - uses: actions/cache/save@v3 + uses: actions/cache/save@v4 with: path: ~/__rust_cache__ key: ${{ matrix.arch }}_${{ matrix.target}}_${{ steps.read_rustc_hash.outputs.content }}_${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}_v3 diff --git a/.github/workflows/fuzzing.yml b/.github/workflows/fuzzing.yml index b96f7e4ef22..c60c01ff4be 100644 --- a/.github/workflows/fuzzing.yml +++ b/.github/workflows/fuzzing.yml @@ -66,7 +66,7 @@ jobs: shared-key: "cargo-fuzz-cache-key" cache-directories: "fuzz/target" - name: Restore Cached Corpus - uses: actions/cache/restore@v3 + uses: actions/cache/restore@v4 with: key: corpus-cache-${{ matrix.test-target.name }} path: | @@ -77,7 +77,7 @@ jobs: run: | cargo +nightly fuzz run ${{ matrix.test-target.name }} -- -max_total_time=${{ env.RUN_FOR }} -detect_leaks=0 - name: Save Corpus Cache - uses: actions/cache/save@v3 + uses: actions/cache/save@v4 with: key: corpus-cache-${{ matrix.test-target.name }} path: | diff --git a/.vscode/cspell.dictionaries/jargon.wordlist.txt b/.vscode/cspell.dictionaries/jargon.wordlist.txt index dca883dc804..20e26990f3b 100644 --- a/.vscode/cspell.dictionaries/jargon.wordlist.txt +++ b/.vscode/cspell.dictionaries/jargon.wordlist.txt @@ -42,6 +42,7 @@ fileio filesystem filesystems flamegraph +fsxattr fullblock getfacl gibi @@ -133,6 +134,7 @@ urand whitespace wordlist wordlists +xattrs # * abbreviations consts diff --git a/Cargo.lock b/Cargo.lock index 616fec68ded..450eef05271 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -374,7 +374,7 @@ checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] name = "coreutils" -version = "0.0.23" +version = "0.0.24" dependencies = [ "chrono", "clap", @@ -1705,9 +1705,9 @@ checksum = "f1bfbf25d7eb88ddcbb1ec3d755d0634da8f7657b2cb8b74089121409ab8228f" [[package]] name = "regex" -version = "1.10.2" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", @@ -1717,9 +1717,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "3b7fa1134405e2ec9353fd416b17f8dacd46c473d7d3fd1cf202706a14eb792a" dependencies = [ "aho-corasick", "memchr", @@ -2001,9 +2001,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2593d31f82ead8df961d8bd23a64c2ccf2eb5dd34b0a34bfb4dd54011c72009e" +checksum = "3b187f0231d56fe41bfb12034819dd2bf336422a5866de41bc3fec4b2e3883e8" [[package]] name = "smawk" @@ -2208,7 +2208,7 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "uu_arch" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "platform-info", @@ -2217,7 +2217,7 @@ dependencies = [ [[package]] name = "uu_base32" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2225,7 +2225,7 @@ dependencies = [ [[package]] name = "uu_base64" -version = "0.0.23" +version = "0.0.24" dependencies = [ "uu_base32", "uucore", @@ -2233,7 +2233,7 @@ dependencies = [ [[package]] name = "uu_basename" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2241,7 +2241,7 @@ dependencies = [ [[package]] name = "uu_basenc" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uu_base32", @@ -2250,7 +2250,7 @@ dependencies = [ [[package]] name = "uu_cat" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "nix", @@ -2260,7 +2260,7 @@ dependencies = [ [[package]] name = "uu_chcon" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "fts-sys", @@ -2272,7 +2272,7 @@ dependencies = [ [[package]] name = "uu_chgrp" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2280,7 +2280,7 @@ dependencies = [ [[package]] name = "uu_chmod" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "libc", @@ -2289,7 +2289,7 @@ dependencies = [ [[package]] name = "uu_chown" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2297,7 +2297,7 @@ dependencies = [ [[package]] name = "uu_chroot" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2305,7 +2305,7 @@ dependencies = [ [[package]] name = "uu_cksum" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "hex", @@ -2314,7 +2314,7 @@ dependencies = [ [[package]] name = "uu_comm" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2322,7 +2322,7 @@ dependencies = [ [[package]] name = "uu_cp" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "exacl", @@ -2338,7 +2338,7 @@ dependencies = [ [[package]] name = "uu_csplit" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "regex", @@ -2348,7 +2348,7 @@ dependencies = [ [[package]] name = "uu_cut" -version = "0.0.23" +version = "0.0.24" dependencies = [ "bstr", "clap", @@ -2358,7 +2358,7 @@ dependencies = [ [[package]] name = "uu_date" -version = "0.0.23" +version = "0.0.24" dependencies = [ "chrono", "clap", @@ -2370,7 +2370,7 @@ dependencies = [ [[package]] name = "uu_dd" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "gcd", @@ -2382,7 +2382,7 @@ dependencies = [ [[package]] name = "uu_df" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "tempfile", @@ -2392,7 +2392,7 @@ dependencies = [ [[package]] name = "uu_dir" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uu_ls", @@ -2401,7 +2401,7 @@ dependencies = [ [[package]] name = "uu_dircolors" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2409,7 +2409,7 @@ dependencies = [ [[package]] name = "uu_dirname" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2417,7 +2417,7 @@ dependencies = [ [[package]] name = "uu_du" -version = "0.0.23" +version = "0.0.24" dependencies = [ "chrono", "clap", @@ -2428,7 +2428,7 @@ dependencies = [ [[package]] name = "uu_echo" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2436,7 +2436,7 @@ dependencies = [ [[package]] name = "uu_env" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "memchr", @@ -2448,7 +2448,7 @@ dependencies = [ [[package]] name = "uu_expand" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "unicode-width", @@ -2457,7 +2457,7 @@ dependencies = [ [[package]] name = "uu_expr" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "num-bigint", @@ -2468,7 +2468,7 @@ dependencies = [ [[package]] name = "uu_factor" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "coz", @@ -2481,7 +2481,7 @@ dependencies = [ [[package]] name = "uu_false" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2489,7 +2489,7 @@ dependencies = [ [[package]] name = "uu_fmt" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "unicode-width", @@ -2498,7 +2498,7 @@ dependencies = [ [[package]] name = "uu_fold" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2506,7 +2506,7 @@ dependencies = [ [[package]] name = "uu_groups" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2514,7 +2514,7 @@ dependencies = [ [[package]] name = "uu_hashsum" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "hex", @@ -2525,7 +2525,7 @@ dependencies = [ [[package]] name = "uu_head" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "memchr", @@ -2534,7 +2534,7 @@ dependencies = [ [[package]] name = "uu_hostid" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "libc", @@ -2543,7 +2543,7 @@ dependencies = [ [[package]] name = "uu_hostname" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "hostname", @@ -2553,7 +2553,7 @@ dependencies = [ [[package]] name = "uu_id" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "selinux", @@ -2562,7 +2562,7 @@ dependencies = [ [[package]] name = "uu_install" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "file_diff", @@ -2573,7 +2573,7 @@ dependencies = [ [[package]] name = "uu_join" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "memchr", @@ -2582,7 +2582,7 @@ dependencies = [ [[package]] name = "uu_kill" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "nix", @@ -2591,7 +2591,7 @@ dependencies = [ [[package]] name = "uu_link" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2599,7 +2599,7 @@ dependencies = [ [[package]] name = "uu_ln" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2607,7 +2607,7 @@ dependencies = [ [[package]] name = "uu_logname" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "libc", @@ -2616,7 +2616,7 @@ dependencies = [ [[package]] name = "uu_ls" -version = "0.0.23" +version = "0.0.24" dependencies = [ "chrono", "clap", @@ -2630,12 +2630,11 @@ dependencies = [ "unicode-width", "uucore", "uutils_term_grid", - "xattr", ] [[package]] name = "uu_mkdir" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2643,7 +2642,7 @@ dependencies = [ [[package]] name = "uu_mkfifo" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "libc", @@ -2652,7 +2651,7 @@ dependencies = [ [[package]] name = "uu_mknod" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "libc", @@ -2661,7 +2660,7 @@ dependencies = [ [[package]] name = "uu_mktemp" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "rand", @@ -2671,7 +2670,7 @@ dependencies = [ [[package]] name = "uu_more" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "crossterm", @@ -2683,7 +2682,7 @@ dependencies = [ [[package]] name = "uu_mv" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "fs_extra", @@ -2693,7 +2692,7 @@ dependencies = [ [[package]] name = "uu_nice" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "libc", @@ -2703,7 +2702,7 @@ dependencies = [ [[package]] name = "uu_nl" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "regex", @@ -2712,7 +2711,7 @@ dependencies = [ [[package]] name = "uu_nohup" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "libc", @@ -2721,7 +2720,7 @@ dependencies = [ [[package]] name = "uu_nproc" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "libc", @@ -2730,7 +2729,7 @@ dependencies = [ [[package]] name = "uu_numfmt" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2738,7 +2737,7 @@ dependencies = [ [[package]] name = "uu_od" -version = "0.0.23" +version = "0.0.24" dependencies = [ "byteorder", "clap", @@ -2748,7 +2747,7 @@ dependencies = [ [[package]] name = "uu_paste" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2756,7 +2755,7 @@ dependencies = [ [[package]] name = "uu_pathchk" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "libc", @@ -2765,7 +2764,7 @@ dependencies = [ [[package]] name = "uu_pinky" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2773,7 +2772,7 @@ dependencies = [ [[package]] name = "uu_pr" -version = "0.0.23" +version = "0.0.24" dependencies = [ "chrono", "clap", @@ -2785,7 +2784,7 @@ dependencies = [ [[package]] name = "uu_printenv" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2793,7 +2792,7 @@ dependencies = [ [[package]] name = "uu_printf" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2801,7 +2800,7 @@ dependencies = [ [[package]] name = "uu_ptx" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "regex", @@ -2810,7 +2809,7 @@ dependencies = [ [[package]] name = "uu_pwd" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2818,7 +2817,7 @@ dependencies = [ [[package]] name = "uu_readlink" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2826,7 +2825,7 @@ dependencies = [ [[package]] name = "uu_realpath" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2834,7 +2833,7 @@ dependencies = [ [[package]] name = "uu_rm" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "libc", @@ -2845,7 +2844,7 @@ dependencies = [ [[package]] name = "uu_rmdir" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "libc", @@ -2854,7 +2853,7 @@ dependencies = [ [[package]] name = "uu_runcon" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "libc", @@ -2865,7 +2864,7 @@ dependencies = [ [[package]] name = "uu_seq" -version = "0.0.23" +version = "0.0.24" dependencies = [ "bigdecimal", "clap", @@ -2876,7 +2875,7 @@ dependencies = [ [[package]] name = "uu_shred" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "libc", @@ -2886,7 +2885,7 @@ dependencies = [ [[package]] name = "uu_shuf" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "memchr", @@ -2897,7 +2896,7 @@ dependencies = [ [[package]] name = "uu_sleep" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "fundu", @@ -2906,7 +2905,7 @@ dependencies = [ [[package]] name = "uu_sort" -version = "0.0.23" +version = "0.0.24" dependencies = [ "binary-heap-plus", "clap", @@ -2925,7 +2924,7 @@ dependencies = [ [[package]] name = "uu_split" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "memchr", @@ -2934,7 +2933,7 @@ dependencies = [ [[package]] name = "uu_stat" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2942,7 +2941,7 @@ dependencies = [ [[package]] name = "uu_stdbuf" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "tempfile", @@ -2952,7 +2951,7 @@ dependencies = [ [[package]] name = "uu_stdbuf_libstdbuf" -version = "0.0.23" +version = "0.0.24" dependencies = [ "cpp", "cpp_build", @@ -2961,7 +2960,7 @@ dependencies = [ [[package]] name = "uu_stty" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "nix", @@ -2970,7 +2969,7 @@ dependencies = [ [[package]] name = "uu_sum" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -2978,7 +2977,7 @@ dependencies = [ [[package]] name = "uu_sync" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "libc", @@ -2989,7 +2988,7 @@ dependencies = [ [[package]] name = "uu_tac" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "memchr", @@ -3000,7 +2999,7 @@ dependencies = [ [[package]] name = "uu_tail" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "fundu", @@ -3016,7 +3015,7 @@ dependencies = [ [[package]] name = "uu_tee" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "libc", @@ -3025,7 +3024,7 @@ dependencies = [ [[package]] name = "uu_test" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "libc", @@ -3035,7 +3034,7 @@ dependencies = [ [[package]] name = "uu_timeout" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "libc", @@ -3045,7 +3044,7 @@ dependencies = [ [[package]] name = "uu_touch" -version = "0.0.23" +version = "0.0.24" dependencies = [ "chrono", "clap", @@ -3057,7 +3056,7 @@ dependencies = [ [[package]] name = "uu_tr" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "nom", @@ -3066,7 +3065,7 @@ dependencies = [ [[package]] name = "uu_true" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -3074,7 +3073,7 @@ dependencies = [ [[package]] name = "uu_truncate" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -3082,7 +3081,7 @@ dependencies = [ [[package]] name = "uu_tsort" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -3090,7 +3089,7 @@ dependencies = [ [[package]] name = "uu_tty" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "nix", @@ -3099,7 +3098,7 @@ dependencies = [ [[package]] name = "uu_uname" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "platform-info", @@ -3108,7 +3107,7 @@ dependencies = [ [[package]] name = "uu_unexpand" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "unicode-width", @@ -3117,7 +3116,7 @@ dependencies = [ [[package]] name = "uu_uniq" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -3125,7 +3124,7 @@ dependencies = [ [[package]] name = "uu_unlink" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -3133,7 +3132,7 @@ dependencies = [ [[package]] name = "uu_uptime" -version = "0.0.23" +version = "0.0.24" dependencies = [ "chrono", "clap", @@ -3142,7 +3141,7 @@ dependencies = [ [[package]] name = "uu_users" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -3150,7 +3149,7 @@ dependencies = [ [[package]] name = "uu_vdir" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uu_ls", @@ -3159,7 +3158,7 @@ dependencies = [ [[package]] name = "uu_wc" -version = "0.0.23" +version = "0.0.24" dependencies = [ "bytecount", "clap", @@ -3172,7 +3171,7 @@ dependencies = [ [[package]] name = "uu_who" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "uucore", @@ -3180,7 +3179,7 @@ dependencies = [ [[package]] name = "uu_whoami" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "libc", @@ -3190,7 +3189,7 @@ dependencies = [ [[package]] name = "uu_yes" -version = "0.0.23" +version = "0.0.24" dependencies = [ "clap", "itertools", @@ -3200,7 +3199,7 @@ dependencies = [ [[package]] name = "uucore" -version = "0.0.23" +version = "0.0.24" dependencies = [ "blake2b_simd", "blake3", @@ -3231,12 +3230,13 @@ dependencies = [ "wild", "winapi-util", "windows-sys 0.48.0", + "xattr", "z85", ] [[package]] name = "uucore_procs" -version = "0.0.23" +version = "0.0.24" dependencies = [ "proc-macro2", "quote", @@ -3245,7 +3245,7 @@ dependencies = [ [[package]] name = "uuhelp_parser" -version = "0.0.23" +version = "0.0.24" [[package]] name = "uuid" diff --git a/Cargo.toml b/Cargo.toml index a8e9c399b5c..f63fae178cb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ [package] name = "coreutils" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "coreutils ~ GNU coreutils (updated); implemented as universal (cross-platform) utils, written in Rust" @@ -311,14 +311,14 @@ rand = { version = "0.8", features = ["small_rng"] } rand_core = "0.6" rayon = "1.8" redox_syscall = "0.4" -regex = "1.10.2" +regex = "1.10.3" rstest = "0.18.2" rust-ini = "0.19.0" same-file = "1.0.6" self_cell = "1.0.3" selinux = "0.4" signal-hook = "0.3.17" -smallvec = { version = "1.12", features = ["union"] } +smallvec = { version = "1.13", features = ["union"] } tempfile = "3.9.0" uutils_term_grid = "0.3" terminal_size = "0.3.0" @@ -363,109 +363,109 @@ zip = { workspace = true, optional = true } uuhelp_parser = { optional = true, version = ">=0.0.19", path = "src/uuhelp_parser" } # * uutils -uu_test = { optional = true, version = "0.0.23", package = "uu_test", path = "src/uu/test" } +uu_test = { optional = true, version = "0.0.24", package = "uu_test", path = "src/uu/test" } # -arch = { optional = true, version = "0.0.23", package = "uu_arch", path = "src/uu/arch" } -base32 = { optional = true, version = "0.0.23", package = "uu_base32", path = "src/uu/base32" } -base64 = { optional = true, version = "0.0.23", package = "uu_base64", path = "src/uu/base64" } -basename = { optional = true, version = "0.0.23", package = "uu_basename", path = "src/uu/basename" } -basenc = { optional = true, version = "0.0.23", package = "uu_basenc", path = "src/uu/basenc" } -cat = { optional = true, version = "0.0.23", package = "uu_cat", path = "src/uu/cat" } -chcon = { optional = true, version = "0.0.23", package = "uu_chcon", path = "src/uu/chcon" } -chgrp = { optional = true, version = "0.0.23", package = "uu_chgrp", path = "src/uu/chgrp" } -chmod = { optional = true, version = "0.0.23", package = "uu_chmod", path = "src/uu/chmod" } -chown = { optional = true, version = "0.0.23", package = "uu_chown", path = "src/uu/chown" } -chroot = { optional = true, version = "0.0.23", package = "uu_chroot", path = "src/uu/chroot" } -cksum = { optional = true, version = "0.0.23", package = "uu_cksum", path = "src/uu/cksum" } -comm = { optional = true, version = "0.0.23", package = "uu_comm", path = "src/uu/comm" } -cp = { optional = true, version = "0.0.23", package = "uu_cp", path = "src/uu/cp" } -csplit = { optional = true, version = "0.0.23", package = "uu_csplit", path = "src/uu/csplit" } -cut = { optional = true, version = "0.0.23", package = "uu_cut", path = "src/uu/cut" } -date = { optional = true, version = "0.0.23", package = "uu_date", path = "src/uu/date" } -dd = { optional = true, version = "0.0.23", package = "uu_dd", path = "src/uu/dd" } -df = { optional = true, version = "0.0.23", package = "uu_df", path = "src/uu/df" } -dir = { optional = true, version = "0.0.23", package = "uu_dir", path = "src/uu/dir" } -dircolors = { optional = true, version = "0.0.23", package = "uu_dircolors", path = "src/uu/dircolors" } -dirname = { optional = true, version = "0.0.23", package = "uu_dirname", path = "src/uu/dirname" } -du = { optional = true, version = "0.0.23", package = "uu_du", path = "src/uu/du" } -echo = { optional = true, version = "0.0.23", package = "uu_echo", path = "src/uu/echo" } -env = { optional = true, version = "0.0.23", package = "uu_env", path = "src/uu/env" } -expand = { optional = true, version = "0.0.23", package = "uu_expand", path = "src/uu/expand" } -expr = { optional = true, version = "0.0.23", package = "uu_expr", path = "src/uu/expr" } -factor = { optional = true, version = "0.0.23", package = "uu_factor", path = "src/uu/factor" } -false = { optional = true, version = "0.0.23", package = "uu_false", path = "src/uu/false" } -fmt = { optional = true, version = "0.0.23", package = "uu_fmt", path = "src/uu/fmt" } -fold = { optional = true, version = "0.0.23", package = "uu_fold", path = "src/uu/fold" } -groups = { optional = true, version = "0.0.23", package = "uu_groups", path = "src/uu/groups" } -hashsum = { optional = true, version = "0.0.23", package = "uu_hashsum", path = "src/uu/hashsum" } -head = { optional = true, version = "0.0.23", package = "uu_head", path = "src/uu/head" } -hostid = { optional = true, version = "0.0.23", package = "uu_hostid", path = "src/uu/hostid" } -hostname = { optional = true, version = "0.0.23", package = "uu_hostname", path = "src/uu/hostname" } -id = { optional = true, version = "0.0.23", package = "uu_id", path = "src/uu/id" } -install = { optional = true, version = "0.0.23", package = "uu_install", path = "src/uu/install" } -join = { optional = true, version = "0.0.23", package = "uu_join", path = "src/uu/join" } -kill = { optional = true, version = "0.0.23", package = "uu_kill", path = "src/uu/kill" } -link = { optional = true, version = "0.0.23", package = "uu_link", path = "src/uu/link" } -ln = { optional = true, version = "0.0.23", package = "uu_ln", path = "src/uu/ln" } -ls = { optional = true, version = "0.0.23", package = "uu_ls", path = "src/uu/ls" } -logname = { optional = true, version = "0.0.23", package = "uu_logname", path = "src/uu/logname" } -mkdir = { optional = true, version = "0.0.23", package = "uu_mkdir", path = "src/uu/mkdir" } -mkfifo = { optional = true, version = "0.0.23", package = "uu_mkfifo", path = "src/uu/mkfifo" } -mknod = { optional = true, version = "0.0.23", package = "uu_mknod", path = "src/uu/mknod" } -mktemp = { optional = true, version = "0.0.23", package = "uu_mktemp", path = "src/uu/mktemp" } -more = { optional = true, version = "0.0.23", package = "uu_more", path = "src/uu/more" } -mv = { optional = true, version = "0.0.23", package = "uu_mv", path = "src/uu/mv" } -nice = { optional = true, version = "0.0.23", package = "uu_nice", path = "src/uu/nice" } -nl = { optional = true, version = "0.0.23", package = "uu_nl", path = "src/uu/nl" } -nohup = { optional = true, version = "0.0.23", package = "uu_nohup", path = "src/uu/nohup" } -nproc = { optional = true, version = "0.0.23", package = "uu_nproc", path = "src/uu/nproc" } -numfmt = { optional = true, version = "0.0.23", package = "uu_numfmt", path = "src/uu/numfmt" } -od = { optional = true, version = "0.0.23", package = "uu_od", path = "src/uu/od" } -paste = { optional = true, version = "0.0.23", package = "uu_paste", path = "src/uu/paste" } -pathchk = { optional = true, version = "0.0.23", package = "uu_pathchk", path = "src/uu/pathchk" } -pinky = { optional = true, version = "0.0.23", package = "uu_pinky", path = "src/uu/pinky" } -pr = { optional = true, version = "0.0.23", package = "uu_pr", path = "src/uu/pr" } -printenv = { optional = true, version = "0.0.23", package = "uu_printenv", path = "src/uu/printenv" } -printf = { optional = true, version = "0.0.23", package = "uu_printf", path = "src/uu/printf" } -ptx = { optional = true, version = "0.0.23", package = "uu_ptx", path = "src/uu/ptx" } -pwd = { optional = true, version = "0.0.23", package = "uu_pwd", path = "src/uu/pwd" } -readlink = { optional = true, version = "0.0.23", package = "uu_readlink", path = "src/uu/readlink" } -realpath = { optional = true, version = "0.0.23", package = "uu_realpath", path = "src/uu/realpath" } -rm = { optional = true, version = "0.0.23", package = "uu_rm", path = "src/uu/rm" } -rmdir = { optional = true, version = "0.0.23", package = "uu_rmdir", path = "src/uu/rmdir" } -runcon = { optional = true, version = "0.0.23", package = "uu_runcon", path = "src/uu/runcon" } -seq = { optional = true, version = "0.0.23", package = "uu_seq", path = "src/uu/seq" } -shred = { optional = true, version = "0.0.23", package = "uu_shred", path = "src/uu/shred" } -shuf = { optional = true, version = "0.0.23", package = "uu_shuf", path = "src/uu/shuf" } -sleep = { optional = true, version = "0.0.23", package = "uu_sleep", path = "src/uu/sleep" } -sort = { optional = true, version = "0.0.23", package = "uu_sort", path = "src/uu/sort" } -split = { optional = true, version = "0.0.23", package = "uu_split", path = "src/uu/split" } -stat = { optional = true, version = "0.0.23", package = "uu_stat", path = "src/uu/stat" } -stdbuf = { optional = true, version = "0.0.23", package = "uu_stdbuf", path = "src/uu/stdbuf" } -stty = { optional = true, version = "0.0.23", package = "uu_stty", path = "src/uu/stty" } -sum = { optional = true, version = "0.0.23", package = "uu_sum", path = "src/uu/sum" } -sync = { optional = true, version = "0.0.23", package = "uu_sync", path = "src/uu/sync" } -tac = { optional = true, version = "0.0.23", package = "uu_tac", path = "src/uu/tac" } -tail = { optional = true, version = "0.0.23", package = "uu_tail", path = "src/uu/tail" } -tee = { optional = true, version = "0.0.23", package = "uu_tee", path = "src/uu/tee" } -timeout = { optional = true, version = "0.0.23", package = "uu_timeout", path = "src/uu/timeout" } -touch = { optional = true, version = "0.0.23", package = "uu_touch", path = "src/uu/touch" } -tr = { optional = true, version = "0.0.23", package = "uu_tr", path = "src/uu/tr" } -true = { optional = true, version = "0.0.23", package = "uu_true", path = "src/uu/true" } -truncate = { optional = true, version = "0.0.23", package = "uu_truncate", path = "src/uu/truncate" } -tsort = { optional = true, version = "0.0.23", package = "uu_tsort", path = "src/uu/tsort" } -tty = { optional = true, version = "0.0.23", package = "uu_tty", path = "src/uu/tty" } -uname = { optional = true, version = "0.0.23", package = "uu_uname", path = "src/uu/uname" } -unexpand = { optional = true, version = "0.0.23", package = "uu_unexpand", path = "src/uu/unexpand" } -uniq = { optional = true, version = "0.0.23", package = "uu_uniq", path = "src/uu/uniq" } -unlink = { optional = true, version = "0.0.23", package = "uu_unlink", path = "src/uu/unlink" } -uptime = { optional = true, version = "0.0.23", package = "uu_uptime", path = "src/uu/uptime" } -users = { optional = true, version = "0.0.23", package = "uu_users", path = "src/uu/users" } -vdir = { optional = true, version = "0.0.23", package = "uu_vdir", path = "src/uu/vdir" } -wc = { optional = true, version = "0.0.23", package = "uu_wc", path = "src/uu/wc" } -who = { optional = true, version = "0.0.23", package = "uu_who", path = "src/uu/who" } -whoami = { optional = true, version = "0.0.23", package = "uu_whoami", path = "src/uu/whoami" } -yes = { optional = true, version = "0.0.23", package = "uu_yes", path = "src/uu/yes" } +arch = { optional = true, version = "0.0.24", package = "uu_arch", path = "src/uu/arch" } +base32 = { optional = true, version = "0.0.24", package = "uu_base32", path = "src/uu/base32" } +base64 = { optional = true, version = "0.0.24", package = "uu_base64", path = "src/uu/base64" } +basename = { optional = true, version = "0.0.24", package = "uu_basename", path = "src/uu/basename" } +basenc = { optional = true, version = "0.0.24", package = "uu_basenc", path = "src/uu/basenc" } +cat = { optional = true, version = "0.0.24", package = "uu_cat", path = "src/uu/cat" } +chcon = { optional = true, version = "0.0.24", package = "uu_chcon", path = "src/uu/chcon" } +chgrp = { optional = true, version = "0.0.24", package = "uu_chgrp", path = "src/uu/chgrp" } +chmod = { optional = true, version = "0.0.24", package = "uu_chmod", path = "src/uu/chmod" } +chown = { optional = true, version = "0.0.24", package = "uu_chown", path = "src/uu/chown" } +chroot = { optional = true, version = "0.0.24", package = "uu_chroot", path = "src/uu/chroot" } +cksum = { optional = true, version = "0.0.24", package = "uu_cksum", path = "src/uu/cksum" } +comm = { optional = true, version = "0.0.24", package = "uu_comm", path = "src/uu/comm" } +cp = { optional = true, version = "0.0.24", package = "uu_cp", path = "src/uu/cp" } +csplit = { optional = true, version = "0.0.24", package = "uu_csplit", path = "src/uu/csplit" } +cut = { optional = true, version = "0.0.24", package = "uu_cut", path = "src/uu/cut" } +date = { optional = true, version = "0.0.24", package = "uu_date", path = "src/uu/date" } +dd = { optional = true, version = "0.0.24", package = "uu_dd", path = "src/uu/dd" } +df = { optional = true, version = "0.0.24", package = "uu_df", path = "src/uu/df" } +dir = { optional = true, version = "0.0.24", package = "uu_dir", path = "src/uu/dir" } +dircolors = { optional = true, version = "0.0.24", package = "uu_dircolors", path = "src/uu/dircolors" } +dirname = { optional = true, version = "0.0.24", package = "uu_dirname", path = "src/uu/dirname" } +du = { optional = true, version = "0.0.24", package = "uu_du", path = "src/uu/du" } +echo = { optional = true, version = "0.0.24", package = "uu_echo", path = "src/uu/echo" } +env = { optional = true, version = "0.0.24", package = "uu_env", path = "src/uu/env" } +expand = { optional = true, version = "0.0.24", package = "uu_expand", path = "src/uu/expand" } +expr = { optional = true, version = "0.0.24", package = "uu_expr", path = "src/uu/expr" } +factor = { optional = true, version = "0.0.24", package = "uu_factor", path = "src/uu/factor" } +false = { optional = true, version = "0.0.24", package = "uu_false", path = "src/uu/false" } +fmt = { optional = true, version = "0.0.24", package = "uu_fmt", path = "src/uu/fmt" } +fold = { optional = true, version = "0.0.24", package = "uu_fold", path = "src/uu/fold" } +groups = { optional = true, version = "0.0.24", package = "uu_groups", path = "src/uu/groups" } +hashsum = { optional = true, version = "0.0.24", package = "uu_hashsum", path = "src/uu/hashsum" } +head = { optional = true, version = "0.0.24", package = "uu_head", path = "src/uu/head" } +hostid = { optional = true, version = "0.0.24", package = "uu_hostid", path = "src/uu/hostid" } +hostname = { optional = true, version = "0.0.24", package = "uu_hostname", path = "src/uu/hostname" } +id = { optional = true, version = "0.0.24", package = "uu_id", path = "src/uu/id" } +install = { optional = true, version = "0.0.24", package = "uu_install", path = "src/uu/install" } +join = { optional = true, version = "0.0.24", package = "uu_join", path = "src/uu/join" } +kill = { optional = true, version = "0.0.24", package = "uu_kill", path = "src/uu/kill" } +link = { optional = true, version = "0.0.24", package = "uu_link", path = "src/uu/link" } +ln = { optional = true, version = "0.0.24", package = "uu_ln", path = "src/uu/ln" } +ls = { optional = true, version = "0.0.24", package = "uu_ls", path = "src/uu/ls" } +logname = { optional = true, version = "0.0.24", package = "uu_logname", path = "src/uu/logname" } +mkdir = { optional = true, version = "0.0.24", package = "uu_mkdir", path = "src/uu/mkdir" } +mkfifo = { optional = true, version = "0.0.24", package = "uu_mkfifo", path = "src/uu/mkfifo" } +mknod = { optional = true, version = "0.0.24", package = "uu_mknod", path = "src/uu/mknod" } +mktemp = { optional = true, version = "0.0.24", package = "uu_mktemp", path = "src/uu/mktemp" } +more = { optional = true, version = "0.0.24", package = "uu_more", path = "src/uu/more" } +mv = { optional = true, version = "0.0.24", package = "uu_mv", path = "src/uu/mv" } +nice = { optional = true, version = "0.0.24", package = "uu_nice", path = "src/uu/nice" } +nl = { optional = true, version = "0.0.24", package = "uu_nl", path = "src/uu/nl" } +nohup = { optional = true, version = "0.0.24", package = "uu_nohup", path = "src/uu/nohup" } +nproc = { optional = true, version = "0.0.24", package = "uu_nproc", path = "src/uu/nproc" } +numfmt = { optional = true, version = "0.0.24", package = "uu_numfmt", path = "src/uu/numfmt" } +od = { optional = true, version = "0.0.24", package = "uu_od", path = "src/uu/od" } +paste = { optional = true, version = "0.0.24", package = "uu_paste", path = "src/uu/paste" } +pathchk = { optional = true, version = "0.0.24", package = "uu_pathchk", path = "src/uu/pathchk" } +pinky = { optional = true, version = "0.0.24", package = "uu_pinky", path = "src/uu/pinky" } +pr = { optional = true, version = "0.0.24", package = "uu_pr", path = "src/uu/pr" } +printenv = { optional = true, version = "0.0.24", package = "uu_printenv", path = "src/uu/printenv" } +printf = { optional = true, version = "0.0.24", package = "uu_printf", path = "src/uu/printf" } +ptx = { optional = true, version = "0.0.24", package = "uu_ptx", path = "src/uu/ptx" } +pwd = { optional = true, version = "0.0.24", package = "uu_pwd", path = "src/uu/pwd" } +readlink = { optional = true, version = "0.0.24", package = "uu_readlink", path = "src/uu/readlink" } +realpath = { optional = true, version = "0.0.24", package = "uu_realpath", path = "src/uu/realpath" } +rm = { optional = true, version = "0.0.24", package = "uu_rm", path = "src/uu/rm" } +rmdir = { optional = true, version = "0.0.24", package = "uu_rmdir", path = "src/uu/rmdir" } +runcon = { optional = true, version = "0.0.24", package = "uu_runcon", path = "src/uu/runcon" } +seq = { optional = true, version = "0.0.24", package = "uu_seq", path = "src/uu/seq" } +shred = { optional = true, version = "0.0.24", package = "uu_shred", path = "src/uu/shred" } +shuf = { optional = true, version = "0.0.24", package = "uu_shuf", path = "src/uu/shuf" } +sleep = { optional = true, version = "0.0.24", package = "uu_sleep", path = "src/uu/sleep" } +sort = { optional = true, version = "0.0.24", package = "uu_sort", path = "src/uu/sort" } +split = { optional = true, version = "0.0.24", package = "uu_split", path = "src/uu/split" } +stat = { optional = true, version = "0.0.24", package = "uu_stat", path = "src/uu/stat" } +stdbuf = { optional = true, version = "0.0.24", package = "uu_stdbuf", path = "src/uu/stdbuf" } +stty = { optional = true, version = "0.0.24", package = "uu_stty", path = "src/uu/stty" } +sum = { optional = true, version = "0.0.24", package = "uu_sum", path = "src/uu/sum" } +sync = { optional = true, version = "0.0.24", package = "uu_sync", path = "src/uu/sync" } +tac = { optional = true, version = "0.0.24", package = "uu_tac", path = "src/uu/tac" } +tail = { optional = true, version = "0.0.24", package = "uu_tail", path = "src/uu/tail" } +tee = { optional = true, version = "0.0.24", package = "uu_tee", path = "src/uu/tee" } +timeout = { optional = true, version = "0.0.24", package = "uu_timeout", path = "src/uu/timeout" } +touch = { optional = true, version = "0.0.24", package = "uu_touch", path = "src/uu/touch" } +tr = { optional = true, version = "0.0.24", package = "uu_tr", path = "src/uu/tr" } +true = { optional = true, version = "0.0.24", package = "uu_true", path = "src/uu/true" } +truncate = { optional = true, version = "0.0.24", package = "uu_truncate", path = "src/uu/truncate" } +tsort = { optional = true, version = "0.0.24", package = "uu_tsort", path = "src/uu/tsort" } +tty = { optional = true, version = "0.0.24", package = "uu_tty", path = "src/uu/tty" } +uname = { optional = true, version = "0.0.24", package = "uu_uname", path = "src/uu/uname" } +unexpand = { optional = true, version = "0.0.24", package = "uu_unexpand", path = "src/uu/unexpand" } +uniq = { optional = true, version = "0.0.24", package = "uu_uniq", path = "src/uu/uniq" } +unlink = { optional = true, version = "0.0.24", package = "uu_unlink", path = "src/uu/unlink" } +uptime = { optional = true, version = "0.0.24", package = "uu_uptime", path = "src/uu/uptime" } +users = { optional = true, version = "0.0.24", package = "uu_users", path = "src/uu/users" } +vdir = { optional = true, version = "0.0.24", package = "uu_vdir", path = "src/uu/vdir" } +wc = { optional = true, version = "0.0.24", package = "uu_wc", path = "src/uu/wc" } +who = { optional = true, version = "0.0.24", package = "uu_who", path = "src/uu/who" } +whoami = { optional = true, version = "0.0.24", package = "uu_whoami", path = "src/uu/whoami" } +yes = { optional = true, version = "0.0.24", package = "uu_yes", path = "src/uu/yes" } # this breaks clippy linting with: "tests/by-util/test_factor_benches.rs: No such file or directory (os error 2)" # factor_benches = { optional = true, version = "0.0.0", package = "uu_factor_benches", path = "tests/benches/factor" } diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index 076e274ec8a..dfb62aba5e1 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -12,6 +12,7 @@ libfuzzer-sys = "0.4" libc = "0.2" tempfile = "3" rand = { version = "0.8", features = ["small_rng"] } +similar = "2" uucore = { path = "../src/uucore/" } uu_date = { path = "../src/uu/date/" } diff --git a/fuzz/fuzz_targets/fuzz_common.rs b/fuzz/fuzz_targets/fuzz_common.rs index e8cac8d4048..cf56268d75a 100644 --- a/fuzz/fuzz_targets/fuzz_common.rs +++ b/fuzz/fuzz_targets/fuzz_common.rs @@ -7,6 +7,7 @@ use libc::STDIN_FILENO; use libc::{close, dup, dup2, pipe, STDERR_FILENO, STDOUT_FILENO}; use rand::prelude::SliceRandom; use rand::Rng; +use similar::TextDiff; use std::ffi::OsString; use std::io::{Seek, SeekFrom, Write}; use std::os::fd::{AsRawFd, RawFd}; @@ -321,12 +322,14 @@ pub fn compare_result( discrepancies.push("stdout differs"); println!("Rust stdout: {}", rust_result.stdout); println!("GNU stdout: {}", gnu_result.stdout); + print_diff(&rust_result.stdout, &gnu_result.stdout); should_panic = true; } if rust_result.stderr.trim() != gnu_result.stderr.trim() { discrepancies.push("stderr differs"); println!("Rust stderr: {}", rust_result.stderr); println!("GNU stderr: {}", gnu_result.stderr); + print_diff(&rust_result.stderr, &gnu_result.stderr); if fail_on_stderr_diff { should_panic = true; } @@ -353,6 +356,16 @@ pub fn compare_result( } } +/// When we have different outputs, print the diff +fn print_diff(rust_output: &str, gnu_output: &str) { + println!("Diff="); + let diff = TextDiff::from_lines(rust_output, gnu_output); + for change in diff.iter_all_changes() { + print!("{}{}", change.tag(), change); + } + println!(); +} + pub fn generate_random_string(max_length: usize) -> String { let mut rng = rand::thread_rng(); let valid_utf8: Vec = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" diff --git a/src/uu/arch/Cargo.toml b/src/uu/arch/Cargo.toml index edb15f846c2..b4d07b26c59 100644 --- a/src/uu/arch/Cargo.toml +++ b/src/uu/arch/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_arch" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "arch ~ (uutils) display machine architecture" diff --git a/src/uu/base32/Cargo.toml b/src/uu/base32/Cargo.toml index 71fbe325fe8..1c27e14cf3f 100644 --- a/src/uu/base32/Cargo.toml +++ b/src/uu/base32/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_base32" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "base32 ~ (uutils) decode/encode input (base32-encoding)" diff --git a/src/uu/base64/Cargo.toml b/src/uu/base64/Cargo.toml index e52665bb692..204b880bf72 100644 --- a/src/uu/base64/Cargo.toml +++ b/src/uu/base64/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_base64" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "base64 ~ (uutils) decode/encode input (base64-encoding)" diff --git a/src/uu/basename/Cargo.toml b/src/uu/basename/Cargo.toml index 3de240e04a9..51202235b15 100644 --- a/src/uu/basename/Cargo.toml +++ b/src/uu/basename/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_basename" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "basename ~ (uutils) display PATHNAME with leading directory components removed" diff --git a/src/uu/basenc/Cargo.toml b/src/uu/basenc/Cargo.toml index 54a5a53a118..26a2364282f 100644 --- a/src/uu/basenc/Cargo.toml +++ b/src/uu/basenc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_basenc" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "basenc ~ (uutils) decode/encode input" diff --git a/src/uu/cat/Cargo.toml b/src/uu/cat/Cargo.toml index 14383895e7d..cce6561c084 100644 --- a/src/uu/cat/Cargo.toml +++ b/src/uu/cat/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cat" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "cat ~ (uutils) concatenate and display input" diff --git a/src/uu/chcon/Cargo.toml b/src/uu/chcon/Cargo.toml index d21da4cf04d..021e435823a 100644 --- a/src/uu/chcon/Cargo.toml +++ b/src/uu/chcon/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chcon" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "chcon ~ (uutils) change file security context" diff --git a/src/uu/chgrp/Cargo.toml b/src/uu/chgrp/Cargo.toml index 79942033f1e..bbad8d31e6e 100644 --- a/src/uu/chgrp/Cargo.toml +++ b/src/uu/chgrp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chgrp" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "chgrp ~ (uutils) change the group ownership of FILE" diff --git a/src/uu/chmod/Cargo.toml b/src/uu/chmod/Cargo.toml index ebfe00fe1c5..e779469deda 100644 --- a/src/uu/chmod/Cargo.toml +++ b/src/uu/chmod/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chmod" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "chmod ~ (uutils) change mode of FILE" diff --git a/src/uu/chown/Cargo.toml b/src/uu/chown/Cargo.toml index aab8f20b6c1..dfa9dba32a1 100644 --- a/src/uu/chown/Cargo.toml +++ b/src/uu/chown/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chown" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "chown ~ (uutils) change the ownership of FILE" diff --git a/src/uu/chroot/Cargo.toml b/src/uu/chroot/Cargo.toml index a78c89685bf..12533b6542a 100644 --- a/src/uu/chroot/Cargo.toml +++ b/src/uu/chroot/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_chroot" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "chroot ~ (uutils) run COMMAND under a new root directory" diff --git a/src/uu/cksum/Cargo.toml b/src/uu/cksum/Cargo.toml index 9a811fafdbc..47b4d73592a 100644 --- a/src/uu/cksum/Cargo.toml +++ b/src/uu/cksum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cksum" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "cksum ~ (uutils) display CRC and size of input" diff --git a/src/uu/comm/Cargo.toml b/src/uu/comm/Cargo.toml index 71ed0ad717f..cd759aad246 100644 --- a/src/uu/comm/Cargo.toml +++ b/src/uu/comm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_comm" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "comm ~ (uutils) compare sorted inputs" diff --git a/src/uu/cp/Cargo.toml b/src/uu/cp/Cargo.toml index 179b4668e68..7db6b202bb2 100644 --- a/src/uu/cp/Cargo.toml +++ b/src/uu/cp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cp" -version = "0.0.23" +version = "0.0.24" authors = [ "Jordy Dickinson ", "Joshua S. Miller ", diff --git a/src/uu/csplit/Cargo.toml b/src/uu/csplit/Cargo.toml index e68b1258253..5e2f310cb51 100644 --- a/src/uu/csplit/Cargo.toml +++ b/src/uu/csplit/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_csplit" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "csplit ~ (uutils) Output pieces of FILE separated by PATTERN(s) to files 'xx00', 'xx01', ..., and output byte counts of each piece to standard output" diff --git a/src/uu/cut/Cargo.toml b/src/uu/cut/Cargo.toml index e572d987ec4..c98bec5bc42 100644 --- a/src/uu/cut/Cargo.toml +++ b/src/uu/cut/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_cut" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "cut ~ (uutils) display byte/field columns of input lines" diff --git a/src/uu/date/Cargo.toml b/src/uu/date/Cargo.toml index c5682f83e5a..11ad64bbef7 100644 --- a/src/uu/date/Cargo.toml +++ b/src/uu/date/Cargo.toml @@ -1,7 +1,7 @@ # spell-checker:ignore datetime [package] name = "uu_date" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "date ~ (uutils) display or set the current time" diff --git a/src/uu/dd/Cargo.toml b/src/uu/dd/Cargo.toml index 410ebf4d6a8..1dbb37bde55 100644 --- a/src/uu/dd/Cargo.toml +++ b/src/uu/dd/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dd" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "dd ~ (uutils) copy and convert files" diff --git a/src/uu/df/Cargo.toml b/src/uu/df/Cargo.toml index d074e6be74f..e9aa192e820 100644 --- a/src/uu/df/Cargo.toml +++ b/src/uu/df/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_df" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "df ~ (uutils) display file system information" diff --git a/src/uu/dir/Cargo.toml b/src/uu/dir/Cargo.toml index 628c0fb8cfe..b82298ce319 100644 --- a/src/uu/dir/Cargo.toml +++ b/src/uu/dir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dir" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "shortcut to ls -C -b" diff --git a/src/uu/dircolors/Cargo.toml b/src/uu/dircolors/Cargo.toml index 66ee792f839..1bf87c22cc1 100644 --- a/src/uu/dircolors/Cargo.toml +++ b/src/uu/dircolors/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dircolors" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "dircolors ~ (uutils) display commands to set LS_COLORS" diff --git a/src/uu/dirname/Cargo.toml b/src/uu/dirname/Cargo.toml index b093ce3c55c..85391859663 100644 --- a/src/uu/dirname/Cargo.toml +++ b/src/uu/dirname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_dirname" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "dirname ~ (uutils) display parent directory of PATHNAME" diff --git a/src/uu/du/Cargo.toml b/src/uu/du/Cargo.toml index 5e87b2f4381..8b9eb062e48 100644 --- a/src/uu/du/Cargo.toml +++ b/src/uu/du/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_du" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "du ~ (uutils) display disk usage" diff --git a/src/uu/echo/Cargo.toml b/src/uu/echo/Cargo.toml index e63977e57f7..ddb896c3389 100644 --- a/src/uu/echo/Cargo.toml +++ b/src/uu/echo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_echo" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "echo ~ (uutils) display TEXT" diff --git a/src/uu/env/Cargo.toml b/src/uu/env/Cargo.toml index 78452ca6ade..8ed051232b6 100644 --- a/src/uu/env/Cargo.toml +++ b/src/uu/env/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_env" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "env ~ (uutils) set each NAME to VALUE in the environment and run COMMAND" diff --git a/src/uu/expand/Cargo.toml b/src/uu/expand/Cargo.toml index 63425bc5ea1..87f8f8f7716 100644 --- a/src/uu/expand/Cargo.toml +++ b/src/uu/expand/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_expand" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "expand ~ (uutils) convert input tabs to spaces" diff --git a/src/uu/expr/Cargo.toml b/src/uu/expr/Cargo.toml index a867c27c80a..17d37413e26 100644 --- a/src/uu/expr/Cargo.toml +++ b/src/uu/expr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_expr" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "expr ~ (uutils) display the value of EXPRESSION" diff --git a/src/uu/factor/Cargo.toml b/src/uu/factor/Cargo.toml index aee67eeeaf0..a149056888a 100644 --- a/src/uu/factor/Cargo.toml +++ b/src/uu/factor/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_factor" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "factor ~ (uutils) display the prime factors of each NUMBER" diff --git a/src/uu/false/Cargo.toml b/src/uu/false/Cargo.toml index 50b5bc027d8..e88fa99783f 100644 --- a/src/uu/false/Cargo.toml +++ b/src/uu/false/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_false" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "false ~ (uutils) do nothing and fail" diff --git a/src/uu/fmt/Cargo.toml b/src/uu/fmt/Cargo.toml index 688525e3b00..de415310f2f 100644 --- a/src/uu/fmt/Cargo.toml +++ b/src/uu/fmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_fmt" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "fmt ~ (uutils) reformat each paragraph of input" diff --git a/src/uu/fold/Cargo.toml b/src/uu/fold/Cargo.toml index 1887f1bbd3a..02cf1115ec2 100644 --- a/src/uu/fold/Cargo.toml +++ b/src/uu/fold/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_fold" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "fold ~ (uutils) wrap each line of input" diff --git a/src/uu/groups/Cargo.toml b/src/uu/groups/Cargo.toml index 9c513517500..dac52fc5864 100644 --- a/src/uu/groups/Cargo.toml +++ b/src/uu/groups/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_groups" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "groups ~ (uutils) display group memberships for USERNAME" diff --git a/src/uu/hashsum/Cargo.toml b/src/uu/hashsum/Cargo.toml index 1ecb5f8403c..a20fe0d7826 100644 --- a/src/uu/hashsum/Cargo.toml +++ b/src/uu/hashsum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hashsum" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "hashsum ~ (uutils) display or check input digests" diff --git a/src/uu/hashsum/src/hashsum.rs b/src/uu/hashsum/src/hashsum.rs index 22ef4152070..5e439853a58 100644 --- a/src/uu/hashsum/src/hashsum.rs +++ b/src/uu/hashsum/src/hashsum.rs @@ -756,7 +756,9 @@ where } else if options.zero { print!("{} {}{}\0", sum, binary_marker, filename.display()); } else { - println!("{} {}{}", sum, binary_marker, filename.display()); + let (filename, has_prefix) = escape_filename(filename); + let prefix = if has_prefix { "\\" } else { "" }; + println!("{}{} {}{}", prefix, sum, binary_marker, filename); } } } @@ -781,6 +783,16 @@ where Ok(()) } +fn escape_filename(filename: &Path) -> (String, bool) { + let original = filename.as_os_str().to_string_lossy(); + let escaped = original + .replace('\\', "\\\\") + .replace('\n', "\\n") + .replace('\r', "\\r"); + let has_changed = escaped != original; + (escaped, has_changed) +} + fn digest_reader( digest: &mut Box, reader: &mut BufReader, diff --git a/src/uu/head/Cargo.toml b/src/uu/head/Cargo.toml index 12872c80820..45e51b881b2 100644 --- a/src/uu/head/Cargo.toml +++ b/src/uu/head/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_head" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "head ~ (uutils) display the first lines of input" diff --git a/src/uu/hostid/Cargo.toml b/src/uu/hostid/Cargo.toml index 602e7ef3751..8e551befb4a 100644 --- a/src/uu/hostid/Cargo.toml +++ b/src/uu/hostid/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hostid" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "hostid ~ (uutils) display the numeric identifier of the current host" diff --git a/src/uu/hostname/Cargo.toml b/src/uu/hostname/Cargo.toml index 1fe10170964..7dd6eabe5ad 100644 --- a/src/uu/hostname/Cargo.toml +++ b/src/uu/hostname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_hostname" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "hostname ~ (uutils) display or set the host name of the current host" diff --git a/src/uu/id/Cargo.toml b/src/uu/id/Cargo.toml index b62df1eebd2..6d332acfc3c 100644 --- a/src/uu/id/Cargo.toml +++ b/src/uu/id/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_id" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "id ~ (uutils) display user and group information for USER" diff --git a/src/uu/install/Cargo.toml b/src/uu/install/Cargo.toml index 0110380068b..647e0958ee0 100644 --- a/src/uu/install/Cargo.toml +++ b/src/uu/install/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_install" -version = "0.0.23" +version = "0.0.24" authors = ["Ben Eills ", "uutils developers"] license = "MIT" description = "install ~ (uutils) copy files from SOURCE to DESTINATION (with specified attributes)" @@ -25,6 +25,7 @@ uucore = { workspace = true, features = [ "mode", "perms", "entries", + "process", ] } [[bin]] diff --git a/src/uu/install/src/install.rs b/src/uu/install/src/install.rs index e568149acf6..9955be7b292 100644 --- a/src/uu/install/src/install.rs +++ b/src/uu/install/src/install.rs @@ -776,27 +776,23 @@ fn copy_file(from: &Path, to: &Path) -> UResult<()> { /// fn strip_file(to: &Path, b: &Behavior) -> UResult<()> { // Check if the filename starts with a hyphen and adjust the path - let to = if to - .file_name() - .unwrap_or_default() - .to_str() - .unwrap_or_default() - .starts_with('-') - { + let to_str = to.as_os_str().to_str().unwrap_or_default(); + let to = if to_str.starts_with('-') { let mut new_path = PathBuf::from("."); new_path.push(to); new_path } else { to.to_path_buf() }; - match process::Command::new(&b.strip_program).arg(&to).output() { - Ok(o) => { - if !o.status.success() { + match process::Command::new(&b.strip_program).arg(&to).status() { + Ok(status) => { + if !status.success() { // Follow GNU's behavior: if strip fails, removes the target let _ = fs::remove_file(to); - return Err(InstallError::StripProgramFailed( - String::from_utf8(o.stderr).unwrap_or_default(), - ) + return Err(InstallError::StripProgramFailed(format!( + "strip process terminated abnormally - exit code: {}", + status.code().unwrap() + )) .into()); } } diff --git a/src/uu/join/Cargo.toml b/src/uu/join/Cargo.toml index 20853527d83..759b04af712 100644 --- a/src/uu/join/Cargo.toml +++ b/src/uu/join/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_join" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "join ~ (uutils) merge lines from inputs with matching join fields" diff --git a/src/uu/kill/Cargo.toml b/src/uu/kill/Cargo.toml index 6cb8cee6e3d..e60faa1c455 100644 --- a/src/uu/kill/Cargo.toml +++ b/src/uu/kill/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_kill" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "kill ~ (uutils) send a signal to a process" diff --git a/src/uu/link/Cargo.toml b/src/uu/link/Cargo.toml index cba12c95c3b..d3643c5dcf6 100644 --- a/src/uu/link/Cargo.toml +++ b/src/uu/link/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_link" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "link ~ (uutils) create a hard (file system) link to FILE" diff --git a/src/uu/ln/Cargo.toml b/src/uu/ln/Cargo.toml index 4243075ea0a..ba97c84e365 100644 --- a/src/uu/ln/Cargo.toml +++ b/src/uu/ln/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ln" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "ln ~ (uutils) create a (file system) link to TARGET" diff --git a/src/uu/logname/Cargo.toml b/src/uu/logname/Cargo.toml index 2e8553f12c4..d9870b1d99c 100644 --- a/src/uu/logname/Cargo.toml +++ b/src/uu/logname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_logname" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "logname ~ (uutils) display the login name of the current user" diff --git a/src/uu/ls/Cargo.toml b/src/uu/ls/Cargo.toml index 38312eefc5e..49c64ba0937 100644 --- a/src/uu/ls/Cargo.toml +++ b/src/uu/ls/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ls" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "ls ~ (uutils) display directory contents" @@ -27,6 +27,7 @@ uucore = { workspace = true, features = [ "colors", "entries", "fs", + "fsxattr", "quoting-style", "version-cmp", ] } @@ -34,9 +35,6 @@ once_cell = { workspace = true } selinux = { workspace = true, optional = true } hostname = { workspace = true } -[target.'cfg(unix)'.dependencies] -xattr = { workspace = true } - [[bin]] name = "ls" path = "src/main.rs" diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 1c89cd3536d..ed100477f42 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -3,7 +3,7 @@ // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. -// spell-checker:ignore (ToDO) somegroup nlink tabsize dired subdired dtype colorterm getxattr +// spell-checker:ignore (ToDO) somegroup nlink tabsize dired subdired dtype colorterm use clap::{ builder::{NonEmptyStringValueParser, ValueParser}, @@ -36,7 +36,8 @@ use std::{ }; use term_grid::{Cell, Direction, Filling, Grid, GridOptions}; use unicode_width::UnicodeWidthStr; - +#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))] +use uucore::fsxattr::has_acl; #[cfg(any( target_os = "linux", target_os = "macos", @@ -2621,18 +2622,6 @@ fn display_grid( Ok(()) } -#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))] -fn file_has_acl>(file: P) -> bool { - // don't use exacl here, it is doing more getxattr call then needed - match xattr::list(file) { - Ok(acl) => { - // if we have extra attributes, we have an acl - acl.count() > 0 - } - Err(_) => false, - } -} - /// This writes to the BufWriter out a single string of the output of `ls -l`. /// /// It writes the following keys, in order: @@ -2680,7 +2669,7 @@ fn display_item_long( // TODO: See how Mac should work here let is_acl_set = false; #[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))] - let is_acl_set = file_has_acl(item.display_name.as_os_str()); + let is_acl_set = has_acl(item.display_name.as_os_str()); write!( output_display, "{}{}{} {}", diff --git a/src/uu/mkdir/Cargo.toml b/src/uu/mkdir/Cargo.toml index 4f6ddb3cc02..a0ba24b42e8 100644 --- a/src/uu/mkdir/Cargo.toml +++ b/src/uu/mkdir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mkdir" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "mkdir ~ (uutils) create DIRECTORY" diff --git a/src/uu/mkfifo/Cargo.toml b/src/uu/mkfifo/Cargo.toml index d7f787511a8..10ff3661686 100644 --- a/src/uu/mkfifo/Cargo.toml +++ b/src/uu/mkfifo/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mkfifo" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "mkfifo ~ (uutils) create FIFOs (named pipes)" diff --git a/src/uu/mknod/Cargo.toml b/src/uu/mknod/Cargo.toml index 58caa5d9dc4..000fe4d01a5 100644 --- a/src/uu/mknod/Cargo.toml +++ b/src/uu/mknod/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mknod" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "mknod ~ (uutils) create special file NAME of TYPE" diff --git a/src/uu/mktemp/Cargo.toml b/src/uu/mktemp/Cargo.toml index 2913e4b6e02..504c46350d7 100644 --- a/src/uu/mktemp/Cargo.toml +++ b/src/uu/mktemp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mktemp" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "mktemp ~ (uutils) create and display a temporary file or directory from TEMPLATE" diff --git a/src/uu/more/Cargo.toml b/src/uu/more/Cargo.toml index 9f0bc9d3d65..58957a08c74 100644 --- a/src/uu/more/Cargo.toml +++ b/src/uu/more/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_more" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "more ~ (uutils) input perusal filter" diff --git a/src/uu/mv/Cargo.toml b/src/uu/mv/Cargo.toml index 83a10ef6b7a..4193f9595cb 100644 --- a/src/uu/mv/Cargo.toml +++ b/src/uu/mv/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_mv" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "mv ~ (uutils) move (rename) SOURCE to DESTINATION" @@ -21,6 +21,7 @@ indicatif = { workspace = true } uucore = { workspace = true, features = [ "backup-control", "fs", + "fsxattr", "update-control", ] } diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index 223ac9119b6..9f24cf77092 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -27,7 +27,10 @@ use uucore::fs::{ are_hardlinks_or_one_way_symlink_to_same_file, are_hardlinks_to_same_file, path_ends_with_terminator, }; +#[cfg(all(unix, not(target_os = "macos")))] +use uucore::fsxattr; use uucore::update_control; + // These are exposed for projects (e.g. nushell) that want to create an `Options` value, which // requires these enums pub use uucore::{backup_control::BackupMode, update_control::UpdateMode}; @@ -631,6 +634,10 @@ fn rename_with_fallback( None }; + #[cfg(all(unix, not(target_os = "macos")))] + let xattrs = + fsxattr::retrieve_xattrs(from).unwrap_or_else(|_| std::collections::HashMap::new()); + let result = if let Some(ref pb) = progress_bar { move_dir_with_progress(from, to, &options, |process_info: TransitProcess| { pb.set_position(process_info.copied_bytes); @@ -641,6 +648,9 @@ fn rename_with_fallback( move_dir(from, to, &options) }; + #[cfg(all(unix, not(target_os = "macos")))] + fsxattr::apply_xattrs(to, xattrs).unwrap(); + if let Err(err) = result { return match err.kind { fs_extra::error::ErrorKind::PermissionDenied => Err(io::Error::new( @@ -651,6 +661,11 @@ fn rename_with_fallback( }; } } else { + #[cfg(all(unix, not(target_os = "macos")))] + fs::copy(from, to) + .and_then(|_| fsxattr::copy_xattrs(&from, &to)) + .and_then(|_| fs::remove_file(from))?; + #[cfg(any(target_os = "macos", not(unix)))] fs::copy(from, to).and_then(|_| fs::remove_file(from))?; } } diff --git a/src/uu/nice/Cargo.toml b/src/uu/nice/Cargo.toml index 6fab5cefc24..7285318ef63 100644 --- a/src/uu/nice/Cargo.toml +++ b/src/uu/nice/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nice" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "nice ~ (uutils) run PROGRAM with modified scheduling priority" diff --git a/src/uu/nl/Cargo.toml b/src/uu/nl/Cargo.toml index 56cb8d8e94e..35b0f3d848b 100644 --- a/src/uu/nl/Cargo.toml +++ b/src/uu/nl/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nl" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "nl ~ (uutils) display input with added line numbers" diff --git a/src/uu/nohup/Cargo.toml b/src/uu/nohup/Cargo.toml index 24d8f659c7e..8e8bd50cb4d 100644 --- a/src/uu/nohup/Cargo.toml +++ b/src/uu/nohup/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nohup" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "nohup ~ (uutils) run COMMAND, ignoring hangup signals" diff --git a/src/uu/nproc/Cargo.toml b/src/uu/nproc/Cargo.toml index 54bb1d83c09..9e6efc559c1 100644 --- a/src/uu/nproc/Cargo.toml +++ b/src/uu/nproc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_nproc" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "nproc ~ (uutils) display the number of processing units available" diff --git a/src/uu/numfmt/Cargo.toml b/src/uu/numfmt/Cargo.toml index 79e6d5401aa..71505d4b7db 100644 --- a/src/uu/numfmt/Cargo.toml +++ b/src/uu/numfmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_numfmt" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "numfmt ~ (uutils) reformat NUMBER" diff --git a/src/uu/od/Cargo.toml b/src/uu/od/Cargo.toml index 84c89ee8611..e2c0a236b93 100644 --- a/src/uu/od/Cargo.toml +++ b/src/uu/od/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_od" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "od ~ (uutils) display formatted representation of input" diff --git a/src/uu/paste/Cargo.toml b/src/uu/paste/Cargo.toml index 68255c82ddd..0ab1015b9df 100644 --- a/src/uu/paste/Cargo.toml +++ b/src/uu/paste/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_paste" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "paste ~ (uutils) merge lines from inputs" diff --git a/src/uu/pathchk/Cargo.toml b/src/uu/pathchk/Cargo.toml index dee85deae55..eeb667ac349 100644 --- a/src/uu/pathchk/Cargo.toml +++ b/src/uu/pathchk/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pathchk" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "pathchk ~ (uutils) diagnose invalid or non-portable PATHNAME" diff --git a/src/uu/pinky/Cargo.toml b/src/uu/pinky/Cargo.toml index f64cb758510..ba1dbc09688 100644 --- a/src/uu/pinky/Cargo.toml +++ b/src/uu/pinky/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pinky" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "pinky ~ (uutils) display user information" diff --git a/src/uu/pr/Cargo.toml b/src/uu/pr/Cargo.toml index ab54593837f..4d09ad7afc8 100644 --- a/src/uu/pr/Cargo.toml +++ b/src/uu/pr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pr" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "pr ~ (uutils) convert text files for printing" diff --git a/src/uu/printenv/Cargo.toml b/src/uu/printenv/Cargo.toml index a6d7c91d046..32765a1f1e9 100644 --- a/src/uu/printenv/Cargo.toml +++ b/src/uu/printenv/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_printenv" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "printenv ~ (uutils) display value of environment VAR" diff --git a/src/uu/printf/Cargo.toml b/src/uu/printf/Cargo.toml index 0404654e207..0033c31494b 100644 --- a/src/uu/printf/Cargo.toml +++ b/src/uu/printf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_printf" -version = "0.0.23" +version = "0.0.24" authors = ["Nathan Ross", "uutils developers"] license = "MIT" description = "printf ~ (uutils) FORMAT and display ARGUMENTS" diff --git a/src/uu/ptx/Cargo.toml b/src/uu/ptx/Cargo.toml index 4ea395dc5cc..30bee8642b1 100644 --- a/src/uu/ptx/Cargo.toml +++ b/src/uu/ptx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_ptx" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "ptx ~ (uutils) display a permuted index of input" diff --git a/src/uu/pwd/Cargo.toml b/src/uu/pwd/Cargo.toml index 8bd0ccece58..82cd4cf8ee1 100644 --- a/src/uu/pwd/Cargo.toml +++ b/src/uu/pwd/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_pwd" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "pwd ~ (uutils) display current working directory" diff --git a/src/uu/readlink/Cargo.toml b/src/uu/readlink/Cargo.toml index 4d1574c50be..cb17296129f 100644 --- a/src/uu/readlink/Cargo.toml +++ b/src/uu/readlink/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_readlink" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "readlink ~ (uutils) display resolved path of PATHNAME" diff --git a/src/uu/realpath/Cargo.toml b/src/uu/realpath/Cargo.toml index 8b21d6c7f8d..942f9601640 100644 --- a/src/uu/realpath/Cargo.toml +++ b/src/uu/realpath/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_realpath" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "realpath ~ (uutils) display resolved absolute path of PATHNAME" diff --git a/src/uu/rm/Cargo.toml b/src/uu/rm/Cargo.toml index 34ada60e865..a36251838d5 100644 --- a/src/uu/rm/Cargo.toml +++ b/src/uu/rm/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_rm" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "rm ~ (uutils) remove PATHNAME" diff --git a/src/uu/rmdir/Cargo.toml b/src/uu/rmdir/Cargo.toml index f17db50b0ee..e567b98b69d 100644 --- a/src/uu/rmdir/Cargo.toml +++ b/src/uu/rmdir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_rmdir" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "rmdir ~ (uutils) remove empty DIRECTORY" diff --git a/src/uu/runcon/Cargo.toml b/src/uu/runcon/Cargo.toml index 72237ece95a..e22f2e9d1ca 100644 --- a/src/uu/runcon/Cargo.toml +++ b/src/uu/runcon/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_runcon" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "runcon ~ (uutils) run command with specified security context" diff --git a/src/uu/seq/Cargo.toml b/src/uu/seq/Cargo.toml index afa4f9ecaf5..dca08f5d064 100644 --- a/src/uu/seq/Cargo.toml +++ b/src/uu/seq/Cargo.toml @@ -1,7 +1,7 @@ # spell-checker:ignore bigdecimal [package] name = "uu_seq" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "seq ~ (uutils) display a sequence of numbers" diff --git a/src/uu/shred/Cargo.toml b/src/uu/shred/Cargo.toml index 8721cd624f0..97fab64e1f6 100644 --- a/src/uu/shred/Cargo.toml +++ b/src/uu/shred/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_shred" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "shred ~ (uutils) hide former FILE contents with repeated overwrites" diff --git a/src/uu/shuf/Cargo.toml b/src/uu/shuf/Cargo.toml index 2bbf2af149d..c1d2de7c8bd 100644 --- a/src/uu/shuf/Cargo.toml +++ b/src/uu/shuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_shuf" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "shuf ~ (uutils) display random permutations of input lines" diff --git a/src/uu/sleep/Cargo.toml b/src/uu/sleep/Cargo.toml index d3d1fe61e9f..94789f31312 100644 --- a/src/uu/sleep/Cargo.toml +++ b/src/uu/sleep/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sleep" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "sleep ~ (uutils) pause for DURATION" diff --git a/src/uu/sort/Cargo.toml b/src/uu/sort/Cargo.toml index 8c1c03dc638..7f5938c7034 100644 --- a/src/uu/sort/Cargo.toml +++ b/src/uu/sort/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sort" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "sort ~ (uutils) sort input lines" diff --git a/src/uu/split/Cargo.toml b/src/uu/split/Cargo.toml index 6253dbf2be3..5a7ded4bc8b 100644 --- a/src/uu/split/Cargo.toml +++ b/src/uu/split/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_split" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "split ~ (uutils) split input into output files" diff --git a/src/uu/stat/Cargo.toml b/src/uu/stat/Cargo.toml index 5ed91a88cb6..dd28fc5f382 100644 --- a/src/uu/stat/Cargo.toml +++ b/src/uu/stat/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stat" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "stat ~ (uutils) display FILE status" diff --git a/src/uu/stdbuf/Cargo.toml b/src/uu/stdbuf/Cargo.toml index ed7a0e2e11e..fdee4f68433 100644 --- a/src/uu/stdbuf/Cargo.toml +++ b/src/uu/stdbuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stdbuf" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "stdbuf ~ (uutils) run COMMAND with modified standard stream buffering" @@ -20,7 +20,7 @@ tempfile = { workspace = true } uucore = { workspace = true } [build-dependencies] -libstdbuf = { version = "0.0.23", package = "uu_stdbuf_libstdbuf", path = "src/libstdbuf" } +libstdbuf = { version = "0.0.24", package = "uu_stdbuf_libstdbuf", path = "src/libstdbuf" } [[bin]] name = "stdbuf" diff --git a/src/uu/stdbuf/src/libstdbuf/Cargo.toml b/src/uu/stdbuf/src/libstdbuf/Cargo.toml index eaa82e6e73d..eab74dc089e 100644 --- a/src/uu/stdbuf/src/libstdbuf/Cargo.toml +++ b/src/uu/stdbuf/src/libstdbuf/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stdbuf_libstdbuf" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "stdbuf/libstdbuf ~ (uutils); dynamic library required for stdbuf" diff --git a/src/uu/stty/Cargo.toml b/src/uu/stty/Cargo.toml index a353c66030f..51863220d5f 100644 --- a/src/uu/stty/Cargo.toml +++ b/src/uu/stty/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_stty" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "stty ~ (uutils) print or change terminal characteristics" diff --git a/src/uu/sum/Cargo.toml b/src/uu/sum/Cargo.toml index 04be0fe72db..56711b6fd29 100644 --- a/src/uu/sum/Cargo.toml +++ b/src/uu/sum/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sum" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "sum ~ (uutils) display checksum and block counts for input" diff --git a/src/uu/sync/Cargo.toml b/src/uu/sync/Cargo.toml index 4048115243a..0c93433928c 100644 --- a/src/uu/sync/Cargo.toml +++ b/src/uu/sync/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_sync" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "sync ~ (uutils) synchronize cache writes to storage" diff --git a/src/uu/tac/Cargo.toml b/src/uu/tac/Cargo.toml index 164972c5f45..a89f179e388 100644 --- a/src/uu/tac/Cargo.toml +++ b/src/uu/tac/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "uu_tac" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "tac ~ (uutils) concatenate and display input lines in reverse order" diff --git a/src/uu/tail/Cargo.toml b/src/uu/tail/Cargo.toml index 636480e08ba..826f7f83daf 100644 --- a/src/uu/tail/Cargo.toml +++ b/src/uu/tail/Cargo.toml @@ -1,7 +1,7 @@ # spell-checker:ignore (libs) kqueue fundu [package] name = "uu_tail" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "tail ~ (uutils) display the last lines of input" diff --git a/src/uu/tee/Cargo.toml b/src/uu/tee/Cargo.toml index 441b891a4ad..b84e7cb314a 100644 --- a/src/uu/tee/Cargo.toml +++ b/src/uu/tee/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tee" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "tee ~ (uutils) display input and copy to FILE" diff --git a/src/uu/test/Cargo.toml b/src/uu/test/Cargo.toml index 93a77b11d4a..35132cd27b2 100644 --- a/src/uu/test/Cargo.toml +++ b/src/uu/test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_test" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "test ~ (uutils) evaluate comparison and file type expressions" diff --git a/src/uu/timeout/Cargo.toml b/src/uu/timeout/Cargo.toml index 4f6c062bb8a..3a9500a2e96 100644 --- a/src/uu/timeout/Cargo.toml +++ b/src/uu/timeout/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_timeout" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "timeout ~ (uutils) run COMMAND with a DURATION time limit" diff --git a/src/uu/touch/Cargo.toml b/src/uu/touch/Cargo.toml index d67cd1f8a16..51cc4ac3f41 100644 --- a/src/uu/touch/Cargo.toml +++ b/src/uu/touch/Cargo.toml @@ -1,7 +1,7 @@ # spell-checker:ignore datetime [package] name = "uu_touch" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "touch ~ (uutils) change FILE timestamps" diff --git a/src/uu/tr/Cargo.toml b/src/uu/tr/Cargo.toml index a07679dd187..ff1efbe921f 100644 --- a/src/uu/tr/Cargo.toml +++ b/src/uu/tr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tr" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "tr ~ (uutils) translate characters within input and display" diff --git a/src/uu/true/Cargo.toml b/src/uu/true/Cargo.toml index 8c4080724b6..eae893d2176 100644 --- a/src/uu/true/Cargo.toml +++ b/src/uu/true/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_true" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "true ~ (uutils) do nothing and succeed" diff --git a/src/uu/truncate/Cargo.toml b/src/uu/truncate/Cargo.toml index 254a004e779..2ea443ce7f4 100644 --- a/src/uu/truncate/Cargo.toml +++ b/src/uu/truncate/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_truncate" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "truncate ~ (uutils) truncate (or extend) FILE to SIZE" diff --git a/src/uu/tsort/Cargo.toml b/src/uu/tsort/Cargo.toml index 567d41e0b79..f0430b41b3b 100644 --- a/src/uu/tsort/Cargo.toml +++ b/src/uu/tsort/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tsort" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "tsort ~ (uutils) topologically sort input (partially ordered) pairs" diff --git a/src/uu/tsort/src/tsort.rs b/src/uu/tsort/src/tsort.rs index 3ae4f4f97e6..2bc9d317576 100644 --- a/src/uu/tsort/src/tsort.rs +++ b/src/uu/tsort/src/tsort.rs @@ -32,7 +32,14 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { stdin_buf = stdin(); &mut stdin_buf as &mut dyn Read } else { - file_buf = File::open(Path::new(&input)).map_err_context(|| input.to_string())?; + let path = Path::new(&input); + if path.is_dir() { + return Err(USimpleError::new( + 1, + format!("{}: read error: Is a directory", input), + )); + } + file_buf = File::open(path).map_err_context(|| input.to_string())?; &mut file_buf as &mut dyn Read }); diff --git a/src/uu/tty/Cargo.toml b/src/uu/tty/Cargo.toml index 95734e6c933..d6065d4679e 100644 --- a/src/uu/tty/Cargo.toml +++ b/src/uu/tty/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_tty" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "tty ~ (uutils) display the name of the terminal connected to standard input" diff --git a/src/uu/uname/Cargo.toml b/src/uu/uname/Cargo.toml index cfd459c5bf1..f9883eef93c 100644 --- a/src/uu/uname/Cargo.toml +++ b/src/uu/uname/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uname" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "uname ~ (uutils) display system information" diff --git a/src/uu/unexpand/Cargo.toml b/src/uu/unexpand/Cargo.toml index 459a67b9015..d10239b960e 100644 --- a/src/uu/unexpand/Cargo.toml +++ b/src/uu/unexpand/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_unexpand" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "unexpand ~ (uutils) convert input spaces to tabs" diff --git a/src/uu/uniq/Cargo.toml b/src/uu/uniq/Cargo.toml index efe5ca8ee53..52d1d22e16a 100644 --- a/src/uu/uniq/Cargo.toml +++ b/src/uu/uniq/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uniq" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "uniq ~ (uutils) filter identical adjacent lines from input" diff --git a/src/uu/unlink/Cargo.toml b/src/uu/unlink/Cargo.toml index c6bfcd66bb7..854df092c1b 100644 --- a/src/uu/unlink/Cargo.toml +++ b/src/uu/unlink/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_unlink" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "unlink ~ (uutils) remove a (file system) link to FILE" diff --git a/src/uu/uptime/Cargo.toml b/src/uu/uptime/Cargo.toml index 899a30dfaa5..0013e980a67 100644 --- a/src/uu/uptime/Cargo.toml +++ b/src/uu/uptime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_uptime" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "uptime ~ (uutils) display dynamic system information" diff --git a/src/uu/users/Cargo.toml b/src/uu/users/Cargo.toml index 030c7d62551..8e29b119e8a 100644 --- a/src/uu/users/Cargo.toml +++ b/src/uu/users/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_users" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "users ~ (uutils) display names of currently logged-in users" diff --git a/src/uu/vdir/Cargo.toml b/src/uu/vdir/Cargo.toml index d14e10d9565..3c7e55eda69 100644 --- a/src/uu/vdir/Cargo.toml +++ b/src/uu/vdir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_vdir" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "shortcut to ls -l -b" diff --git a/src/uu/wc/Cargo.toml b/src/uu/wc/Cargo.toml index 8471472f867..516e3be46a3 100644 --- a/src/uu/wc/Cargo.toml +++ b/src/uu/wc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_wc" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "wc ~ (uutils) display newline, word, and byte counts for input" diff --git a/src/uu/who/Cargo.toml b/src/uu/who/Cargo.toml index 249d5a8eeec..f343942fc4b 100644 --- a/src/uu/who/Cargo.toml +++ b/src/uu/who/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_who" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "who ~ (uutils) display information about currently logged-in users" diff --git a/src/uu/whoami/Cargo.toml b/src/uu/whoami/Cargo.toml index 5336568334f..3d2abb034a7 100644 --- a/src/uu/whoami/Cargo.toml +++ b/src/uu/whoami/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_whoami" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "whoami ~ (uutils) display user name of current effective user ID" diff --git a/src/uu/yes/Cargo.toml b/src/uu/yes/Cargo.toml index dd562cab675..1f59bdb16f5 100644 --- a/src/uu/yes/Cargo.toml +++ b/src/uu/yes/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "uu_yes" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "yes ~ (uutils) repeatedly display a line with STRING (or 'y')" diff --git a/src/uucore/Cargo.toml b/src/uucore/Cargo.toml index 44f8bb2d13f..78c01cd071c 100644 --- a/src/uucore/Cargo.toml +++ b/src/uucore/Cargo.toml @@ -2,7 +2,7 @@ [package] name = "uucore" -version = "0.0.23" +version = "0.0.24" authors = ["uutils developers"] license = "MIT" description = "uutils ~ 'core' uutils code library (cross-platform)" @@ -54,6 +54,7 @@ sm3 = { workspace = true, optional = true } [target.'cfg(unix)'.dependencies] walkdir = { workspace = true, optional = true } nix = { workspace = true, features = ["fs", "uio", "zerocopy", "signal"] } +xattr = { workspace = true, optional = true } [dev-dependencies] clap = { workspace = true } @@ -77,6 +78,7 @@ encoding = ["data-encoding", "data-encoding-macro", "z85", "thiserror"] entries = ["libc"] fs = ["dunce", "libc", "winapi-util", "windows-sys"] fsext = ["libc", "time", "windows-sys"] +fsxattr = ["xattr"] lines = [] format = ["itertools"] mode = ["libc"] diff --git a/src/uucore/src/lib/features.rs b/src/uucore/src/lib/features.rs index e26de487b57..423ff34bad9 100644 --- a/src/uucore/src/lib/features.rs +++ b/src/uucore/src/lib/features.rs @@ -46,6 +46,8 @@ pub mod pipes; #[cfg(all(unix, feature = "process"))] pub mod process; +#[cfg(all(unix, not(target_os = "macos"), feature = "fsxattr"))] +pub mod fsxattr; #[cfg(all(unix, not(target_os = "fuchsia"), feature = "signals"))] pub mod signals; #[cfg(all( diff --git a/src/uucore/src/lib/features/format/num_format.rs b/src/uucore/src/lib/features/format/num_format.rs index ea5d6a75316..607c028c32c 100644 --- a/src/uucore/src/lib/features/format/num_format.rs +++ b/src/uucore/src/lib/features/format/num_format.rs @@ -156,13 +156,21 @@ impl Formatter for UnsignedInt { format!("{x:x}") } UnsignedIntVariant::Hexadecimal(Case::Lowercase, Prefix::Yes) => { - format!("{x:#x}") + if x == 0 { + "0".to_string() + } else { + format!("{x:#x}") + } } UnsignedIntVariant::Hexadecimal(Case::Uppercase, Prefix::No) => { format!("{x:X}") } UnsignedIntVariant::Hexadecimal(Case::Uppercase, Prefix::Yes) => { - format!("{x:#X}") + if x == 0 { + "0".to_string() + } else { + format!("{x:#X}") + } } }; diff --git a/src/uucore/src/lib/features/fsxattr.rs b/src/uucore/src/lib/features/fsxattr.rs new file mode 100644 index 00000000000..3cb00edc0cb --- /dev/null +++ b/src/uucore/src/lib/features/fsxattr.rs @@ -0,0 +1,154 @@ +// This file is part of the uutils coreutils package. +// +// For the full copyright and license information, please view the LICENSE +// file that was distributed with this source code. + +// spell-checker:ignore getxattr + +//! Set of functions to manage xattr on files and dirs +use std::collections::HashMap; +use std::ffi::OsString; +use std::path::Path; + +/// Copies extended attributes (xattrs) from one file or directory to another. +/// +/// # Arguments +/// +/// * `source` - A reference to the source path. +/// * `dest` - A reference to the destination path. +/// +/// # Returns +/// +/// A result indicating success or failure. +pub fn copy_xattrs>(source: P, dest: P) -> std::io::Result<()> { + for attr_name in xattr::list(&source)? { + if let Some(value) = xattr::get(&source, &attr_name)? { + xattr::set(&dest, &attr_name, &value)?; + } + } + Ok(()) +} + +/// Retrieves the extended attributes (xattrs) of a given file or directory. +/// +/// # Arguments +/// +/// * `source` - A reference to the path of the file or directory. +/// +/// # Returns +/// +/// A result containing a HashMap of attributes names and values, or an error. +pub fn retrieve_xattrs>(source: P) -> std::io::Result>> { + let mut attrs = HashMap::new(); + for attr_name in xattr::list(&source)? { + if let Some(value) = xattr::get(&source, &attr_name)? { + attrs.insert(attr_name, value); + } + } + Ok(attrs) +} + +/// Applies extended attributes (xattrs) to a given file or directory. +/// +/// # Arguments +/// +/// * `dest` - A reference to the path of the file or directory. +/// * `xattrs` - A HashMap containing attribute names and their corresponding values. +/// +/// # Returns +/// +/// A result indicating success or failure. +pub fn apply_xattrs>( + dest: P, + xattrs: HashMap>, +) -> std::io::Result<()> { + for (attr, value) in xattrs { + xattr::set(&dest, &attr, &value)?; + } + Ok(()) +} + +/// Checks if a file has an Access Control List (ACL) based on its extended attributes. +/// +/// # Arguments +/// +/// * `file` - A reference to the path of the file. +/// +/// # Returns +/// +/// `true` if the file has extended attributes (indicating an ACL), `false` otherwise. +pub fn has_acl>(file: P) -> bool { + // don't use exacl here, it is doing more getxattr call then needed + match xattr::list(file) { + Ok(acl) => { + // if we have extra attributes, we have an acl + acl.count() > 0 + } + Err(_) => false, + } +} + +#[cfg(test)] +mod tests { + use super::*; + use std::fs::File; + use tempfile::tempdir; + + #[test] + fn test_copy_xattrs() { + let temp_dir = tempdir().unwrap(); + let source_path = temp_dir.path().join("source.txt"); + let dest_path = temp_dir.path().join("dest.txt"); + + File::create(&source_path).unwrap(); + File::create(&dest_path).unwrap(); + + let test_attr = "user.test"; + let test_value = b"test value"; + xattr::set(&source_path, test_attr, test_value).unwrap(); + + copy_xattrs(&source_path, &dest_path).unwrap(); + + let copied_value = xattr::get(&dest_path, test_attr).unwrap().unwrap(); + assert_eq!(copied_value, test_value); + } + + #[test] + fn test_apply_and_retrieve_xattrs() { + let temp_dir = tempdir().unwrap(); + let file_path = temp_dir.path().join("test_file.txt"); + + File::create(&file_path).unwrap(); + + let mut test_xattrs = HashMap::new(); + let test_attr = "user.test_attr"; + let test_value = b"test value"; + test_xattrs.insert(OsString::from(test_attr), test_value.to_vec()); + apply_xattrs(&file_path, test_xattrs).unwrap(); + + let retrieved_xattrs = retrieve_xattrs(&file_path).unwrap(); + assert!(retrieved_xattrs.contains_key(OsString::from(test_attr).as_os_str())); + assert_eq!( + retrieved_xattrs + .get(OsString::from(test_attr).as_os_str()) + .unwrap(), + test_value + ); + } + + #[test] + fn test_file_has_acl() { + let temp_dir = tempdir().unwrap(); + let file_path = temp_dir.path().join("test_file.txt"); + + File::create(&file_path).unwrap(); + + assert!(!has_acl(&file_path)); + + let test_attr = "user.test_acl"; + let test_value = b"test value"; + xattr::set(&file_path, test_attr, test_value).unwrap(); + + assert!(has_acl(&file_path)); + } +} diff --git a/src/uucore/src/lib/features/sum.rs b/src/uucore/src/lib/features/sum.rs index e079d7a30e3..3a8bb55d59b 100644 --- a/src/uucore/src/lib/features/sum.rs +++ b/src/uucore/src/lib/features/sum.rs @@ -484,22 +484,23 @@ mod tests { fn test_crlf_across_blocks() { use std::io::Write; - use crate::digest::Digest; - use crate::digest::DigestWriter; + use super::Digest; + use super::DigestWriter; + use super::Md5; // Writing "\r" in one call to `write()`, and then "\n" in another. - let mut digest = Box::new(md5::Md5::new()) as Box; + let mut digest = Box::new(Md5::new()) as Box; let mut writer_crlf = DigestWriter::new(&mut digest, false); writer_crlf.write_all(&[b'\r']).unwrap(); writer_crlf.write_all(&[b'\n']).unwrap(); - writer_crlf.hash_finalize(); + writer_crlf.finalize(); let result_crlf = digest.result_str(); // We expect "\r\n" to be replaced with "\n" in text mode on Windows. - let mut digest = Box::new(md5::Md5::new()) as Box; + let mut digest = Box::new(Md5::new()) as Box; let mut writer_lf = DigestWriter::new(&mut digest, false); writer_lf.write_all(&[b'\n']).unwrap(); - writer_lf.hash_finalize(); + writer_lf.finalize(); let result_lf = digest.result_str(); assert_eq!(result_crlf, result_lf); diff --git a/src/uucore/src/lib/lib.rs b/src/uucore/src/lib/lib.rs index 2fc0ae301b3..6f8400589ef 100644 --- a/src/uucore/src/lib/lib.rs +++ b/src/uucore/src/lib/lib.rs @@ -43,8 +43,6 @@ pub use crate::features::encoding; pub use crate::features::format; #[cfg(feature = "fs")] pub use crate::features::fs; -#[cfg(feature = "fsext")] -pub use crate::features::fsext; #[cfg(feature = "lines")] pub use crate::features::lines; #[cfg(feature = "quoting-style")] @@ -89,6 +87,12 @@ pub use crate::features::utmpx; #[cfg(all(windows, feature = "wide"))] pub use crate::features::wide; +#[cfg(feature = "fsext")] +pub use crate::features::fsext; + +#[cfg(all(unix, not(target_os = "macos"), feature = "fsxattr"))] +pub use crate::features::fsxattr; + //## core functions use std::ffi::OsString; diff --git a/src/uucore_procs/Cargo.toml b/src/uucore_procs/Cargo.toml index f6b92fe6353..2411bb6c166 100644 --- a/src/uucore_procs/Cargo.toml +++ b/src/uucore_procs/Cargo.toml @@ -1,7 +1,7 @@ # spell-checker:ignore uuhelp [package] name = "uucore_procs" -version = "0.0.23" +version = "0.0.24" authors = ["Roy Ivy III "] license = "MIT" description = "uutils ~ 'uucore' proc-macros" @@ -19,4 +19,4 @@ proc-macro = true [dependencies] proc-macro2 = "1.0" quote = "1.0" -uuhelp_parser = { path = "../uuhelp_parser", version = "0.0.23" } +uuhelp_parser = { path = "../uuhelp_parser", version = "0.0.24" } diff --git a/src/uuhelp_parser/Cargo.toml b/src/uuhelp_parser/Cargo.toml index cbf049f9dba..018aa1d898f 100644 --- a/src/uuhelp_parser/Cargo.toml +++ b/src/uuhelp_parser/Cargo.toml @@ -1,7 +1,7 @@ # spell-checker:ignore uuhelp [package] name = "uuhelp_parser" -version = "0.0.23" +version = "0.0.24" edition = "2021" license = "MIT" description = "A collection of functions to parse the markdown code of help files" diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 1271909ecb9..c0d81d9a915 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -57,7 +57,7 @@ static TEST_MOUNT_OTHER_FILESYSTEM_FILE: &str = "mount/DO_NOT_copy_me.txt"; #[cfg(unix)] static TEST_NONEXISTENT_FILE: &str = "nonexistent_file.txt"; #[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))] -use xattr; +use crate::common::util::compare_xattrs; /// Assert that mode, ownership, and permissions of two metadata objects match. #[cfg(all(not(windows), not(target_os = "freebsd")))] @@ -3739,21 +3739,6 @@ fn test_cp_no_such() { .stderr_is("cp: 'no-such/' is not a directory\n"); } -#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))] -fn compare_xattrs>(path1: P, path2: P) -> bool { - let get_sorted_xattrs = |path: P| { - xattr::list(path) - .map(|attrs| { - let mut attrs = attrs.collect::>(); - attrs.sort(); - attrs - }) - .unwrap_or_else(|_| Vec::new()) - }; - - get_sorted_xattrs(path1) == get_sorted_xattrs(path2) -} - #[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))] #[test] fn test_acl_preserve() { diff --git a/tests/by-util/test_hashsum.rs b/tests/by-util/test_hashsum.rs index 31471495b07..7edd387c326 100644 --- a/tests/by-util/test_hashsum.rs +++ b/tests/by-util/test_hashsum.rs @@ -371,3 +371,18 @@ fn test_tag() { "SHA256 (foobar) = 1f2ec52b774368781bed1d1fb140a92e0eb6348090619c9291f9a5a3c8e8d151\n", ); } + +#[test] +#[cfg(not(windows))] +fn test_with_escape_filename() { + let scene = TestScenario::new(util_name!()); + + let at = &scene.fixtures; + let filename = "a\nb"; + at.touch(filename); + let result = scene.ccmd("md5sum").arg("--text").arg(filename).succeeds(); + let stdout = result.stdout_str(); + println!("stdout {}", stdout); + assert!(stdout.starts_with('\\')); + assert!(stdout.trim().ends_with("a\\nb")); +} diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 3db25c81fc2..6b1d76e5527 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -699,7 +699,20 @@ fn test_install_and_strip_with_program_hyphen() { .arg("src") .arg("-dest") .succeeds() - .no_stderr(); + .no_stderr() + .stdout_is("./-dest\n"); + + scene + .ucmd() + .arg("-s") + .arg("--strip-program") + .arg("./no-hyphen") + .arg("--") + .arg("src") + .arg("./-dest") + .succeeds() + .no_stderr() + .stdout_is("./-dest\n"); } #[test] diff --git a/tests/by-util/test_mv.rs b/tests/by-util/test_mv.rs index 175b91e7dab..dd05ffbcd0a 100644 --- a/tests/by-util/test_mv.rs +++ b/tests/by-util/test_mv.rs @@ -1569,6 +1569,47 @@ fn test_mv_dir_into_path_slash() { assert!(at.dir_exists("f/b")); } +#[cfg(all(unix, not(target_os = "macos")))] +#[test] +fn test_acl() { + use std::process::Command; + + use crate::common::util::compare_xattrs; + + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + let path1 = "a"; + let path2 = "b"; + let file = "a/file"; + let file_target = "b/file"; + at.mkdir(path1); + at.mkdir(path2); + at.touch(file); + + let path = at.plus_as_string(file); + // calling the command directly. xattr requires some dev packages to be installed + // and it adds a complex dependency just for a test + match Command::new("setfacl") + .args(["-m", "group::rwx", &path1]) + .status() + .map(|status| status.code()) + { + Ok(Some(0)) => {} + Ok(_) => { + println!("test skipped: setfacl failed"); + return; + } + Err(e) => { + println!("test skipped: setfacl failed with {}", e); + return; + } + } + + scene.ucmd().arg(&path).arg(path2).succeeds(); + + assert!(compare_xattrs(&file, &file_target)); +} + // Todo: // $ at.touch a b diff --git a/tests/by-util/test_pinky.rs b/tests/by-util/test_pinky.rs index 57413c4c95e..0fff402df96 100644 --- a/tests/by-util/test_pinky.rs +++ b/tests/by-util/test_pinky.rs @@ -21,6 +21,7 @@ fn test_capitalize() { } #[test] +#[cfg(not(target_os = "openbsd"))] fn test_long_format() { let login = "root"; let pw: Passwd = Passwd::locate(login).unwrap(); @@ -44,6 +45,7 @@ fn test_long_format() { #[cfg(unix)] #[test] +#[cfg(not(target_os = "openbsd"))] fn test_long_format_multiple_users() { // multiple instances of one account we know exists, // the account of the test runner, @@ -71,6 +73,7 @@ fn test_long_format_wo_user() { #[cfg(unix)] #[test] +#[cfg(not(target_os = "openbsd"))] fn test_short_format_i() { // allow whitespace variation // * minor whitespace differences occur between platform built-in outputs; specifically, the number of trailing TABs may be variant @@ -85,6 +88,7 @@ fn test_short_format_i() { #[cfg(unix)] #[test] +#[cfg(not(target_os = "openbsd"))] fn test_short_format_q() { // allow whitespace variation // * minor whitespace differences occur between platform built-in outputs; specifically, the number of trailing TABs may be variant @@ -99,6 +103,7 @@ fn test_short_format_q() { #[cfg(unix)] #[test] +#[cfg(not(target_os = "openbsd"))] fn test_no_flag() { let ts = TestScenario::new(util_name!()); let actual = ts.ucmd().succeeds().stdout_move_str(); diff --git a/tests/by-util/test_printf.rs b/tests/by-util/test_printf.rs index 411285a0cd2..db4c5aa7f8d 100644 --- a/tests/by-util/test_printf.rs +++ b/tests/by-util/test_printf.rs @@ -645,6 +645,32 @@ fn partial_char() { ); } +#[test] +fn sub_alternative_lower_hex_0() { + new_ucmd!().args(&["%#x", "0"]).succeeds().stdout_only("0"); +} + +#[test] +fn sub_alternative_lower_hex() { + new_ucmd!() + .args(&["%#x", "42"]) + .succeeds() + .stdout_only("0x2a"); +} + +#[test] +fn sub_alternative_upper_hex_0() { + new_ucmd!().args(&["%#X", "0"]).succeeds().stdout_only("0"); +} + +#[test] +fn sub_alternative_upper_hex() { + new_ucmd!() + .args(&["%#X", "42"]) + .succeeds() + .stdout_only("0x2A"); +} + #[test] fn char_as_byte() { new_ucmd!().args(&["%c", "🙃"]).succeeds().stdout_only("ð"); diff --git a/tests/by-util/test_tsort.rs b/tests/by-util/test_tsort.rs index 18889451629..79195efa211 100644 --- a/tests/by-util/test_tsort.rs +++ b/tests/by-util/test_tsort.rs @@ -64,3 +64,12 @@ fn test_multiple_arguments() { .fails() .stderr_contains("unexpected argument 'invalid_file' found"); } + +#[test] +fn test_error_on_dir() { + let (at, mut ucmd) = at_and_ucmd!(); + at.mkdir("tsort_test_dir"); + ucmd.arg("tsort_test_dir") + .fails() + .stderr_contains("tsort: tsort_test_dir: read error: Is a directory"); +} diff --git a/tests/by-util/test_uptime.rs b/tests/by-util/test_uptime.rs index 3967d025251..89e5567fba4 100644 --- a/tests/by-util/test_uptime.rs +++ b/tests/by-util/test_uptime.rs @@ -11,6 +11,7 @@ fn test_invalid_arg() { } #[test] +#[cfg(not(target_os = "openbsd"))] fn test_uptime() { TestScenario::new(util_name!()) .ucmd() @@ -22,6 +23,7 @@ fn test_uptime() { } #[test] +#[cfg(not(target_os = "openbsd"))] fn test_uptime_since() { let re = Regex::new(r"\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}").unwrap(); diff --git a/tests/by-util/test_who.rs b/tests/by-util/test_who.rs index 3bacc38c112..36325fe7c57 100644 --- a/tests/by-util/test_who.rs +++ b/tests/by-util/test_who.rs @@ -25,6 +25,7 @@ fn test_count() { #[cfg(unix)] #[test] +#[cfg(not(target_os = "openbsd"))] fn test_boot() { let ts = TestScenario::new(util_name!()); for opt in ["-b", "--boot", "--b"] { @@ -65,6 +66,7 @@ fn test_short() { #[cfg(unix)] #[test] +#[cfg(not(target_os = "openbsd"))] fn test_login() { let ts = TestScenario::new(util_name!()); for opt in ["-l", "--login", "--log"] { @@ -75,6 +77,7 @@ fn test_login() { #[cfg(unix)] #[test] +#[cfg(not(target_os = "openbsd"))] fn test_m() { let ts = TestScenario::new(util_name!()); let expected_stdout = unwrap_or_return!(expected_result(&ts, &["-m"])).stdout_move_str(); @@ -83,6 +86,7 @@ fn test_m() { #[cfg(unix)] #[test] +#[cfg(not(target_os = "openbsd"))] fn test_process() { let ts = TestScenario::new(util_name!()); for opt in ["-p", "--process", "--p"] { @@ -93,6 +97,7 @@ fn test_process() { #[cfg(unix)] #[test] +#[cfg(not(target_os = "openbsd"))] fn test_runlevel() { let ts = TestScenario::new(util_name!()); for opt in ["-r", "--runlevel", "--r"] { @@ -106,6 +111,7 @@ fn test_runlevel() { #[cfg(unix)] #[test] +#[cfg(not(target_os = "openbsd"))] fn test_time() { let ts = TestScenario::new(util_name!()); for opt in ["-t", "--time", "--t"] { @@ -141,6 +147,7 @@ fn test_mesg() { #[cfg(unix)] #[test] +#[cfg(not(target_os = "openbsd"))] fn test_arg1_arg2() { let args = ["am", "i"]; let ts = TestScenario::new(util_name!()); @@ -195,6 +202,7 @@ fn test_lookup() { #[cfg(unix)] #[test] +#[cfg(not(target_os = "openbsd"))] fn test_dead() { let ts = TestScenario::new(util_name!()); for opt in ["-d", "--dead", "--de"] { diff --git a/tests/common/util.rs b/tests/common/util.rs index 1daebec01d8..e5eb4b40ca4 100644 --- a/tests/common/util.rs +++ b/tests/common/util.rs @@ -760,6 +760,26 @@ pub fn get_root_path() -> &'static str { } } +/// Compares the extended attributes (xattrs) of two files or directories. +/// +/// # Returns +/// +/// `true` if both paths have the same set of extended attributes, `false` otherwise. +#[cfg(all(unix, not(target_os = "macos")))] +pub fn compare_xattrs>(path1: P, path2: P) -> bool { + let get_sorted_xattrs = |path: P| { + xattr::list(path) + .map(|attrs| { + let mut attrs = attrs.collect::>(); + attrs.sort(); + attrs + }) + .unwrap_or_else(|_| Vec::new()) + }; + + get_sorted_xattrs(path1) == get_sorted_xattrs(path2) +} + /// Object-oriented path struct that represents and operates on /// paths relative to the directory it was constructed for. #[derive(Clone)] @@ -3379,4 +3399,26 @@ mod tests { ); assert!(command.tmpd.is_some()); } + + #[cfg(all(unix, not(target_os = "macos")))] + #[test] + fn test_compare_xattrs() { + use tempfile::tempdir; + + let temp_dir = tempdir().unwrap(); + let file_path1 = temp_dir.path().join("test_file1.txt"); + let file_path2 = temp_dir.path().join("test_file2.txt"); + + File::create(&file_path1).unwrap(); + File::create(&file_path2).unwrap(); + + let test_attr = "user.test_attr"; + let test_value = b"test value"; + xattr::set(&file_path1, test_attr, test_value).unwrap(); + + assert!(!compare_xattrs(&file_path1, &file_path2)); + + xattr::set(&file_path2, test_attr, test_value).unwrap(); + assert!(compare_xattrs(&file_path1, &file_path2)); + } } diff --git a/util/update-version.sh b/util/update-version.sh index 244a7a7b29a..7f785f1d7af 100755 --- a/util/update-version.sh +++ b/util/update-version.sh @@ -17,8 +17,8 @@ # 10) Create the release on github https://github.com/uutils/coreutils/releases/new # 11) Make sure we have good release notes -FROM="0.0.22" -TO="0.0.23" +FROM="0.0.23" +TO="0.0.24" PROGS=$(ls -1d src/uu/*/Cargo.toml src/uu/stdbuf/src/libstdbuf/Cargo.toml src/uucore/Cargo.toml Cargo.toml)