bug#61767: install: options --compare (-C) and --preserve-timestamps are mutually exclusive

Pádraig Brady <[email protected]> Wed, 4 Mar 2026 18:44:23 +0000
Newsgroups gmane.comp.gnu.core-utils.bugs
Message-ID <[email protected]>
On 04/03/2026 18:39, Collin Funk wrote:
> Pádraig Brady <[email protected]> writes:
> 
>> On 04/03/2026 04:53, Collin Funk wrote:
>>> Pádraig Brady <[email protected]> writes:
>>>
>>>>> Here is a proposed patch that allows the options to be used
>>>>> together.
>>>>
>>>> It's best not to set timestamps in two places.
>>>> Could we adjust copy_file to return OK,FAIL,SKIP enum
>>>> and then adjust the conditionals in install_file_in_file() ?
>>>>
>>>> Also we could add a line to the test to be more robust:
>>>>
>>>>     echo a > a || framework_failure_
>>>>     echo a > b || framework_failure_
>>>>     touch -d 2026-01-01 a || framework_failure_
>>>>     test b -nt a || framework_failure_   # Handle systems with bad time
>>> Good ideas. I've attatched a v2 patch that makes those changes. Will
>>> push tomorrow.
>>
>> The strip is now conditional on COPY_OK.
>> That would be a change in behavior.
>> A user might rerun install with -Csp to strip.
>>
>> With that adjustment it looks good to push.
> 
> My rationale for putting that was because -C and -p cannot be used
> together:
> 
>      if (copy_only_if_needed && strip_files)
>        {
>          error (0, 0, _("options --compare (-C) and --strip are mutually "
>                         "exclusive"));
>          usage (EXIT_FAILURE);
>        }

Ah right!

> I don't see the point of that limitation, but figured it was best to
> change separately.
Well I suppose if the strip was done then a subsequent compare would not match.
So they're competing options in a way. I.e. I'd be less inclined to
allow that combination.

OK to push as is.

thanks!
Padraig