| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:subject:to:references:from:message-id:date | |
| :mime-version:in-reply-to:content-type | |
| :content-transfer-encoding; q=dns; s=default; b=pGeN3kRLTwNYT12z | |
| iXdOSEhRSZwMJKP28KiJGCX7cJCpB47Swm6Sy7q/vPdSW75NWsxOLJi0IicRUoKt | |
| rUFsFHieaGXvOtgn/N6jF30GVOUKSoyGIShKzDs4I+3+aVXWaN1XmDHCjRkmyFcN | |
| +rhQzuGeU7+qS2M9SVprBJtOhCA= | |
| DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:subject:to:references:from:message-id:date | |
| :mime-version:in-reply-to:content-type | |
| :content-transfer-encoding; s=default; bh=vFPeDAVqGtEghx+Xw7h5En | |
| plTDE=; b=AM7qaV7c6qC2gw2RW3wHMFRUWvkykx95Ka0NbP7Sxl12s0gunlDPcZ | |
| dlsnb5sSfwGM85bczHySUWM2yok+PZryFUmf72vjn8KbrbvWdMbCnQVAzu3IawpS | |
| 9SRwon1evaJ9wyIsOv6rPWVCgsBnvCAwqlpZF3c9lHr6GWynSJwhQ= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Authentication-Results: | sourceware.org; auth=none |
| X-Spam-SWARE-Status: | No, score=-11.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= |
| X-HELO: | mx1.redhat.com |
| Subject: | Re: Fun with cp -R error when both foo and foo.exe exist |
| To: | cygwin AT cygwin DOT com |
| References: | <CAPF-yObTngOGu_+TSfSQo4bpi_tJ3572r_26cfidLZ5QpcPGYQ AT mail DOT gmail DOT com> <f00936b7-cc2a-1a2c-7862-c79e10bed95d AT gmail DOT com> <02c12d6e-cc18-89af-db83-1813cc8f0c97 AT redhat DOT com> <CAPF-yObUNPRE_xrnroc_rZHqPHGUGmzMKZXnT5ZrpLm2YCzW-g AT mail DOT gmail DOT com> |
| From: | Eric Blake <eblake AT redhat DOT com> |
| Message-ID: | <c527de20-dc20-53a7-67eb-430f7a0c1b4f@redhat.com> |
| Date: | Tue, 9 Oct 2018 11:52:52 -0500 |
| User-Agent: | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 |
| MIME-Version: | 1.0 |
| In-Reply-To: | <CAPF-yObUNPRE_xrnroc_rZHqPHGUGmzMKZXnT5ZrpLm2YCzW-g@mail.gmail.com> |
| X-IsSubscribed: | yes |
On 10/9/18 11:21 AM, Dan Kegel wrote:
> On Tue, Oct 9, 2018 at 5:03 AM Eric Blake <eblake AT redhat DOT com> wrote:
>> whether someone patches the cygwin dll or cp, it seems like some rather
>> hairy code for what is normally a rare corner case, so it probably won't
>> happen unless someone actually contributes a patch.
>
> Right. Here's a completely untested guess patch:
>
> --- a/winsup/cygwin/syscalls.cc
> +++ b/winsup/cygwin/syscalls.cc
> @@ -1363,7 +1363,15 @@ open (const char *unix_path, int flags, ...)
> opt |= PC_CTTY;
> }
>
> - if (!(fh = build_fh_name (unix_path, opt, stat_suffixes)))
> + suffix_info *suffices = stat_suffixes;
suffices is a completely different word; did you mean suffixes?
> + if ((opt & (O_WRONLY|O_BINARY)) == (O_WRONLY|O_BINARY))
O_WRONLY need not be a bitmask; it's better to use O_ACCMODE for the
bitmask, as in
opt & (O_ACCMODE|O_BINARY) == O_WRONLY|O_BINARY
> + {
> + /* Hack so 'cp foo bar' doesn't abort with
> + 'cp: cannot create regular file bar: File exists'
> + if bar.exe already exists */
> + suffices = NULL;
> + }
> + if (!(fh = build_fh_name (unix_path, opt, suffices)))
So, with mistakes corrected, your hack is that cygwin doing auto-suffix
probing should be suppressed in the case of opening a file O_WRONLY? Why
does O_BINARY have to fit in the equation?
> __leave; /* errno already set */
> if ((flags & O_NOFOLLOW) && fh->issymlink ())
> {
>
> Feel free to throw rotten fruit :-)
>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |