This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Empty file without "x" permission is successfully executable on Cygwin
- From: Ken Brown <kbrown at cornell dot edu>
- To: "cygwin at cygwin dot com" <cygwin at cygwin dot com>
- Date: Mon, 5 Aug 2019 20:01:26 +0000
- Subject: Re: Empty file without "x" permission is successfully executable on Cygwin
- 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
- 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=ZgdtbZTYoV46vcf7+8Bcs1kmY8uVqdyZwXz4QCzPuuo=; b=QMBNJtKiI+PpcqkHJ7lK7qA/EYfv8uED/8DKdPV+apx42RciPOkAhjkaSRKQrS2fllowLjucg4sjlmBC6WB/M7G0CORkWdKF1xKXiFvXpG9SBCPMSqpScORItegHhAWGPNxaCORUEY0j44VIGorFFTTOHG1KevQ2wq/4br46eWdbvq2PTxqiC1hMkvhZY41nVit6BzYXXbzMYeUb9xG33cbyJ1cSIQ/Tg9DZ3X1+yO9k5AfF+lVGNspmsWmx+FaPviEtDsR44jTubseCsnH2Z3Jl2CbNjOh74FjNK774fwOcBQGcR/xmHgLmXPcQ5v++C64FQaM9pNNGlrCUj7D7Xw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k0NrKO9FVAq7wwaROXSRw7pJVus+TApsyI5NYwKHDsxiOuPbEEvEnd83FNU9sV8DG0418HkQ6XZ7tqCQ/XyKVgnxN/nycyjITeMZlciRNspfas8HzNy0N0aAQ55IjQq2azjYlRXUyD1tXtuMEMyUzaTJ1SOuQqvh62Bmi2fk3HlGBvofMS9BO8EkOEYCBElJ7DxrUvpkvtbq4n9p/DWGX4CNtgp0hc8RCR58yuxEXPvkeyXPh7UtDzGAYhBEByyTx/qJCTN63HrU5ciQQvcezASCPV6darHpd4utMrmol/E5c4KrHLWvqVhuQXrxbIUCO5/0cMNutz2RYT5PRr/RxA==
- References: <BL0PR0901MB43081893EE588BDED05886BFA5DA0@BL0PR0901MB4308.namprd09.prod.outlook.com>
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 <stdio.h>
>
> 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.
Ken