delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/06/16/11:43:24

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:from:subject:reply-to:to:references:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=tndCZj17e+qu48GY
qIqjxdQVgMfxpGvd28vUzJiNfuDn44UjiHolbTv+NexfIvy9NvOErcFxrrmjgMKi
QCuuY5FtIiUeTgQwJYL+J3v602p4sd73fXl8s8jshRUBC+u13/yYC4CY995qo9gm
Z9YRV398/ylhrpmy9d0GDo3IUnM=
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:from:subject:reply-to:to:references:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=9P2QsMT09dU5Mzv5rVudRY
+v7GQ=; b=ddl/pTi16VCGxjzA6834yJWHaxxCfMILZrTcBltpdJIg53EvDOsShS
gLq/29Gp+c1FusICl2fbaw+d5NXd6RDWqGFFocOa6T1jFjNvvfPuf9mLHmr9jlrd
DNaUjyM9ALCAQADniq7HanjdvKCLilXkYDa4iQQOQSr91aWAt3XH0=
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=-3.1 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 spammy=Till, Inglis, Riedel, inglis
X-HELO: smtp-out-so.shaw.ca
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Subject: Re: Are there any changes to the access control to /proc/<PID>/fd/1 in cygwin 3?
Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca
To: cygwin AT cygwin DOT com
References: <a0527553-ef09-60dd-5019-7278c5f12835 AT teco DOT edu>
Openpgp: preference=signencrypt
Message-ID: <ce76246c-bf9e-9988-97f7-93e7e206d764@SystematicSw.ab.ca>
Date: Sun, 16 Jun 2019 09:42:25 -0600
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1
MIME-Version: 1.0
In-Reply-To: <a0527553-ef09-60dd-5019-7278c5f12835@teco.edu>
X-IsSubscribed: yes

On 2019-06-15 12:27, Till Riedel wrote:
> I have been using a very handy sudo hack, that broke lately (I think) when
> updating cygwin: https://github.com/imachug/win-sudo
> The trick is to spawn an elevated process using powershell and hook up the
> calling file descripters. I now get "write error: Bad file descriptor"
> To reproduce call:
> powershell.exe Start-Process bash  \"-c\",\"\'echo \>\>/proc/$$/fd/1 hello
> world\;sleep 10\'\"
> IMHO this used to work in former versions (print out hello world on the calling
> shell). Strangely
> bash -c "echo >/proc/$$/fd/1 hello world"
> works. So my initial guess is that is has to do with the decoupling of Cygwin
> PIDs from Windows PIDs, but there were also changes in the proc file system...
> Thanks a lot in advance for any help/thoughts!

Given:
$ bash -c 'ls -dglo /dev/std* /proc/self /proc/$$ /proc/self/fd/[012]'
lrwxrwxrwx 1 15 May 14  2013 /dev/stderr -> /proc/self/fd/2
lrwxrwxrwx 1 15 May 14  2013 /dev/stdin -> /proc/self/fd/0
lrwxrwxrwx 1 15 May 14  2013 /dev/stdout -> /proc/self/fd/1
dr-xr-xr-x 3  0 Jun 16 01:37 /proc/23846
lrwxrwxrwx 1  0 Jun 16 01:37 /proc/self -> 23846
lrwxrwxrwx 1  0 Jun 16 01:37 /proc/self/fd/0 -> /dev/pty0
lrwxrwxrwx 1  0 Jun 16 01:37 /proc/self/fd/1 -> /dev/pty0
lrwxrwxrwx 1  0 Jun 16 01:37 /proc/self/fd/2 -> /dev/pty0

the following seems to work as expected:
$ powershell Start-Process bash  \"-c\",\"\'echo \>\>/dev/stdout hello
world\;sleep 10\'\"

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.

--
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

- Raw text -


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