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:message-id:from:reply-to:to:subject :references:in-reply-to:content-type; q=dns; s=default; b=kGuAj4 7Vn+zX6FUDXp7v23L2vaOBzQHM5THhYHwNJ3P3ZQwfuZz3sxY6OFyjn+iyOJgayP eI/6Y9asA9u2Ga8FkehFBY1B15DeXIke/3zZei0SXKWeW1+xOJQgNoAR//O/9lws naJlhMz+4ADFcflF86jvrlq/h4ZMQkn0Rbql4= 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:message-id:from:reply-to:to:subject :references:in-reply-to:content-type; s=default; bh=/DSngOqVLEVC 0NIHhxCu8B0PV9o=; b=fwtFfIOM1RXTVgFPFwfSXYng6tPNu3jmyD2aWOZ/bQVn yjVKAED8Oc+gZVyqvTTALcNfsKPkECtPsQlkl1pNXs/ydaJssZT/DAsQdxfr9XIh 1D32ubUR3XFpXjjVcW1Q+pzPNOlV5V5MhYPtirQaNsy2U7mq1jmXLlz2p7U4vrY= 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-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=Seven, H*F:D*nl, ATM X-HELO: lb2-smtp-cloud8.xs4all.net Date: Tue, 22 Jan 2019 11:20:46 +0100 Message-ID: <45382f09a86b6cf3bcabd82adb593622@smtp-cloud8.xs4all.net> From: Houder Reply-To: 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 References: <0f030e809f063f5a5e64ff7a7a0c3227 AT xs4all DOT nl> <20190106201950 DOT GC4430 AT calimero DOT vinschen DOT de> <1c60402837d6510667357257b5e96e88 AT xs4all DOT nl> <20190122090633 DOT GK2802 AT calimero DOT vinschen DOT de> <151898514e462bd76cda8a227d4baa16 AT xs4all DOT nl> <20190122094157 DOT GN2802 AT calimero DOT vinschen DOT de> In-Reply-to: <20190122094157.GN2802@calimero.vinschen.de> Content-Type: text/plain; charset=UTF-8; format=fixed User-Agent: mua.awk 0.99 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: > > $ uname -a > CYGWIN_NT-6.1 vmbert764 2.12.0(0.333/5/3) 2019-01-21 22:47 x86_64 Cygwin > $ ./stca /dev/fd/0 < ? bla > ? EOF > fd1 =3D 0 > argv[1] =3D /dev/fd/0 > fd2 =3D 3 > buf =3D \ > Hello, world! That is odd ... (I am using the same version of Cygwin as you do, do I not?) 64-@@ uname -a CYGWIN_NT-6.1 Seven 2.12.0s(0.333/5/3) 2019-01-21 10:25 x86_64 Cygwin (however, I only replaced the cygwin1.dll) (the snapshot is apparently not the same as your version 2.12.0) > > > Not sure what you're testing. > > > > STC inherits a "read-only" open file descriptor from bash. On Linux > > the file can be opened read-write (via procfs), because a new entry > > is created in the open file table. > > > > (opening the file read-write (via fdescfs) on FreeBSD would fail) > > > > For this reason the output does not show what has been entered via > > the here-doc. > > > > In short, I was merely testing the semantics of Linux. > > Ah, ok. This is a bit of a problem on Windows. The code tries to > reopen the file by handle. Under some circumstances(*) we can't reopen > the file. In that case the code just tries to duplicate the handle. > However, a duplicated file handle can't have more permissions than the > original handle. > > So if it fails for you, it seems the reopen failed and the handle > only got duplicated. In that case, you can't gain write perms if > the original handle only got read perms. Understood. > What the code fails to do is trying to open the file by name as a last > resort. There was a (good?) reason I didn't implement that, but I don't > remember ATM. Not relevant in this case, as the file has been deleted ... (i.e., in this case, it cannot be opened by name). Henri ===== -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple