From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 72248 invoked by alias); 27 Jan 2019 22:12:22 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 72241 invoked by uid 89); 27 Jan 2019 22:12:22 -0000 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,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=Yes X-HELO: mout.kundenserver.de Received: from mout.kundenserver.de (HELO mout.kundenserver.de) (212.227.17.13) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 27 Jan 2019 22:12:21 +0000 Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MDhpZ-1gvGnF3oQh-00Ap8m for ; Sun, 27 Jan 2019 23:12:18 +0100 Received: by calimero.vinschen.de (Postfix, from userid 500) id 8763EA8041C; Sun, 27 Jan 2019 23:12:18 +0100 (CET) Date: Sun, 27 Jan 2019 22:12:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: /dev/fd/N not synonymous with file descriptor N; it is on Linux Message-ID: <20190127221218.GJ3912@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <20190106201950.GC4430@calimero.vinschen.de> <1c60402837d6510667357257b5e96e88@xs4all.nl> <20190122090633.GK2802@calimero.vinschen.de> <151898514e462bd76cda8a227d4baa16@xs4all.nl> <20190122094157.GN2802@calimero.vinschen.de> <45382f09a86b6cf3bcabd82adb593622@smtp-cloud8.xs4all.net> <20190122103928.GO2802@calimero.vinschen.de> <6132284bb44434a89381a695fdd86c7d@smtp-cloud7.xs4all.net> <20190127215721.GH3912@calimero.vinschen.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="eDB11BtaWSyaBkpc" Content-Disposition: inline In-Reply-To: <20190127215721.GH3912@calimero.vinschen.de> User-Agent: Mutt/1.10.1 (2018-07-13) X-SW-Source: 2019-01/txt/msg00246.txt.bz2 --eDB11BtaWSyaBkpc Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1722 On Jan 27 22:57, Corinna Vinschen wrote: > On Jan 27 19:39, Houder wrote: > > On Tue, 22 Jan 2019 11:39:28, Corinna Vinschen wrote: > > >=20 > > > On Jan 22 11:20, Houder wrote: > > > > On Tue, 22 Jan 2019 10:41:57, Corinna Vinschen wrote: > > > > > On Jan 22 10:25, Houder wrote: > > > > [snip] > > > > > > > > > > Curious! It fails (for me) on W7 ... > > > > > > > > > > It works for me just as well on W7: > > [snip] > >=20 > > > Maybe you should run the above shell session under strace and see if > > > something unusual crops up. BLODA? > >=20 > > NO BLODA. > >=20 > > Ok, for the record (as this is W7, i.e. pre-pre-W10 :-) > >=20 > > Using my original STC again: (source code included below) > >=20 > > - create file (in /tmp) write-only, write "Hello, world!" to file, clo= se fd > > - open file once more read-only > > - unlink file > > - open file, using /dev/fd/N, read-write <=3D=3D=3D=3D succeeds (and t= he handle shown by fcntl is read-write) > > - write "*****" to file (using the fd obtained in the previous line), = lseek to begin of file > > - write fails w/ "Permission denied" <=3D=3D=3D=3D so ... the file ca= nnot be written to? >=20 > Yes, that scenario fails on W7 but works on W10 1709 and later. Keep in > mind that the OS doesn't allow to reopen a file which has been deleted. ... on Windows 8.1 and earlier and (probably, but I can't test this) on W10 versions prior to 1709. > Cygwin tries a best effort by duplicating the handle. A duplicated file > handle can't have more permissions than the original handle, so if the > original handle was opened for reading only, the duplicated handle can't > have write perms. > [etc] Corinna --=20 Corinna Vinschen Cygwin Maintainer --eDB11BtaWSyaBkpc Content-Type: application/pgp-signature; name="signature.asc" Content-length: 833 -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAlxOLMIACgkQ9TYGna5E T6Atxg//RGK+CYSMFg7iUZQX8p1WQPY+8I6P2fwN4AMzf4ncJtXRDgAlbXrj2/KT WmfYNCusq+fqOy4fkI2AyD4avucdQqAdJTGqonJffTJGpjJcIocrWZxhzvCC3M9N eEd5gLxXD15E0DSzZs8eQO+HP7EKQSDjnhpj6MQ+KDe4EUBikyhDlx+bdWYjZUUs xBy4OxWHOtDSedoexcm8QNkOfGmc7tc1xdXkGq1JUOMbAqS70/Gdv1GxVF2oIlRF 7HoLxb0BzDQ4s21nwW46VlJYnczeCb+42Hi8sLvEs8Xg3QntbiNJ1pdtoeSXrKpQ z9XIa8TVSt+z2kIauzfK1n7Is6zcwqrpPYDI5XUCT/wi8gXEb7UJQAgB2GYu303Z I7PaLZhaxD05ofVU9gNtaE/LMmSpqHmsbH1gotm764cT0FWzlg0sXfk2uM7lrT+a faXEGraypBiuQPhI+CeIL7kjuPMAsLB6WKwacoSOpmAEnVLDxvpf0+1GlZyLLaG6 MHHYiGXF0p81lBYSsayricXxCgIdRWr/T4NTVHwCP++5q1XyfoUeWmjsRHU9cTws F0rDx3sx9jPMbWRxUmzRF35wy07HqW3CEJ/7wjkbBff5gp5m1u11VQeeYUqW+SIF jmywNyWFdX09v8O8THhWhunLGNOyWe5P/UwOY0+5u4oDHXzgZ20= =ra5i -----END PGP SIGNATURE----- --eDB11BtaWSyaBkpc--