diff options
-rw-r--r-- | .github/workflows/CICD.yml | 22 | ||||
-rw-r--r-- | .github/workflows/freebsd.yml | 4 | ||||
-rw-r--r-- | src/uu/cp/src/cp.rs | 1 | ||||
-rw-r--r-- | src/uu/pwd/src/pwd.rs | 4 | ||||
-rw-r--r-- | tests/by-util/test_cp.rs | 27 | ||||
-rw-r--r-- | tests/by-util/test_pwd.rs | 2 |
6 files changed, 32 insertions, 28 deletions
diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index 8c595537f..fb2300ba9 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -183,8 +183,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" - name: Initialize workflow variables id: vars shell: bash @@ -295,8 +293,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" - name: Initialize workflow variables id: vars shell: bash @@ -351,8 +347,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" - name: Initialize workflow variables id: vars shell: bash @@ -441,8 +435,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" - name: "`make build`" shell: bash run: | @@ -485,8 +477,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" - name: Test run: cargo nextest run --hide-progress-bar --profile ci ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} env: @@ -514,8 +504,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" - name: Test run: cargo nextest run --hide-progress-bar --profile ci ${{ steps.vars.outputs.CARGO_FEATURES_OPTION }} env: @@ -539,8 +527,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" - name: Install dependencies shell: bash run: | @@ -666,8 +652,6 @@ jobs: key: "${{ matrix.job.os }}_${{ matrix.job.target }}" - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" - name: Initialize workflow variables id: vars shell: bash @@ -921,8 +905,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" - name: Install/setup prerequisites shell: bash run: | @@ -1007,8 +989,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" - name: Build coreutils as multiple binaries shell: bash run: | @@ -1093,8 +1073,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" # - name: Reattach HEAD ## may be needed for accurate code coverage info # run: git checkout ${{ github.head_ref }} - name: Initialize workflow variables diff --git a/.github/workflows/freebsd.yml b/.github/workflows/freebsd.yml index 50746154b..9507b3a56 100644 --- a/.github/workflows/freebsd.yml +++ b/.github/workflows/freebsd.yml @@ -34,8 +34,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" - name: Prepare, build and test uses: vmactions/freebsd-vm@v0.3.0 with: @@ -126,8 +124,6 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - with: - version: "v0.5.0" - name: Prepare, build and test uses: vmactions/freebsd-vm@v0.3.0 with: diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index e8552a179..60ef54095 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -515,6 +515,7 @@ pub fn uu_app() -> Command { PRESERVABLE_ATTRIBUTES, )) .num_args(0..) + .require_equals(true) .value_name("ATTR_LIST") .overrides_with_all([ options::ARCHIVE, diff --git a/src/uu/pwd/src/pwd.rs b/src/uu/pwd/src/pwd.rs index 7af194872..9e04dd38b 100644 --- a/src/uu/pwd/src/pwd.rs +++ b/src/uu/pwd/src/pwd.rs @@ -115,7 +115,9 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { // if POSIXLY_CORRECT is set, we want to a logical resolution. // This produces a different output when doing mkdir -p a/b && ln -s a/b c && cd c && pwd // We should get c in this case instead of a/b at the end of the path - let cwd = if matches.get_flag(OPT_LOGICAL) || env::var("POSIXLY_CORRECT").is_ok() { + let cwd = if matches.get_flag(OPT_PHYSICAL) { + physical_path() + } else if matches.get_flag(OPT_LOGICAL) || env::var("POSIXLY_CORRECT").is_ok() { logical_path() } else { physical_path() diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 9ccf6777e..fa5845eac 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -1224,6 +1224,33 @@ fn test_cp_preserve_no_args() { } #[test] +fn test_cp_preserve_no_args_before_opts() { + let (at, mut ucmd) = at_and_ucmd!(); + let src_file = "a"; + let dst_file = "b"; + + // Prepare the source file + at.touch(src_file); + #[cfg(unix)] + at.set_mode(src_file, 0o0500); + + // Copy + ucmd.arg("--preserve") + .arg(src_file) + .arg(dst_file) + .succeeds(); + + #[cfg(all(unix, not(target_os = "freebsd")))] + { + // Assert that the mode, ownership, and timestamps are preserved + // NOTICE: the ownership is not modified on the src file, because that requires root permissions + let metadata_src = at.metadata(src_file); + let metadata_dst = at.metadata(dst_file); + assert_metadata_eq!(metadata_src, metadata_dst); + } +} + +#[test] fn test_cp_preserve_all() { let (at, mut ucmd) = at_and_ucmd!(); let src_file = "a"; diff --git a/tests/by-util/test_pwd.rs b/tests/by-util/test_pwd.rs index 076e72089..1e43f5be6 100644 --- a/tests/by-util/test_pwd.rs +++ b/tests/by-util/test_pwd.rs @@ -116,7 +116,7 @@ fn test_symlinked_default_posix_p() { .env("POSIXLY_CORRECT", "1") .arg("-P") .succeeds() - .stdout_is(env.symdir + "\n"); + .stdout_is(env.subdir + "\n"); } #[cfg(not(windows))] |