Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cp: make --b=simple protective of source #3647

Merged
merged 5 commits into from
Jun 20, 2022

Conversation

philgebhardt
Copy link
Contributor

When --backup is supplied, cp will take a backup of destination before source is copied. When --backup=simple is supplied, it is possible for the backup path for destination to equal the path for source, destroying source before the copy is made. This change prevents this by returning an error instead.

This fixes #3629

When `--backup` is supplied, `cp` will take a backup of *destination* before *source* is copied. When `--backup=simple` is supplied, it is possible for the backup path for *destination* to equal the path for *source*, destroying source before the copy is made. This change prevents this by returning an error instead.

This fixes uutils#3629
Copy link
Sponsor Contributor

@sylvestre sylvestre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a small comment

tests/fixtures/cp/protected.txt Outdated Show resolved Hide resolved
@sylvestre
Copy link
Sponsor Contributor

Warning: Congrats! The gnu test tests/cp/backup-is-src is no longer failing!

\o/

@sylvestre sylvestre merged commit c277e93 into uutils:main Jun 20, 2022
@philgebhardt philgebhardt deleted the backup-protect-source branch June 20, 2022 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cp --b=simple isn't protective enough
2 participants