Re: [hackers] [sbase] cp: add -i flag || Thibaut Aubin

From: NRK <nrk_AT_disroot.org>
Date: Sun, 20 Apr 2025 07:47:49 +0000

On Sun, Apr 20, 2025 at 09:22:10AM +0200, git_AT_suckless.org wrote:
> + if (!confirm("overwrite '%s'? ", s2)) {
> + cp_status = 1;

I missed it when reviewing the fist time, but this, I'm pretty sure is
not correct. According to POSIX:

        https://pubs.opengroup.org/onlinepubs/9799919799.2024edition/utilities/cp.html#tag_20_24
        The following exit values shall be returned:
           0 All requested files (excluding files where a
        non-affirmative response was given to a request for
        confirmation) were successfully copied.
>0 An error occurred.

And so !confirm() must not count as an "error" return code. The earlier
version of the patch didn't modify `cp_status` which was the right
behavior.

- NRK
Received on Sun Apr 20 2025 - 09:47:49 CEST

This archive was generated by hypermail 2.3.0 : Sun Apr 20 2025 - 09:48:41 CEST