GNU bug report logs - #73865
cp 9.1+ fails to overwrite existing files even with -f under Cygwin

Previous Next

Package: coreutils;

Reported by: Brian.Inglis <at> SystematicSW.ab.ca

Date: Fri, 18 Oct 2024 16:48:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 73865 in the body.
You can then email your comments to 73865 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#73865; Package coreutils. (Fri, 18 Oct 2024 16:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Brian.Inglis <at> SystematicSW.ab.ca:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Fri, 18 Oct 2024 16:48:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Brian Inglis <Brian.Inglis <at> SystematicSW.ab.ca>
To: bug-coreutils <at> gnu.org
Cc: Eric Blake <eblake <at> redhat.com>
Subject: cp 9.1+ fails to overwrite existing files even with -f under Cygwin
Date: Fri, 18 Oct 2024 10:47:02 -0600
[Message part 1 (text/plain, inline)]
Hi folks,

Versions of coreutils cp from 9.1-9.5 have been failing with error message:

	"cp: cannot create regular file '/tmp/b/c': File exists"

to overwrite existing files even with -f under Cygwin.

I have been trying to run down how and where cp is missing a check that the file 
exists by tracing and with gdb without anything obvious grabbing my attention 
and raising suspicions.

Any advice for changing my approach, or where specifically to concentrate, could 
be helpful in progressing a new release.

A couple of Cygwin specific patches have been applied over many releases with 
rebases to root inode handling and allowing case insensitivity that do not 
appear to have had any other effect on the flow or operations.

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                -- Antoine de Saint-Exupéry
[cp-9.1-fails-file-exists.sh (text/plain, attachment)]
[cp-9.1-fails-file-exists.log (text/plain, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#73865; Package coreutils. (Fri, 18 Oct 2024 17:33:01 GMT) Full text and rfc822 format available.

Message #8 received at 73865 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Brian.Inglis <at> SystematicSW.ab.ca, 73865 <at> debbugs.gnu.org
Cc: Eric Blake <eblake <at> redhat.com>
Subject: Re: bug#73865: cp 9.1+ fails to overwrite existing files even with -f
 under Cygwin
Date: Fri, 18 Oct 2024 10:32:07 -0700
On 2024-10-18 09:47, Brian Inglis wrote:
> Hi folks,
> 
> Versions of coreutils cp from 9.1-9.5 have been failing with error message:
> 
>      "cp: cannot create regular file '/tmp/b/c': File exists"
> 
> to overwrite existing files even with -f under Cygwin.

What does strace say?




Information forwarded to bug-coreutils <at> gnu.org:
bug#73865; Package coreutils. (Tue, 29 Oct 2024 18:43:01 GMT) Full text and rfc822 format available.

Message #11 received at 73865 <at> debbugs.gnu.org (full text, mbox):

From: Brian.Inglis <at> SystematicSW.ab.ca
To: Paul Eggert <eggert <at> cs.ucla.edu>, 73865 <at> debbugs.gnu.org
Cc: Eric Blake <eblake <at> redhat.com>
Subject: Re: bug#73865: cp 9.1+ fails to overwrite existing files even with -f
 under Cygwin
Date: Tue, 29 Oct 2024 12:42:45 -0600
On 2024-10-18 11:32, Paul Eggert wrote:
> On 2024-10-18 09:47, Brian Inglis wrote:
>> Hi folks,
>>
>> Versions of coreutils cp from 9.1-9.5 have been failing with error message:
>>
>>      "cp: cannot create regular file '/tmp/b/c': File exists"
>>
>> to overwrite existing files even with -f under Cygwin.
> 
> What does strace say?

Thanks Paul,

That made me think to redo and reread the straces and I noticed that the 
basename was being accessed in the builddir, as patches were now accessing the 
basename not the realpath, so mea culpa!

That required a bunch of rebasing patches, and that now appears to work.

However, I now appear to have the issue that the Cygwin emulated "root" is not 
being detected and handled properly, so during tests, chgrp/chown/chmod 
--preserve-root is being ignored, also presumably rm!, tests are taking forever, 
and all my account and CI system mount points are being trashed by the tests, 
and build/gt-preserve-root.sh.XKPb/out is over 1GB!

I take it that should go into a different bug report, as I need to understand 
whether any access to "root" is just warned and skipped, or the command is 
terminated with prejudice.

The info docs section "Treating ‘/’ specially" appears to be ambiguous about the 
ch??? commands, whereas the man pages say "fail to operate recursively on ’/’".

Cygwin would probably want to default these commands to --preserve-root like rm, 
and also require -f --force to override, but ch??? redefine -f to --silent --quiet!

-- 
Take care. Thanks, Brian Inglis              Calgary, Alberta, Canada

La perfection est atteinte                   Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter  not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer     but when there is no more to cut
                                -- Antoine de Saint-Exupéry




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Tue, 29 Oct 2024 21:25:02 GMT) Full text and rfc822 format available.

Notification sent to Brian.Inglis <at> SystematicSW.ab.ca:
bug acknowledged by developer. (Tue, 29 Oct 2024 21:25:02 GMT) Full text and rfc822 format available.

Message #16 received at 73865-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Brian.Inglis <at> SystematicSW.ab.ca
Cc: 73865-done <at> debbugs.gnu.org, Eric Blake <eblake <at> redhat.com>
Subject: Re: bug#73865: cp 9.1+ fails to overwrite existing files even with -f
 under Cygwin
Date: Tue, 29 Oct 2024 14:24:12 -0700
On 2024-10-29 11:42, Brian.Inglis <at> SystematicSW.ab.ca wrote:
> I take it that should go into a different bug report

OK, I'll follow up there <https://bugs.gnu.org/74094> and will close 
this bug report.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 27 Nov 2024 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 263 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.