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:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=P6AuA4iNmKMOoxlFpdqDf2xd81Br6CN6tHmTcxy/c2nQQdaFUTV0Z Hqd+U0zhLz9WJCIpr6+ZFiG7MjJe1q3MxZEHxnNrls88UYqbEjcoyWNTSd62SWWX 4boi28e6Ihw8Q0V5ovXHAd/BKAl7hOGauophnFd7zzfw9tPbdLUlDM= 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:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=18HYLoY+uncqxGpzCUyUMy75KzQ=; b=um1QkRCdw5ukLESDiA5WEkSmxb3M FlNrkgaWZSzi+JqfK7GoOa5DHFVOGvub4ohe4edpG0d2GFtvobE747KwbGLusUVM K7zOTEcHbVdL8cB0BiKrLQg7TQcykPI6WuUAMrN4JzGr+6Du9pX99IntOvA4m6mn IagBQxGAlAKCBGw= 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-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: calimero.vinschen.de Date: Tue, 10 Feb 2015 19:26:45 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: /dev/tty does not work from shell Message-ID: <20150210182645.GE2866@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <54DA31C1 DOT 9060406 AT redhat DOT com> <54DA32D9 DOT 5070909 AT redhat DOT com> <20150210174647 DOT 7760EAC0 DOT helmut DOT karlowski AT ish DOT de> <54DA411E DOT 3040700 AT redhat DOT com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/3yNEOqWowh/8j+e" Content-Disposition: inline In-Reply-To: <54DA411E.3040700@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) --/3yNEOqWowh/8j+e Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Feb 10 10:34, Eric Blake wrote: > 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 shou= ld > >> 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. >=20 > 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. >=20 > 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. That's that. The other is that the way /dev/tty works on Linux and Cygwin is different. On Linux you open /dev/tty and the kernel redirects all calls to the descriptor to your current controlling tty. On Cygwin you open /dev/tty and the open call itself is redirected to an open call of your current ctty. That doesn't naturally mean that the stat/fstat inode numbers must be different, but they are right now due to the underlying behaviour. Whatever POSIX has to say about /dev/tty, I don't think this really qualifies as a bug. There are apparently just a couple of ingrained expectations floating around... Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --/3yNEOqWowh/8j+e Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJU2k1lAAoJEPU2Bp2uRE+gv4YP/jqmCFNI3op7gOyYDCHMOo/b v5kA9Slk33yOEHlbb4jwNeuH9fk+qh3rLBEP/orgZJxu4xf6PSB//arzPlzzZ7Tc 72iuWUxsPQm7PS4ZZu4J4ODxASMEPlQzeiJ06F6yD+gNNg4GCQlNe35T1UISbII9 x9A71IfwcYoYLKdMv+Lm5Hu2Yy+6G1zlesPjgFAhwhf5VGFRrES4kQpe4Ok86p0L YOMF53XUvwKaES7OOCCHSZFwZcOEYECubfdQ3LlUKSyo25UBlTorYELLE0NRkRJL T78KOkTigNHftH3T2gmGZLKMI+VHZODWgbFo62qD45O+NxwKuDK0+Zo69N0Lypwk ysgl8m/CtPrXso67rjfx16nMkqbXCfbovEoyf+kHYdGg3E9emqeFE7SRBPts5w2r NPPhElmuzV/zNEIgF3eUsB8roX3LRgIWJq39M8KOue5ZOXG2j65KdBy56xqp7ucY RKazjUI5ZUQMi9IrjQL9rVYETVtZgJWmDjRNN2DMwvYaeSvGdvV/k/5xvf1yJSIu Z6G4yZuNMp5zdW0rD9nQ8kSgX9mRw28cXeXvXAB8Irf9/ima6XcgPFdKzQ/kRKOX AU7bVUA7IjiaTRxclYx115zYLr/YIVQaYGG9ekuHuD7BQ0yKUdIHfUQ9ywtXMFg+ wTW2+tPakaBpekTmHtbh =ZXTC -----END PGP SIGNATURE----- --/3yNEOqWowh/8j+e--