delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/10/09/08:03:23

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=n8wEj8SjW1aOlG2B
t1pTk0A5k+R375Hwvvtcj5kLixaeAHUA4/ZUH9yWON5uIaaDLXi01atybYOXTFcA
BfRNFBXtU09XSUnLnoaDKufQ7Py8up0El4+bVvo2CfGlGxcjxsUs1yh2li2Cvh4U
4q3KKI53C1eBSEsQ4e8w3efPHBc=
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=4YTVoATls1lZHfbt1GN/iH
8bzkc=; b=IlL9S6B2jmxjLHLUQ3ToLQDunz2MPdqpbexuPwxw1r7mJZAxdbUJry
HuB2+fQmJkl1zx68dqH2X1C88JfHxdTBDizYzZqalLebHk1LbjmVtTA+s1GZ1CNN
wY883j68Oo++IxirYlWN9bF93lQ/WO3/PyhWcnZLFfdKtW819foZk=
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=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Kegel, kegel, marco, smarter
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>
From: Eric Blake <eblake AT redhat DOT com>
Message-ID: <02c12d6e-cc18-89af-db83-1813cc8f0c97@redhat.com>
Date: Tue, 9 Oct 2018 07:02:59 -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: <f00936b7-cc2a-1a2c-7862-c79e10bed95d@gmail.com>
X-IsSubscribed: yes

On 10/9/18 1:22 AM, Marco Atzeri wrote:
> Am 08.10.2018 um 23:24 schrieb Dan Kegel:
> 
>>
>> A nice workaround might be for the cygwin version of cp could arrange
>> to wait to create .exe files until after any potential non-suffixed
>> file has been processed... not sure how easy that would be.
>>
>> Apologies if this has already been discussed.
>> - Dan
> 
> it is not cp handling the magic, but the cygwin dll.

Mostly the cygwin dll, but cp itself DOES have some cygwin-specific 
downstream patches to try and behave smarter.  At any rate, POSIX 
requires cp to handle command line arguments in the order given, but 
does not require recursion to copy in any specific order for files 
within a directory.  But the order that makes the most sense is the 
order that readdir() returns things, because any other order requires 
sorting the files (and thus the memory to track the files) and a longer 
window for races to occur with anything else changing directory contents 
in parallel.  Perhaps you could even argue that readdir() should visit 
'foo' and 'foo.exe' in a particular order, no matter whether the native 
ordering would display them in the opposite order.  But in general, 
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.

-- 
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019