Skip to content

cp: incorrectly copies directory when path ends in dot #3897

@jfinkels

Description

@jfinkels

cp -R incorrectly copies a directory when the path ends in a dot.

GNU cp v8.30:

mkdir x y
cd y
cp -R ../x/. .  # succeeds and does *not* copy x/ into y/

uutils cp:

mkdir x y
cd y
../target/debug/cp -R ../x/. .  # succeeds and *does* copy x/ into y/

The corresponding GNU test case is tests/cp/src-base-dot.sh. This test is incorrectly marked as passing on the main branch because the GNU test case doesn't actually verify that the directory x/ is not copied to y/.

Originally mentioned by @jfinkels in #3894 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions