From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 72109 invoked by alias); 16 Jun 2019 15:42:30 -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 72102 invoked by uid 89); 16 Jun 2019 15:42:30 -0000 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 Received: from smtp-out-so.shaw.ca (HELO smtp-out-so.shaw.ca) (64.59.136.138) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 16 Jun 2019 15:42:28 +0000 Received: from [192.168.1.114] ([24.64.172.44]) by shaw.ca with ESMTP id cXIXhL0DVo7SQcXIYh7VKB; Sun, 16 Jun 2019 09:42:26 -0600 From: Brian Inglis Subject: Re: Are there any changes to the access control to /proc//fd/1 in cygwin 3? Reply-To: Brian.Inglis@SystematicSw.ab.ca To: cygwin@cygwin.com References: Openpgp: preference=signencrypt Message-ID: Date: Sun, 16 Jun 2019 15:42:00 -0000 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: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-06/txt/msg00155.txt.bz2 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