delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/12/16/15:31:34

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=jrFJYbLYpF9QstIeq0rg4l26NhpIsD1yzNb1HugTur22ZGoHBdE3K
cfZVFrCQtRTzxLfDUcoccayJ4iwdvDYiJtTtrdzGywwBq/7Mn0wlA98Ve7ig89CO
p4Ikz4XxHmSO8fUWjNcPKTkt35Lr6qfbqyH+QG8J64nStRGw1Qcgfs=
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=fa2Dq6yeKERcl7meEhueM/Upz8g=; b=q4iGNnlZZ2kdVkivC6Uig6AXPaBo
WanMCxjBvL/0mFZ4AVTvq3Yjs1bJaY8JihCW2as0Exbx9PhmQF55VcJKhdCw2wqr
j78nMixzyLKTxhHGxkGPZTkL84jZBzF1de1gzFf+66x3evqxDrfmkh5J9FRreKA2
HEOePUJFvXz1zBs=
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-Spam-SWARE-Status: No, score=-100.9 required=5.0 tests=BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=
X-HELO: mout.kundenserver.de
Date: Sun, 16 Dec 2018 21:31:18 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: /dev/fd/N not synonymous with file descriptor N; it is on Linux
Message-ID: <20181216203118.GL28727@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <0f030e809f063f5a5e64ff7a7a0c3227 AT xs4all DOT nl> <20181216202847 DOT GK28727 AT calimero DOT vinschen DOT de>
MIME-Version: 1.0
In-Reply-To: <20181216202847.GK28727@calimero.vinschen.de>
User-Agent: Mutt/1.9.2 (2017-12-15)

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

On Dec 16 21:28, Corinna Vinschen wrote:
> On Dec 16 17:31, Houder wrote:
> > L.S.,
> >=20
> > /dev/fd/N not synonymous with file descriptor N; it is on Linux
>=20
> Yes, it is.  Most of the time.  Try this:
>=20
> $ echo foo | cat /dev/fd/0
>=20
> The problem is that some of the concepts don't work as desired:
>=20
> > 64-@@ cat /dev/fd/0 <<\EOF
>=20
> If you observe what happens in tcsh in this situation you see that it
> doesn't even execute cat as long as you didn't type EOF.  What you type
> is written to a tmpfile:
>=20
> $ ls -l /proc/5980/fd
> total 0
> lrwxrwxrwx 1 corinna vinschen 0 Dec 16 21:15 0 -> /tmp/sh.lVQq04
> lrwxrwxrwx 1 corinna vinschen 0 Dec 16 21:15 15 -> /dev/pty0
> lrwxrwxrwx 1 corinna vinschen 0 Dec 16 21:15 16 -> /dev/pty0
> lrwxrwxrwx 1 corinna vinschen 0 Dec 16 21:15 17 -> /dev/pty0
> lrwxrwxrwx 1 corinna vinschen 0 Dec 16 21:15 18 -> /dev/pty0
> lrwxrwxrwx 1 corinna vinschen 0 Dec 16 21:15 19 -> /dev/pty0
>=20
> However, this tmpfile has been unlinked already, so it has been moved to =
the
> recycle bin:
>=20
> $ ls -l /tmp/sh.lVQq04
> ls: /tmp/sh.lVQq04: No such file or directory
>=20
> So the path in the fd subdir doesn't reflect the actual file path.
>=20
> But after starting cat, cat tries to open /proc/self/fd/0 which
> is in fact the non-existing path /tmp/sh.lVQq04.  Bad luck.
>=20
> In contrast to Linux the symlinks are not just faked symlinks with the
> underlying OS having direct access to the file descriptors.  The way
> it's implemented in Cygwin uses the actual file path resolution and then
> either works or fails as above.  I'm not sure how to fix that easily.
> I guess the fd/0 symlink would have to show the actual file path pointing
> to the recycle bin.  But that's often not what you want either since it
> hows a patch outside the POSIX namespace.
  shows a path

Sorry,
Corinna

--=20
Corinna Vinschen
Cygwin Maintainer

--fWddYNRDgTk9wQGZ
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAlwWthYACgkQ9TYGna5E
T6AgSA/+NFE/0qR09uAbR0meIyb9ZwbPN/si5x9ui4bjMixy7QFRCbZOa9At3Kp9
wu9IdM6J2t77+28rWfC9PegoiAjhpndcTh7bSAsjV227a+U/lzi6Lk7YtUKYWY99
txNWhiP4i1EO38lA98qg8e4hbU6qlT+8U196yGIE2bFI2H1hVcVQ8cjormZXJIj2
/uens0ReXh+P7QdxZltmKvjNdWWZ8HnmchVmrqvGJuco01JPuQa6QzNn6zrv5k6I
xUNmlODDaHh2z9LZPy8O5xmOninYhNLwd/gXaa/knWJbK54UN1EgHRfdAL2wLYdH
W02dLFEAnWKH/KFRztphNh+rFbwqrpdw8gA9cPJbRQz/BZ/Si1s11f5mFJcY0T8v
WLtJYNU4kVjsGBLhbaTBm0P4RXgwilXHjKweIxI5POiTW0E/hbjsS0MyneXyx7N1
7Q0D3PgCG91dqpSs82vww50e6ffZFYF74IeUsSSoWrikchtq9OYG3Ixt/iMHsdhX
0ov7YHsqsemDRjjdXMytKid8jWPJrU1nC3FdLIbPdcvFC05tOmWKnzguIGgaX10C
zFH/k9+/oVqXgYKbbTYMvCd9AH2vr6axCLL2KjSmBgCZCwNHiQk4bsuA9VU+gyAB
xNdWUSv41lTXuGKfY/NkcnFwPEKfp2gynRIeglYQ41ci39Cwq7s=
=csJv
-----END PGP SIGNATURE-----

--fWddYNRDgTk9wQGZ--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019