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: Tue, 6 Aug 2019 19:35:43 +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=OwKYOwL0ivlFU/3mKszM/xracqzohpl6qdy4qvQpY9I=; b=AxvNT2FTwmR2C8SEZ3wKu/Xh9JPc5+Dy0M/tx+PvX9uUISNa4y9Up+Iq/4OpqZa9KOKHXYuYUhW38cBz6G68WqoA6SPuwB2UFS6k5VybBjO2SfBeRGQk3YHquSCHfYX6eXgmV/PHceFBM55NyfqTmEM+LtRIqMYdY0I8Y/exLTLYBHcdDBFHdX+MPpLKgk9NVGirntbg1pK/KpeZ5UapUhXlGlv84gE5WWRAU0oSjNfx2FUGtecxUPme5QJxEUf+AN3/3S/VGyvRM8G7E1JUh8Oyl1LlMYUHi+pZcbH+3lqLZbfWYfzDHaWbQE7hsAAK0M+hwzqOhOKuPdWOAEKmjg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L5MY5BPGrVWuFIpNSKysK473tZbKjBCGXWEajQDzUvsBcSz4f28dGDh4rb/6GZjyvLhM6xJMZgax8dPIPxoaTykOV5zuccCIiJdGBW1PUWPx5PE7DYAEvi+zhz0R+RKjUgxtY7Hs0DZGg8BcYMWrwsT5T+1BG8o9o+eR3D625dpzlVJiozpYGJC7yH4EBeY+h3lANvpkQzWdAR8Tfcs1NVXBCQt5pfgc6E740JTvZbO6yW3+iv289ho/edenwxwkBFki85tPUli/Z3QwMESnwZS0m07ihJqOFZQWb2wCuu8a4jy+G4HwpVIfk2Ih0gNqDkjDV8WrZvOCbLHT7hfuyw==
- References: <BL0PR0901MB430826D79AF2771A6A5C2A99A5D50@BL0PR0901MB4308.namprd09.prod.outlook.com>
On 8/6/2019 3:09 PM, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin wrote:
>> zero-sized? Irrelevant.
>
> It is actually very relevant. Because executing an empty script results in "success" (exit code 0) -- that creates a false-positive.
You were absolutely right on your first complaint, that Cygwin allows a script
without execute permission to be executed. Corinna has already fixed that:
https://cygwin.com/git/gitweb.cgi?p=newlib-cygwin.git;a=commit;h=98669a24760a84bfef498fedeef7fa7ecc518e6c
But what's your basis for saying that an empty script shouldn't be executable?
As long as it has execute permission, you're asking the shell to do nothing. It
happily does nothing and reports success.
It works that way on Linux also:
$ touch dummy
$ chmod +x dummy
$ ./dummy
$ echo $?
0
Ken