| delorie.com/archives/browse.cgi | search |
| 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=Cu9xcrzAqVU7aEGuyVHkAW6AD4oRq7R4o9JY8/FFB/d7Ry8Xe78pG | |
| PgVna3vxPbT4v+1MLmZ8HSHaTygFUUjWfGFiOkKZ6EOhyPJczOPqH7BIokuVOstW | |
| GXnn/abwvHUwUNLX2NDgEahLopqEWDJHZtP3OK3LclAvRcg3lqGojE= | |
| 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=6NozQuV/HM34yrAHRIEOCsy01Xc=; b=nn2qK3OdUQb8HOrIq6IuOdyRBoid | |
| 1pmZ2tDpEabCzxNWDjPbhh3bjzkXm7BPsf68pUFvTEVt0ARAuxaID5dYIYN8dx2s | |
| POWpnIOt0UY8fWhjjqyG90LrqNqEaBA4FFUITjNidemPXLaqk/Ede4BPaIMUm0wf | |
| rR3b2gtC+ABVU5w= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| 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=-101.9 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*R:D*cygwin.com, friends, H*c:application |
| X-HELO: | drew.franken.de |
| Date: | Wed, 23 Aug 2017 18:08:03 +0200 |
| From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: Strange bug with /dev/console in mintty |
| Message-ID: | <20170823160803.GG7469@calimero.vinschen.de> |
| Reply-To: | cygwin AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| References: | <CAOTD34aibcY2oOq1o_kHfT5HVxEh97-c73mMEZMwa9S1hUrXTg AT mail DOT gmail DOT com> <20170823083346 DOT GB7469 AT calimero DOT vinschen DOT de> |
| MIME-Version: | 1.0 |
| In-Reply-To: | <20170823083346.GB7469@calimero.vinschen.de> |
| User-Agent: | Mutt/1.8.3 (2017-05-23) |
--zCKi3GIZzVBPywwA
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Aug 23 10:33, Corinna Vinschen wrote:
> On Aug 22 18:49, Erik Bray wrote:
> > Hi folks,
> >=20
> > I noticed a strange discrepancy when running Cygwin through mintty, vs
> > through a normal cmd.exe console. This is on a build from the latest
> > git master, but also on Cygwin 2.8.0. When run from a cmd.exe
> > console, we can see the following output from fhandler_dev::readdir:
> >=20
> > $ ls -l /dev/con*
> > crw-rw-rw- 4 Erik M. Bray Erik M. Bray 3, 0 Aug 22 18:29 /dev/conin
> > crw-rw-rw- 4 Erik M. Bray Erik M. Bray 3, 0 Aug 22 18:29 /dev/conout
> > crw-rw-rw- 4 Erik M. Bray Erik M. Bray 3, 0 Aug 22 18:29 /dev/cons0
> > crw-rw-rw- 4 Erik M. Bray Erik M. Bray 3, 0 Aug 22 18:29 /dev/console
> >=20
> > The same command when run in mintty returns:
> >=20
> > crw-rw-rw- 1 Erik M. Bray Erik M. Bray 5, 255 Aug 22 18:29 /dev/conin
> > crw-rw-rw- 1 Erik M. Bray Erik M. Bray 5, 254 Aug 22 18:29 /dev/conout
> > crw-rw-rw- 1 Erik M. Bray Erik M. Bray 5, 1 Aug 22 18:29 /dev/console
> >=20
> > In the latter case, the device numbers are the default device numbers
> > for /dev/console, etc. In the former case, the inodes for
> > /dev/console, /dev/conin, and /dev/conout are set to the same as
> > /dev/cons0. This logic can be found in fhandler_dev::readdir:
> >=20
> > 203 if (cdev->get_major () =3D=3D DEV_TTY_MAJOR
> > 204 && (cdev->is_device (FH_CONIN)
> > 205 || cdev->is_device (FH_CONOUT)
> > 206 || cdev->is_device (FH_CONSOLE)))
> > 207 {
> > 208 /* Make sure conin, conout, and console have the same inode n=
umber
> > 209 as the current consX. */
> > 210 de->d_ino =3D myself->ctty;
> > 211 }
> >=20
> > where myself->ctty seems to depend largely on what file types the
> > stdio handles are attached to.
> >=20
> > When running from cmd.exe, GetStdHandle(...) returns handles to a
> > character stream--i.e. the console itself. However, when running from
> > mintty it returns pipes (specifically, to a pty, probably related to
> > the call to forkpty in mintty). In Cygwin (particularly, in
> > dtable::init_std_file_from_handle) the result ends up being that when
> > the stdio handles are pipes, the /dev/cons0 device never gets created.
> > And thus /dev/console and friends never get rerouted to a real device.
> > This results in errors when trying to access /dev/console directly:
> >=20
> > $ ls -l /dev/console
> > ls: cannot access '/dev/console': No such device or address
>=20
> /dev/console is an old concept in Cygwin and it was always attached to
> the current console window, *if* you were running inside a windows
> console. It was never implemented for pseudo ttys as used by mintty.
>=20
> The fact that the /dev emulation shows the con devices is a bit
> disappointing, given that they are basically unusable. The existence
> check only checks if GetConsoleCP() returns successfully, but that's
> true for a pseudo tty as well. A console is attached to the process
> anyway.
>=20
> I'll think about the existence check.
I checked in a patch removing the /dev/conin, /dev/conout and
/dev/console files from /dev if the process is not running from
a console. Check out the latest developer snapshot from
https://cygwin.com/snapshots/
Thanks,
Corinna
--=20
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
--zCKi3GIZzVBPywwA
Content-Type: application/pgp-signature; name="signature.asc"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCAAGBQJZnahjAAoJEPU2Bp2uRE+gQzkP/0rXxB/xIEHr0P5MczVykUo+
Lk+ZaV/Gc98LpPnPsvRgNxGQgdbCmbjPEMF0U8/l9OwJ6+5zyJ9SDzkDpjV5LVNJ
PZYv84NgCse3BiJDC7lnXeLlSppTx8BiJ16oVNAEHur40Osnzs0KaDaXvVl5wjRf
iKOvU1qjhO5aYywf2PZ2KntgPSQvJ8gQsGRuNv8od4CuX39VmmiCjqn3dltJFKJW
3C2cwTCSXzlRw+h0RZqqkiVXG9m9EQttPdhFGN41YpihhKs2W6R+xvIEOzHtqQlv
yDR9YNI4ZuLA/z4DiGzpIUS88JZZU6mC2fyHSb6tYdjaGgYXdilQFWFOV93Vp0dH
i8YYDooML6ZNvA0jCQgyGLnXiLNZFdk3utxGr+ZcJD7CztQ8aejFQNejP9m6VaXm
p2W7Jsx5Bz/kZEpCGe0QChe3xG9Sb69FAG7VAdkklmr5HcvBiw/aGD9/4XTOGd+j
y25OPqQvl0Ih6aJARPyz7uGDkY2xFdzLeccy+XgDF57RCcAWma5/fQWeM1JK4Df9
mQCqjd/moNpLhaeR0pVb4ArKLivY8ZkaoOx+WmsOF+JBNfOaHA1B9E5ubHXQgqwm
o9Wr5rqQYoeLIO5MsohNA6tUhv/UtCBfir2KvftTYb+1umQtHwPwtVPzdimfYyRs
EoyhlsCVFhDVdgBnmNC6
=4L2p
-----END PGP SIGNATURE-----
--zCKi3GIZzVBPywwA--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |