X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=2.2 required=5.0 tests=AWL,BAYES_00,BUG6152_INVALID_DATE_TZ_ABSURD,INVALID_DATE_TZ_ABSURD,L_SPAM_TOOL_13,TO_NO_BRKTS_PCNT X-Spam-Check-By: sourceware.org Date: Mon, 1 Aug 2011 16:12:54 +0159 From: Denis Excoffier To: cygwin AT cygwin DOT com Subject: Re: bash-4.2 and symlink to folder that turns to be not executable Message-ID: <20110801141318.GA1696@po8371> References: <20110801115922 DOT GA1124 AT po8371> <20110801122425 DOT GX26203 AT calimero DOT vinschen DOT de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110801122425.GX26203@calimero.vinschen.de> User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: 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 On Mon, Aug 01, 2011 at 02:24:25PM +0200, Corinna Vinschen wrote: >> >> However, at a first glance I doubt this is a Cygwin bug. Consider: >> >> - bash 4.1.10 returns "execut" >> - /bin/test from coreustils returns "execut" >> - My highly professional and streamlined testcase returns the correct >> result: >> >> #include >> #include >> #include >> #include >> >> void >> my_access (const char *file, int flag, const char *fname, int effective) >> { >> int ret = effective ? access (file, flag) : eaccess (file, flag); >> printf ("%saccess (%s, %s) = %d", >> effective ? "e" : " ", file, fname, ret); >> if (ret) >> printf (" <%s>", strerror (errno)); >> fputc ('\n', stdout); >> } >> >> int >> main (int argc, char**argv) >> { >> int eff; >> >> if (argc > 1) >> for (eff = 0; eff < 2; ++eff) >> { >> my_access (argv[1], F_OK, "F_OK", eff); >> my_access (argv[1], R_OK, "R_OK", eff); >> my_access (argv[1], W_OK, "W_OK", eff); >> my_access (argv[1], X_OK, "X_OK", eff); >> } >> return 0; >> } >> >> $ gcc -g -o access access.c >> $ ./access /tmp/xxx/folder >> access (/tmp/xxx/folder, F_OK) = 0 >> access (/tmp/xxx/folder, R_OK) = 0 >> access (/tmp/xxx/folder, W_OK) = 0 >> access (/tmp/xxx/folder, X_OK) = 0 >> eaccess (/tmp/xxx/folder, F_OK) = 0 >> eaccess (/tmp/xxx/folder, R_OK) = 0 >> eaccess (/tmp/xxx/folder, W_OK) = 0 >> eaccess (/tmp/xxx/folder, X_OK) = 0 >> >> Right, and me too. But if i replace in your testcase: eaccess(file, flag) with faccessat(0 /* not used if file is absolute */, file, flag, AT_EACCESS) (and also "e" : " " with " " : "f" for clarity) (and i have to include ) i obtain: % ./corinna++ /tmp/xxx/folder faccess (/tmp/xxx/folder, F_OK) = 0 faccess (/tmp/xxx/folder, R_OK) = 0 faccess (/tmp/xxx/folder, W_OK) = 0 faccess (/tmp/xxx/folder, X_OK) = -1 access (/tmp/xxx/folder, F_OK) = 0 access (/tmp/xxx/folder, R_OK) = 0 access (/tmp/xxx/folder, W_OK) = 0 access (/tmp/xxx/folder, X_OK) = 0 % (faccess is what i find in bash-4.2/lib/sh/eaccess.c) Is this under control? >> Corinna Denis Excoffier. -- 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