Skip to content

cp is is not properly cleaning existing file #7885

@sga-13

Description

@sga-13

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions