Skip to content

cp is is not properly cleaning existing file #7885

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

Open
sga-13 opened this issue May 5, 2025 · 0 comments
Open

cp is is not properly cleaning existing file #7885

sga-13 opened this issue May 5, 2025 · 0 comments
Labels

Comments

@sga-13
Copy link

sga-13 commented May 5, 2025

I use the following command to get a "buffer" for my current clipboard stuff, which i use elsewhere - wl-paste --watch cp /dev/stdin tmp

when i was using gnu cp, with each clipboard copy, the tmp file is rewritten appropriately (old stuff cleaned, new stuff written). with uutils cp, old stuff partially remains. if original stuff was n characters long, and new content is n' (n' < n), then only first n' characters are rewritten, n - n' old characters remain. This seems very much dependent on how wl-paste is generateing output, but GNU cp, and busybox cp seem to handle it.

I know of --remove-destination option, and it works, but the way i am actually finally storing the buffer entries, is checking if the buffer file is modified, if modified, it handles the buffer. If i remove the file, the checker is thrown off.

My uutils package version is 0.0.29 from arch package, also tested 0.0.30, same behaviour.

here is a video demo showing how existence of previous stuff in file

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants