From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 103437 invoked by alias); 9 Oct 2018 12:03:12 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 103428 invoked by uid 89); 9 Oct 2018 12:03:12 -0000 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 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 09 Oct 2018 12:03:02 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7F32AC062ECA for ; Tue, 9 Oct 2018 12:03:01 +0000 (UTC) Received: from [10.10.123.54] (ovpn-123-54.rdu2.redhat.com [10.10.123.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3221D75559 for ; Tue, 9 Oct 2018 12:03:00 +0000 (UTC) Subject: Re: Fun with cp -R error when both foo and foo.exe exist To: cygwin@cygwin.com References: From: Eric Blake Message-ID: <02c12d6e-cc18-89af-db83-1813cc8f0c97@redhat.com> Date: Tue, 09 Oct 2018 12:03:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-10/txt/msg00076.txt.bz2 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