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

From: Roberto E. Vargas Caballero <k0ga_AT_shike2.net>
Date: Sun, 20 Apr 2025 22:15:18 +0200

Hi,
`
On Sun, Apr 20, 2025 at 07:47:49AM +0000, NRK wrote:
> 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.

Good catch, I missed that too. As you discover the issue, do you want
to create the patch to get authorship?

Related to cp -i, we don't have rm -i, so we can extend the usage of confirm
to rm easily now.

Regards,
Received on Sun Apr 20 2025 - 22:15:18 CEST

This archive was generated by hypermail 2.3.0 : Sun Apr 20 2025 - 22:24:38 CEST