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:from:to:subject:date:message-id:references :in-reply-to:content-type:content-id:content-transfer-encoding :mime-version; q=dns; s=default; b=v7O1jeRqQ1dSy3dAzLFLjAFGCe8wg GoagGC5843mHhGO21CiV/JJlZNUCA4VCmH1HN9yI/bg7XoFIvqi4RXParpNsafiI j3nsmccgVUWAdO9qbdUAkpqooQW8OLDDnKXCM6FWnDfBoOG6Wn2hdtLFPIwacPai Xxu/5IZEL/mL4I= 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:from:to:subject:date:message-id:references :in-reply-to:content-type:content-id:content-transfer-encoding :mime-version; s=default; bh=Y7smce1QooF8zetd7Cic7F/yqog=; b=uDd bT0d2XNerMuHZppKznf4SIIrGKLBIazT+I7oKLLZZmXWVcSfA2/BCTGtVLENFfmM U2rC/JKuCBBmrTftrOzSvGtl/3ffwSH498Kfc+srhsZraUzUs4/vjyBtuYgxi09y JPxrrrCyh7tHT6Jb0qKrDYNuTS2+yr31LK4gU5HQ= 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 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Languages-Length:1607 X-HELO: NAM04-BN3-obe.outbound.protection.outlook.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VYrZyMgjcr9BUb6JbqaUfJF5KPZrj3/ERrm101GfS+yzajFAC7vVPcKIN9ScQ2KlKpC733Dn0UQCBfShNQTbnGeWYSOcFHCbzT04f/W875K/zSPFU+0IP3LZbz2h8ROL4W+P+q93eL/qQyX2PzOB4GNYr0g0VZz/5KDztUGlCNqFD0eevSdlJ21o2fV1cGr49yTAfYokddGuZiuGUaeN0XjlnDWrn8pBVypDdH1FwGdxToeSm8Q9LnCV8QpNzrY8mUZUZGEHx4nuMyc8wmnQ85x17NODdN3X8O0ncle/taFwrkTWEbLlovRj07St2ajnZigtASozXxyy4nblwN3U/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xp3VZuQyxQ2uzAcPFXrO0oP2lCgdpUiGmAu6XX7JL+U=; b=Am7wzZLdTspt33d/SlV42zLMwDAXHHvBaXcz063EpYRuSqG7/0V2BShydpcNi5//KLejbjKIX2QOnhrsK8StoLFOMtkEojhsbtzbXfv12oqqA1HeX50qYVCvBwghhgDg8M2XIoiQYh+Bxhv8a5FHybzm8QEdrVDMXyEMOzPY34lLmw+AHT5lFlZE6TWagRe6yf/uUOuIvldqyTsd8OxEeGyJ4CtMZ3ZovoXcVzUUxXWAV2YKVIZwceA39V4o0o4A3Q7cManvca/0uDs7ro6tn/oE5BQAOuUjwVOh90pF3Iziu2dd/UPPUID4wGrhRIi2HE27jf5CcUYKZZnVcn1srw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cornell.edu; dmarc=pass action=none header.from=cornell.edu; dkim=pass header.d=cornell.edu; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cornell.edu; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xp3VZuQyxQ2uzAcPFXrO0oP2lCgdpUiGmAu6XX7JL+U=; b=TSwVxNotyjFzUixjVvKPRMUp1nne+u21KxiSAQBw9VPdXxaw1Oz/NzlreuoO2517IW5qGsaZ2vLW2IA/9oKMVAwCfQ/ojDXKyEQ4+yXqCZGX4pk95CJqsUnOApQSXhTtVrGIHC/gk9t9TIxlGMIy2jx8m5NSFGnLZ3pEPy3sY+U= From: Ken Brown To: "cygwin AT cygwin DOT com" Subject: Re: Empty file without "x" permission is successfully executable on Cygwin Date: Tue, 6 Aug 2019 03:19:22 +0000 Message-ID: <8378710e-4533-ee50-0e31-7714982eec0d@cornell.edu> References: <7d007c9f-e98d-f497-d706-dbf94bb563f2 AT towo DOT net> <319f78d5-fbcd-712a-ba27-137bd1fbd439 AT cornell DOT edu> In-Reply-To: <319f78d5-fbcd-712a-ba27-137bd1fbd439@cornell.edu> user-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 authentication-results: spf=none (sender IP is ) smtp.mailfrom=kbrown AT cornell DOT edu; x-ms-oob-tlc-oobclassifiers: OLM:8273; received-spf: None (protection.outlook.com: cornell.edu does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="utf-8" Content-ID: <100A369DCE2E1B4F81281B3A68E63B25 AT namprd04 DOT prod DOT outlook DOT com> MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ksb2 AT cornell DOT edu X-IsSubscribed: yes Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id x763KPq5025642 On 8/5/2019 4:39 PM, Ken Brown wrote: > On 8/5/2019 4:19 PM, Thomas Wolff wrote: >> >> Am 05.08.2019 um 22:01 schrieb Ken Brown: >>> On 8/5/2019 2:18 PM, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin wrote: >>>> Hi, >>>> >>>> Please consider the following shell session: >>>> >>>> $ cat dummy.c >>>> #include >>>> >>>> int main() >>>> { >>>>       return 0; >>>> } >>>> $ gcc -o dummy dummy.c >>>> $ mv dummy.exe dummy >>>> $ ./dummy >>>> $ echo $? >>>> 0 >>>> $ chmod a-x dummy >>>> $ ./dummy >>>> -bash: ./dummy: Permission denied >>>> $ rm dummy >>>> $ touch dummy >>>> $ ./dummy >>>> $ echo $? >>>> 0 >>>> >>>> So Cygwin lets the shell to execute a zero-sized file regardless of the "x" perm >>>> (non-empty files are not executable if they do not have "x", as shown above). >>> I can't reproduce this on my system.  Can you show the permissions and ACL of >>> dummy? >>> >>>> There's more.  If I put some rubbish in a file, Cygwin still tries to execute >>>> it even if the "x" is not there: >>>> >>>> $ rm dummy >>>> $ echo "1" > dummy >>>> $ ./dummy >>>> ./dummy: line 1: 1: command not found >>> Again I can't reproduce this. >> I reproduce the behaviour: >> > echo echo foo > bar >> > ls -l bar >> -rw-r--r-- 1 towo None 9  5. Aug 22:18 bar >> > ./bar >> foo > > You're right. I was careless in my test. Sorry for the noise. It look like what's happening is that bash calls execve(), which returns with errno ENOEXEC instead of EACCES. I'll look at this more tomorrow unless someone beats me to it. Ken -- 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