This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Are there any changes to the access control to /proc/<PID>/fd/1 in cygwin 3?
- From: Brian Inglis <Brian dot Inglis at SystematicSw dot ab dot ca>
- To: cygwin at cygwin dot com
- Date: Sun, 16 Jun 2019 09:42:25 -0600
- Subject: Re: Are there any changes to the access control to /proc/<PID>/fd/1 in cygwin 3?
- References: <a0527553-ef09-60dd-5019-7278c5f12835@teco.edu>
- Reply-to: Brian dot Inglis at SystematicSw dot ab dot ca
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