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:message-id:date:from:mime-version:to:subject
	:references:in-reply-to:content-type; q=dns; s=default; b=gcZgoB
	muY8/RrbrKb1gBN9zbsbBgn5BX9Vw5e6WAWm5TRvgZHUdqV6k/k0LoZBi6PR9zDe
	7KC6IPeDVv1UeFZVSDqm8T6y3rtLrWH/5GCgzkMe1wv8wXF1RTIigir5g6hpvpv7
	puIjz2viE2nN/lTC940Qt/M1Ny91NBpnsFakM=
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:message-id:date:from:mime-version:to:subject
	:references:in-reply-to:content-type; s=default; bh=XhdjMihrHYtC
	ntTkxOUYbUb4ysc=; b=W8vwJguItaEBM9ZMEi1Pf9kJp3xyWRy75FUJTTvD6UwF
	lSrWxRbEJG1pkzJ6ARHalBJ7ry4znpATbG0ssMh35Iv+eumQ2KZ1JB35JDYjiWWV
	QFlIIei5Dv0e/vkK29xIYA2fi6FGUcH9YI5HEhXdyfFyF2yjvF7COOVVq1OEUZU=
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-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2
X-HELO: mx1.redhat.com
Message-ID: <54DA411E.3040700@redhat.com>
Date: Tue, 10 Feb 2015 10:34:22 -0700
From: Eric Blake <eblake@redhat.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: /dev/tty does not work from shell
References: <54DA31C1.9060406@redhat.com> <54DA32D9.5070909@redhat.com> <20150210174647.7760EAC0.helmut.karlowski@ish.de>
In-Reply-To: <20150210174647.7760EAC0.helmut.karlowski@ish.de>
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="j3RFLUd1au56tQSFasGERiJKExLOARMsU"
X-IsSubscribed: yes

--j3RFLUd1au56tQSFasGERiJKExLOARMsU
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 02/10/2015 09:46 AM, Helmut Karlowski wrote:
>> The same test from the command line:
>>
>> $ stat -c %i /dev/tty - 0>/dev/tty
>> 327680
>> 8912896
>>
>> use any other (already-existing) file to see that the two numbers should
>> normally be the same.
>=20
> Don't know why, but cygwin is not the only OS that does that. I'd=20
> suggest to check for terminal or something.

Umm, what other OS changes the inode from what you called stat() on to
what you open()d?  Okay, there are some special device files like
/dev/ptmx that intentionally create a new device (and therefore new
inode) every time it is opened, but is /dev/tty in that boat?  POSIX
requires /dev/tty to resolve to the process's controlling terminal.

If there _are_ other OS that change the inode of the fd returned by
opening /dev/tty, that argues that any change in bash to special-case
/dev/tty should be made upstream, so I'm reluctant to write a
cygwin-specific bash patch.  If there aren't other OS that change the
inode of /dev/tty, then it's better to figure out how to patch
cygwin1.dll to be more like Linux.

--=20
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


--j3RFLUd1au56tQSFasGERiJKExLOARMsU
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJU2kEeAAoJEKeha0olJ0NqaIQH/14G18FG1g395V3m822WuRhF
bq+ydlu5tAp9Mhuzo42lep0XJv02RSg4Aqp1An2XlkohCiZPh5fRUqv/Welr3etF
vFUvAX8inIVsOXfYsLjlVo4lX2Zb1uP/rANuaMrj9ImfFzabD4XV4NlDGMkhGrBr
9PDGec3twI2DYRS1LqNlOBcdk/iWUX9Q1lr8C8WiRGJHHUxl9stCfFVtQnHHn9OW
I0b3s9O800+8/dnAh1JIQ1KfLEqS7GIscDi3qdQxW9lS0zzHRzygtpU/LG1eN15u
obyNK5Mw9ZKG6ZngAvqfgkDPIf3iKQx/pl7Ps1qKTXFzI9ETKjBz5EVlxE0lrwA=
=PW9G
-----END PGP SIGNATURE-----

--j3RFLUd1au56tQSFasGERiJKExLOARMsU--
