X-Recipient: archive-cygwin@delorie.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:date:from:reply-to:message-id:to:subject
	:in-reply-to:references:mime-version:content-type
	:content-transfer-encoding; q=dns; s=default; b=RU6jFC5LxVwWobGP
	CGJZuJRJATu2S/xxiCYgJ8K+IqOv1aGTleTVjLY/296JkkpJsMa6hkjMCMImAN0v
	ImTllQFSqKDU8XVyb//4lc8m8V53GTF4aVv3xZzfG0njPzzEimlv1XZhHt+UHEYp
	mteoe8Vus81tF+Dyqvt27hE6h/Q=
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:date:from:reply-to:message-id:to:subject
	:in-reply-to:references:mime-version:content-type
	:content-transfer-encoding; s=default; bh=Sqtu/2aOeySbskZH0aHqGL
	BTpEQ=; b=fPn49B3bKK5mSEOGx/T6HdCQ8ROE5RvI6YTzUp4bIbl/v2eTc8n1Hf
	Uo8mMBf3bQttG9QeJ7O2qh6EqnO18rQais3bTXNOHd3beT+pNYN2l43MuCTKInQ9
	28Yz1wYxZB53I0mE1Zka4AxbXBrJTnElPNb3wuQKibfsE/n8z/79A=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=2.0 required=5.0 tests=BAYES_50,FREEMAIL_FROM,KAM_THEBAT,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 spammy=H*RU:192.168.1.10, H*r:ip*192.168.1.10, Hx-spam-relays-external:192.168.1.10, penny
X-HELO: forward103j.mail.yandex.net
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1545604503;	bh=VCYMdcWhDfFqlgtlUW3K0OwUxH2FiN0xa9KksEuo9qo=;	h=Date:From:Reply-To:Message-ID:To:Subject:In-Reply-To:References;	b=ukd2XZgwjR8guZMLKiyjkJ30xkMXXs/yOYjIzVuLZJ/rFyCHa2VT0ra4aK5WU/YBx	 OeRtNCiKdHZudsZFyOdkzCsdnmFhApxYbH6ZnhcEEe969KLC2AePxwMle4oLoxOX1F	 sCyviW56lJ64j2rDjwuk3fQZ0NKgWR8mmvqbfaUs=
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1545604502;	bh=VCYMdcWhDfFqlgtlUW3K0OwUxH2FiN0xa9KksEuo9qo=;	h=Date:From:Reply-To:Message-ID:To:Subject:In-Reply-To:References;	b=mhxtBlmV2jYDiilTt4yTUpox0XfM4JZMS8ebCc5aKq/q8aGQQa6hyuPtLwQhsJ8Fv	 o0aqogjmvexzR8jYpKpF8NI64xxD+w6nkwDMUtrX5ai/WRH7nCh6xENYDBmqJVH6Mj	 X7/36N1FSQ9z/o6fNp3F/osbIdO9fGBBs0VVocnE=
Authentication-Results: smtp3o.mail.yandex.net; dkim=pass header.i=@yandex.ru
Date: Mon, 24 Dec 2018 01:20:01 +0300
From: Andrey Repin <anrdaemon@yandex.ru>
Reply-To: cygwin@cygwin.com
Message-ID: <1515955633.20181224012001@yandex.ru>
To: Steven Penny <svnpenn@gmail.com>, cygwin@cygwin.com
Subject: Re: "test" producing unexpected results after "chmod"
In-Reply-To: <5c1f242b.1c69fb81.2721c.076d@mx.google.com>
References: <5c1f242b.1c69fb81.2721c.076d@mx.google.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

Greetings, Steven Penny!

> With Linux, these commands produce expected results:

>     $ cd /tmp
>     $ touch alpha.txt
>     $ test -r alpha.txt; echo "$?"
>     0
>     $ chmod -r alpha.txt
>     $ test -r alpha.txt; echo "$?"
>     1
>     $ chmod +r alpha.txt
>     $ test -r alpha.txt; echo "$?"
>     0

> However with Cygwin, unexpected results are produced:

>     $ cd /tmp
>     $ touch alpha.txt
>     $ test -r alpha.txt; echo "$?"
>     0
>     $ chmod -r alpha.txt
>     $ test -r alpha.txt; echo "$?"
>     0

> It seems Cygwin is not able to produce non-readable files.

It's not Cygwin, it's test, like many other programs in this case, make false
assumptions on file readability/writability based on their interpretation of
file permissions.

The only true test for readability is to open file for reading.
The only true test for writability is to open file for writing.
Successfully.

The rest is merely a guesswork.


-- 
With best regards,
Andrey Repin
Monday, December 24, 2018 1:17:48

Sorry for my terrible english...


--
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

