X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=1.6 required=5.0 tests=AWL,BAYES_00,BOTNET X-Spam-Check-By: sourceware.org Message-id: <4B8D47F7.7050000@acm.org> Date: Tue, 02 Mar 2010 09:16:39 -0800 From: David Rothenberger User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.8) Gecko/20100216 Thunderbird/3.0.2 MIME-version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Cygwin's svn appends unwanted .exe to file name on checkout References: <4B8BFD4A DOT 6060609 AT acm DOT org> <20100302100035 DOT GO8799 AT trikaliotis DOT net> <4B8CE986 DOT 2040805 AT Gymel DOT com> <20100302115813 DOT GJ5683 AT calimero DOT vinschen DOT de> In-reply-to: <20100302115813.GJ5683@calimero.vinschen.de> Content-type: multipart/mixed; boundary=------------010400080609090504060105 X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com --------------010400080609090504060105 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 3/2/2010 3:58 AM, Corinna Vinschen wrote: > The .exe suffix is added if all of the below is true: > > - The file is renamed via the rename(2) function. > - The name does not only change by case on a caseinsensitive mount. > - The file is a binary checked with the Win32 function GetBinaryType, > and the returned type is SCS_32BIT_BINARY or SCS_64BIT_BINARY. > - The source filename has none of the following suffixes: > .com > .dll > .exe > .scr > .sys > - The destination filename has none of the aforementioned suffixes. All these conditions are true in the svn test case. svn is renaming tst/tempfile.tmp to tst/notepad.xxx using libapr1, which is using rename(2). It does seem that the ACLs on the directory and file play a role, too. I've attached a reproduction script along with a simple rename(2) driver program. The script explicitly removes the default group ACLs from a directory before doing a rename(2) in that directory. In that case, no .exe suffix is added. If you modify the top of the script to set "SETACLS=set", it will add default group ACLs of rwx and the .exe suffix is added. I'm not sure if this points to a bug in Cygwin or not. It does explain why Alan and I were seeing different behavior. Regardless, it doesn't seem like rename(2) will be changed to avoid adding the .exe suffix, so either we live with this behavior in svn or I need to patch libapr1 to do a rename without triggering this behavior. I tried using renameat(2) but that (unsurprisingly) also triggers the behavior. Is there some sanctioned way to do a rename without triggering the .exe suffix addition? -- David Rothenberger ---- daveroth AT acm DOT org Alden's Laws: (1) Giving away baby clothes and furniture is the major cause of pregnancy. (2) Always be backlit. (3) Sit down whenever possible. --------------010400080609090504060105 Content-Type: text/plain; name="tstren.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="tstren.c" #include #include int main (void) { int retval; retval = rename("tst/tempfile.tmp", "tst/notepad.xxx"); if (retval != 0) { fprintf(stderr, "%s\n", strerror(retval)); return retval; } return 0; } --------------010400080609090504060105 Content-Type: text/plain; name="reproduce.sh" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="reproduce.sh" #!/bin/bash SETACLS=clear #SETACLS=set rm -fr tst mkdir tst if [ -n "$SETACLS" ]; then for g in $(id -G); do if [ "$SETACLS" = "clear" ]; then setfacl -m d:g:$g:0 tst elif [ "$SETACLS" = "set" ]; then setfacl -m d:g:$g:rwx tst fi done fi getfacl tst # Don't copy notepad.exe because that will preserve the file's ACLs # and will cause the .exe suffix to be added regardless of the # directory's ACLs. cat "$(cygpath -Wua)"/notepad.exe > tst/tempfile.tmp getfacl tst/tempfile.tmp ls -l tst ./tstren ls -l tst --------------010400080609090504060105 Content-Type: text/plain; charset=us-ascii -- 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 --------------010400080609090504060105--