Re: bash pipe fails in script with subshell/loop cmbination

2017-08-08 Thread cyg Simple
On 8/8/2017 10:59 AM, Nellis, Kenneth wrote:
> SHTDI and, sadly, such a task is not in my skill set.)
> 

Nothing like attempting to do it to add skills to your set.  This isn't
a valid reason not to do it.  It is only a valid reason that it would
take longer than someone else who might attempt it, assuming someone
else would even try for which there is no guarantee.  So if you want to
see this idea implemented, just do it.

-- 
cyg Simple

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



Re: bash pipe fails in script with subshell/loop cmbination

2017-08-08 Thread Achim Gratz
Wouter van Doorn writes:
> I've run into a problem regarding pipes in bash, in a command that
> loops. I've reduced it to a very small one-liner that fails.

WJFFM.  Unless it's down (again) to your somewhat bizarre PATH settings,
you're most likely looking at some BLODA that tries to follow each
forked process and can't keep up at some point.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Waldorf MIDI Implementation & additional documentation:
http://Synth.Stromeko.net/Downloads.html#WaldorfDocs

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



RE: bash pipe fails in script with subshell/loop cmbination

2017-08-08 Thread Nellis, Kenneth
> From: Eliot Moss 
> It also works for me.  If it is not a version issue, then I
> wonder about BLODA.  Maybe anti-virus or similar tools are
> wrapping process creation in such a way that things get
> confused.  Try cygcheck, etc.

BTW, it also works for me.

With so many Cygwin issues being attributed to BLODA, I wonder 
if there is a reasonably small set of things that BLODA breaks 
that could be tested in code, and that such a bloda-checking 
program could be added to the package repertoire? (Of course, 
SHTDI and, sadly, such a task is not in my skill set.)

--Ken Nellis


Re: bash pipe fails in script with subshell/loop cmbination

2017-08-08 Thread Eliot Moss

On 8/8/2017 10:20 AM, Ronald Fischer wrote:


TWO - this fails, apparently (warning: my guess) at the pipe
$ for j in 1 2;do echo $j $(echo hello | cat);done
1
2


This works for me:

$ for j in 1 2;do echo $j $(echo hello | cat);done
1 hello
2 hello


It also works for me.  If it is not a version issue, then I
wonder about BLODA.  Maybe anti-virus or similar tools are
wrapping process creation in such a way that things get
confused.  Try cygcheck, etc.

Regards - EM

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



Re: bash pipe fails in script with subshell/loop cmbination

2017-08-08 Thread Ronald Fischer
> 
> TWO - this fails, apparently (warning: my guess) at the pipe
> $ for j in 1 2;do echo $j $(echo hello | cat);done
> 1
> 2

This works for me:

$ for j in 1 2;do echo $j $(echo hello | cat);done
1 hello
2 hello

I have:

GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin)

Ronald

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



Re: bash pipe fails in script with subshell/loop cmbination

2017-08-08 Thread Ronald Otto Valentin Fischer
> 
> TWO - this fails, apparently (warning: my guess) at the pipe
> $ for j in 1 2;do echo $j $(echo hello | cat);done
> 1
> 2

This works for me:

$ for j in 1 2;do echo $j $(echo hello | cat);done
1 hello
2 hello

I have:

GNU bash, version 4.4.12(3)-release (x86_64-unknown-cygwin)

Ronald
-- 
Ronald Fischer 
http://www.fusshuhn.de/

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



bash pipe fails in script with subshell/loop cmbination

2017-08-08 Thread Wouter van Doorn
Hi all,

I've run into a problem regarding pipes in bash, in a command that
loops. I've reduced it to a very small one-liner that fails. The two
versions below should, I'm sure, give the same output - but they
don't. I know the command is silly and useless as it is shown here,
but it's what I'm left with from something more complex after removing
as much of the complexity as I could while retaining the actual
problem I'm fighting.

ONE - this works as expected
$ for j in 1 2;do echo $j $(echo hello);done
1 hello
2 hello

TWO - this fails, apparently (warning: my guess) at the pipe
$ for j in 1 2;do echo $j $(echo hello | cat);done
1
2

THREE - To make it that bit more obscure, the following command also
works as it should, which by now I did not expect:
$ echo hello $(echo world | cat)
hello world

If 'cat' (in TWO) is replaced by 'od -a', then od does not generate
any output (at all) either. Can someone tell me what's wrong either in
what happens or in my expectation?

I have found someone on stackexchange who may, I think, be related
(https://unix.stackexchange.com/questions/364765/store-command-output-in-variable-when-command-includes-pipes)
but unfortunately that was not resolved. I tried it with virusscanning
switched off - no difference.

Thanks for looking!

Wouter van Doorn

Cygwin Configuration Diagnostics
Current System Time: Tue Aug 08 14:49:03 2017

Windows 7 Professional Ver 6.1 Build 7601 Service Pack 1

Path:   C:\cygwin64\home\User\exe.CYGWIN
C:\cygwin64\home\User\bin
C:\cygwin64\usr\local\bin
C:\cygwin64\bin
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\cygwin64\bin
.

Output from C:\cygwin64\bin\id.exe
UID: 197608(User)  GID: 197121(None)
197121(None)   545(Users)
4(INTERACTIVE) 66049(CONSOLE LOGON)
11(Authenticated Users)15(This Organization)
113(Local account) 4095(CurrentSession)
66048(LOCAL)   262154(NTLM Authentication)
401408(Medium Mandatory Level)

SysDir: C:\Windows\system32
WinDir: C:\Windows

Here's some environment variables that may affect cygwin:
PWD = '/cygdrive/c/users/user/desktop/bewerkt/2017/20170301/Canon G15'
HOME = '/home/User'

Here's the rest of your environment variables:
TVlines = '40'
USERDOMAIN = 'User-PC'
OS = 'Windows_NT'
COMMONPROGRAMFILES = 'C:\Program Files\Common Files'
PROCESSOR_LEVEL = '6'
PSModulePath = 'C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;C:\Program 
Files (x86)\AutoIt3\AutoItX'
CommonProgramW6432 = 'C:\Program Files\Common Files'
BIN = '/home/User/bin'
BUGPLATFORM = 'CYGWIN'
CommonProgramFiles(x86) = 'C:\Program Files (x86)\Common Files'
FP_NO_HOST_CHECK = 'NO'
LANG = 'en_US.UTF-8'
TZ = 'Europe/London'
i = '260_2302'
DISPLAY = ':0.0'
HOSTNAME = 'User-PC'
PUBLIC = 'C:\Users\Public'
OLDPWD = '/cygdrive/c/users/user/desktop/bewerkt/2017/20170301'
CYGWIN_NT61 = 'GENERIC'
EDITOR = 'gvim'
USERNAME = 'User'
LOGONSERVER = '\\USER-PC'
PROCESSOR_ARCHITECTURE = 'AMD64'
EXE = '/home/User/exe.CYGWIN'
LOCALAPPDATA = 'C:\Users\User\AppData\Local'
COMPUTERNAME = 'USER-PC'
SYSTEMDRIVE = 'C:'
BUGLIB = '/home/User/c_dir/buglib'
USERPROFILE = 'C:\Users\User'
PATHEXT = '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC'
SYSTEMROOT = 'C:\Windows'
PROCESSOR_IDENTIFIER = 'Intel64 Family 6 Model 78 Stepping 3, GenuineIntel'
TMP = '/tmp'
HOST = 'User-PC'
windows_tracing_logfile = 'C:\BVTBin\Tests\installpackage\csilogfile.log'
PROCESSOR_REVISION = '4e03'
tvb = '/home/User/.uxtv_6.3/tv.CYGWIN -txterm '
PROFILEREAD = 'true'
NUMBER_OF_PROCESSORS = '4'
ProgramW6432 = 'C:\Program Files'
windows_tracing_flags = '3'
uxtv_version = '6.3'
COMSPEC = 'C:\Windows\system32\cmd.exe'
APPDATA = 'C:\Users\User\AppData\Roaming'
SHELL = '/bin/bash'
TERM = 'cygwin'
PLATFORM = 'CYGWIN'
TVback = '/home/User/.tvback'
WINDIR = 'C:\Windows'
ProgramData = 'C:\ProgramData'
SHLVL = '1'
PRINTER = 'Dell C1760nw (bw)'
PROGRAMFILES = 'C:\Program Files'
TVexe = '/home/User/.tvexe'
ALLUSERSPROFILE = 'C:\ProgramData'
TEMP = '/tmp'
TVhome = '/home/User/.uxtv_6.3'
SESSIONNAME = 'Console'
ProgramFiles(x86) = 'C:\Program Files (x86)'
PS1 = 'User-PC-> '
PS2 = '-> '
HOMEDRIVE = 'C:'
INFOPATH = '/usr/local/info:/usr/share/info:/usr/info'
HOMEPATH = '\Users\User'
TVini = '/home/User/.tvexe/TVini'
ORIGINAL_PATH = 
'/cygdrive/c/ProgramData/Oracle/Java/javapath:/cygdrive/c/Program Files/Dell/DW 
WLAN 
Card:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program
 Files/WIDCOMM/Bluetooth Software:/cygdrive/c/Program Files/WIDCOMM/Bluetooth 
Software/syswow64:/cygdrive/c/Program Files/Git/cmd:/usr/bin'
MINES_HOME = '/home/User'
TVcolumns = '160'
EXECIGNORE = '*.dll'
_ = '/usr/bin/cygcheck'

Scanning registry for keys with 'Cygwin' in them...
HKEY_CURRENT_USER\Software\Cygwin
HKEY_CURRENT_USER\Software\Cygwin\Installations
  (default) = 

Re: Subshell lost ANSI colors

2016-10-20 Thread Thomas Wolff

Am 20.10.2016 um 21:06 schrieb Evgeny Grin:

Hi!

Noticed some time ago: most of subshells lost colors and prints some codes.
Sample output:

User@PcName ~
$ dash
\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n$ exit

User@PcName ~
$ ash
\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n$ exit

User@PcName ~
$ zsh
\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ exit

...
bash, sh and fish shells print colorized prompt.
The rest prints ANSI codes.
Same happens in Windows standard console.

Am I doing incorrectly something?
Yes, you expect all shells to have the same capabilities. There are some 
prompt formatting codes in your PS1 that not all shells understand. You 
should set specific PS1 values in shell-specific profiles.

Thomas

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



Subshell lost ANSI colors

2016-10-20 Thread Evgeny Grin
Hi!

Noticed some time ago: most of subshells lost colors and prints some codes.
Sample output:

User@PcName ~
$ dash
\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n$ exit

User@PcName ~
$ ash
\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n$ exit

User@PcName ~
$ zsh
\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ exit

User@PcName ~
$ bash

User@PcName ~
$ exit
exit

User@PcName ~
$ mksh
\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n$ exit

User@PcName ~
$ fish
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
User@PcName ~> exit


User@PcName ~
$ sh

User@PcName ~
$ exit
exit

User@PcName ~
$


Default shell started with installed desktop shortcut (mintty).
bash, sh and fish shells print colorized prompt.
The rest prints ANSI codes.
Same happens in Windows standard console.

Am I doing incorrectly something?


--
Best Wishes,
Evgeny Grin

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



Why mc start without subshell by default?

2010-11-03 Thread Oleksandr Gavenko

I can turn on subshell by:

  $ mc -U

This is useful by default or I miss something?


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



R: Why mc start without subshell by default?

2010-11-03 Thread Marco Atzeri
--- Mer 3/11/10, Oleksandr Gavenko  ha scritto:

 I can turn on subshell by:
 
   $ mc -U
 
 This is useful by default or I miss something?
 
 

It is useful but there is one problem on cygwin.
When you close mc the subshell will not exit, so you will finish
with a zombie bash shell running.

Marco




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



Re: R: Why mc start without subshell by default?

2010-11-03 Thread Oleksandr Gavenko

On 03.11.2010 11:14, Marco Atzeri wrote:

--- Mer 3/11/10, Oleksandr Gavenko  ha scritto:


I can turn on subshell by:

   $ mc -U

This is useful by default or I miss something?




It is useful but there is one problem on cygwin.
When you close mc the subshell will not exit, so you will finish
with a zombie bash shell running.


Oh! I recall that I already wrote about this:

C-o in GNU MC and mintty/rxvt issue?
http://thread.gmane.org/gmane.os.cygwin/118690/focus=118693

mc --subshell after exit forget kill bash.
http://thread.gmane.org/gmane.os.cygwin/118702


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



Re: R: Why mc start without subshell by default?

2010-11-03 Thread SZABO Gergely
Marco Atzeri marco_atzeri at yahoo.it writes:

 
 --- Mer 3/11/10, Oleksandr Gavenko  ha scritto:
 
  I can turn on subshell by:
  
    $ mc -U
  
  This is useful by default or I miss something?
  
  
 
 It is useful but there is one problem on cygwin.
 When you close mc the subshell will not exit, so you will finish
 with a zombie bash shell running.
 
 Marco
 
 

I thought mc's lacking subshell support is a hard fact of life in Cygwin, until
the -U option was pointed out here. It's a huge improvement.

It's quite easy to kill the zombie subshells.
Put a line into /etc/crontab (assuming you're running cron):

*/6 * * * * SYSTEM ps -a | sed -n 's/I  *\([0-9][0-9]*\)  *1  *..*bash$/\1/p' |
xargs kill -KILL

This will kill all bash processes every 6 minutes, who are waiting for input in
the background (I) and whose parent process (PPID) is 1 (not a terminal, not 
mc).

Best regards
Gergely



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



Re: R: Why mc start without subshell by default?

2010-11-03 Thread Marco Atzeri
--- Mer 3/11/10, SZABO Gergely  ha scritto:

 Marco Atzeri marco_atzeri
 at yahoo.it writes:
 
  
  --- Mer 3/11/10, Oleksandr Gavenko  ha scritto:
  
   I can turn on subshell by:
   
     $ mc -U
   
   This is useful by default or I miss something?
   
   
  
  It is useful but there is one problem on cygwin.
  When you close mc the subshell will not exit, so you
 will finish
  with a zombie bash shell running.
  
  Marco
  
  
 
 I thought mc's lacking subshell support is a hard fact of
 life in Cygwin, until
 the -U option was pointed out here. It's a huge
 improvement.
 
 It's quite easy to kill the zombie subshells.
 Put a line into /etc/crontab (assuming you're running
 cron):
 
 */6 * * * * SYSTEM ps -a | sed -n 's/I 
 *\([0-9][0-9]*\)  *1  *..*bash$/\1/p' |
 xargs kill -KILL
 
 This will kill all bash processes every 6 minutes, who are
 waiting for input in
 the background (I) and whose parent process (PPID) is 1
 (not a terminal, not mc).
 
 Best regards
 Gergely
 

That is a workaround, it will be better if 
Pavel release a mc cygwin package without
this problem...

mc-4.6.1 is 22 months old and eventually 4.7.0.x works
better.

Regards
Marco




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



Re: R: Why mc start without subshell by default?

2010-11-03 Thread SZABO Gergely
Marco Atzeri marco_atzeri at yahoo.it writes:

 That is a workaround, it will be better if 
 Pavel release a mc cygwin package without
 this problem...
 
 mc-4.6.1 is 22 months old and eventually 4.7.0.x works
 better.
 
 Regards
 Marco
 
 

You might be interested, mc 4.7.5 is coming out within a few days. It will be
the basis of a new stable branch. I would not bother porting 4.7.0 to Cygwin.

Best regards
Gergely



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



Re: R: Why mc start without subshell by default?

2010-11-03 Thread Marco Atzeri
--- Mer 3/11/10, SZABO Gergely  ha scritto:

 Marco Atzeri marco_atzeri
 at yahoo.it writes:
 
  That is a workaround, it will be better if 
  Pavel release a mc cygwin package without
  this problem...
  
  mc-4.6.1 is 22 months old and eventually 4.7.0.x
 works
  better.
  
  Regards
  Marco
  
  
 
 You might be interested, mc 4.7.5 is coming out within a
 few days. It will be
 the basis of a new stable branch. I would not bother
 porting 4.7.0 to Cygwin.
 
 Best regards
 Gergely
 

following mc websites
Latest released version: 4.7.4; what's new.

Latest released stable version: 4.7.0.9; what's new in the stable release.  
and also:
http://www.midnight-commander.org/wiki/ReleaseWorkflow

But as Pavel is not releasing new package for long time,
this is more or less an academic discussion.

Marco





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



Re: R: Why mc start without subshell by default?

2010-11-03 Thread SZABO Gergely
Marco Atzeri marco_atzeri at yahoo.it writes:

 following mc websites
 Latest released version: 4.7.4; what's new.
 
 Latest released stable version: 4.7.0.9; what's new in the stable release.  
 and also:
 http://www.midnight-commander.org/wiki/ReleaseWorkflow
 
 But as Pavel is not releasing new package for long time,
 this is more or less an academic discussion.
 
 Marco
 
 


From the mc mailing list:
http://mail.gnome.org/archives/mc-devel/2010-November/msg0.html

So sorry, stable mc 4.7.5 is due in a few weeks, not a few days.

Best regards
Gergely


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



Re: R: Why mc start without subshell by default?

2010-11-03 Thread Andy Koppe
On 3 November 2010 09:52, Oleksandr Gavenko wrote:
 On 03.11.2010 11:14, Marco Atzeri wrote:

 --- Mer 3/11/10, Oleksandr Gavenko  ha scritto:

 I can turn on subshell by:

   $ mc -U

 This is useful by default or I miss something?



 It is useful but there is one problem on cygwin.
 When you close mc the subshell will not exit, so you will finish
 with a zombie bash shell running.

 Oh! I recall that I already wrote about this:

 C-o in GNU MC and mintty/rxvt issue?
 http://thread.gmane.org/gmane.os.cygwin/118690/focus=118693

 mc --subshell after exit forget kill bash.
 http://thread.gmane.org/gmane.os.cygwin/118702

A related issue is that when you close any of the pty-based terminals
with mc started from bash running in it, the mc process doesn't get
killed. Bash does of course forward the SIGHUP it gets from the
terminal to its child processes, and manually sending SIGHUP to the
orphaned mc does get rid of it.

A similar issue was previously reported against the joe and mined
editors at http://cygwin.com/ml/cygwin/2010-04/msg01013.html. This
still needs a simple test case though.

Andy

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



mc --subshell after exit forget kill bash.

2010-05-13 Thread Oleksandr Gavenko

bash# ps
  PIDPPIDPGID WINPID  TTY  UIDSTIME COMMAND
 4056   14056   4056? 1003 09:42:56 /usr/bin/mintty
  5164056 516   19928 1003 09:42:56 /usr/bin/bash
  664 516 6643048 1003 09:43:17 /usr/bin/ps

bash# mc --subshell
bash-3.2$ ps  in MC 
  PIDPPIDPGID WINPID  TTY  UIDSTIME COMMAND
 4056   14056   4056? 1003 09:42:56 /usr/bin/mintty
  5164056 516   19928 1003 09:42:56 /usr/bin/bash
 1368 5161368   19088 1003 09:43:52 /usr/bin/mc
  3601368 3602440 1003 09:43:52 /usr/bin/bash
  284 360 2846280 1003 09:43:54 /usr/bin/ps
 press F10 
bash# ps
  PIDPPIDPGID WINPID  TTY  UIDSTIME COMMAND
 4056   14056   4056? 1003 09:42:56 /usr/bin/mintty
  5164056 516   19928 1003 09:42:56 /usr/bin/bash
I 360   1 3602440 1003 09:43:52 /usr/bin/bash
 1408 5161408   10888 1003 09:44:59 /usr/bin/ps

Bashes marked with 'I' appear so many times  how many times you run and 
exit MC.


I run MC through 'mintty -e mc --subshell'.
After some count (~10-12 ???) of run and exit form MC I got error
(recorded not literary): no free pty available.

So MC MUST kill subshell after exit.


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



subshell redirection (/dev/fd/x)

2009-02-17 Thread Brian Ford
$ uname -a
CYGWIN_NT-5.1 PC1163-8460A-XP 1.7.0(0.193/5/3) 2009-02-09 22:27 i686
Cygwin

Just curious if the following is known behavior?

$ echo a | tee (wc)
a
tee: /dev/fd/63: Bad file descriptor

$   0   0   0

-- 
Brian Ford
Staff Realtime Software Engineer
VITAL - Visual Simulation Systems
FlightSafety International
the best safety device in any aircraft is a well-trained crew...

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: subshell redirection (/dev/fd/x)

2009-02-17 Thread Tim McDaniel

On Tue, 17 Feb 2009, Brian Ford brian.f...@flightsafety.com wrote:

$ uname -a
CYGWIN_NT-5.1 PC1163-8460A-XP 1.7.0(0.193/5/3) 2009-02-09 22:27 i686
Cygwin

Just curious if the following is known behavior?

$ echo a | tee (wc)
a
tee: /dev/fd/63: Bad file descriptor

$   0   0   0


The bash term is Process Substitution.

I had the dim impression that there was a Windows misfeature that
prevented (...) from working.

Anyway, thanks for reminding me about what I got onto the list to
complain about.  I think that, out of the box, (...) doesn't work
under Cygwin.  We had to do
ln -s /proc/self/fd /dev/fd
(We got there after we deleted all of Cygwin's directories and
reinstalled.  Apparently we'd set up that symlink before: (...)
worked before the reinstall, but didn't work afterwards until we did
the symlink above.)

The bash manual says, by the way,

 Process substitution is supported on systems that support named
 pipes (FIFOs) or the /dev/fd method of naming open files.

--
Tim McDaniel, t...@panix.com

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: subshell redirection (/dev/fd/x)

2009-02-17 Thread Mark J. Reed
On Tue, Feb 17, 2009 at 2:11 PM, Tim McDaniel wrote:
 I think that, out of the box, (...) doesn't work under Cygwin.  We had to do
ln -s /proc/self/fd /dev/fd

FYI, I have that symlink in a vanilla Cygwin 1.5 install...
-- 
Mark J. Reed markjr...@gmail.com

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: subshell redirection (/dev/fd/x)

2009-02-17 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Mark J. Reed on 2/17/2009 12:17 PM:
 On Tue, Feb 17, 2009 at 2:11 PM, Tim McDaniel wrote:
 I think that, out of the box, (...) doesn't work under Cygwin.  We had to do
ln -s /proc/self/fd /dev/fd
 
 FYI, I have that symlink in a vanilla Cygwin 1.5 install...

That symlink is created by the bash postinstall script; if you had
problems with setup.exe, it might explain why the symlink might be missing.

- --
Don't work too hard, make some time for fun as well!

Eric Blake e...@byu.net
volunteer cygwin bash maintainer
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmbdOgACgkQ84KuGfSFAYBhowCfcpbpUQWYXIWhFAauMMvSCWnI
LcwAn1K1h/1sJya5IzX1O8B3racnJOrn
=BeFw
-END PGP SIGNATURE-

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Subshell

2004-03-12 Thread Gregory Borota
#/bin/bash
echo Silly
( sleep 50 
 ( sleep 50 ) )
wait

each subshell is sh.exe. I want to be be bash.exe. How do I force that
without having to write bash -c 

Thanks,
Greg

P.S. Looked at cygwin faq, archive, didn't find the answer although this
I would think has been brought up before.

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: Subshell

2004-03-12 Thread Christopher Faylor
On Fri, Mar 12, 2004 at 01:49:27PM -0600, Gregory Borota wrote:
#/bin/bash
echo Silly
( sleep 50 
 ( sleep 50 ) )
wait

each subshell is sh.exe.

Why would bash arbitrarily choose sh.exe as the subshell?

I want to be be bash.exe.  How do I force that without having to
write bash -c 

P.S. Looked at cygwin faq, archive, didn't find the answer although this
I would think has been brought up before.

Hmm.

  c:\cd cygwin\bin

  c:\cygwin\binren sh.exe sh-saf.exe
  C:\cygwin\bin\sh.exe - C:\cygwin\bin\sh-saf.exe
   1 file renamed

  c:\cygwin\binbash
  bash-2.05b$ (sleep 1)# works
  bash-2.05b$ cat /tmp/tst
  #!/bin/bash
  echo Silly
  (sleep 1 
   (sleep 1))
  bash-2.05b$ /tmp/tst
  Silly
  bash-2.05b$ # works

If bash used /bin/sh then it would have complained when running the above.

I verified via strace that bash wasn't looking for sh.exe and settling
for bash.exe if it didn't exist, too.
--
Please use the resources at cygwin.com rather than sending personal email.
Special for spam email harvesters: send email to [EMAIL PROTECTED]
and be permanently blocked from mailing lists at sources.redhat.com

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: Subshell

2004-03-12 Thread Gregory Borota
Sorry, it should have been #! (beginners mistake, I guess)
Thanks,
Greg

On Fri, 12 Mar 2004, Christopher Faylor wrote:

 On Fri, Mar 12, 2004 at 01:49:27PM -0600, Gregory Borota wrote:
 #/bin/bash
 echo Silly
 ( sleep 50 
  ( sleep 50 ) )
 wait
 
 each subshell is sh.exe.

 Why would bash arbitrarily choose sh.exe as the subshell?

 I want to be be bash.exe.  How do I force that without having to
 write bash -c 
 
 P.S. Looked at cygwin faq, archive, didn't find the answer although this
 I would think has been brought up before.

 Hmm.

   c:\cd cygwin\bin

   c:\cygwin\binren sh.exe sh-saf.exe
   C:\cygwin\bin\sh.exe - C:\cygwin\bin\sh-saf.exe
1 file renamed

   c:\cygwin\binbash
   bash-2.05b$ (sleep 1)  # works
   bash-2.05b$ cat /tmp/tst
   #!/bin/bash
   echo Silly
   (sleep 1 
(sleep 1))
   bash-2.05b$ /tmp/tst
   Silly
   bash-2.05b$ # works

 If bash used /bin/sh then it would have complained when running the above.

 I verified via strace that bash wasn't looking for sh.exe and settling
 for bash.exe if it didn't exist, too.
 --
 Please use the resources at cygwin.com rather than sending personal email.
 Special for spam email harvesters: send email to [EMAIL PROTECTED]
 and be permanently blocked from mailing lists at sources.redhat.com

 --
 Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
 Problem reports:   http://cygwin.com/problems.html
 Documentation: http://cygwin.com/docs.html
 FAQ:   http://cygwin.com/faq/



--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



BUG: base-files-2.2-1 profile.d runs in subshell - sourced files fail

2003-08-25 Thread mike808
In base-files-2.2-1, the following was recently changed:

 # Run all of the profile.d scripts
 # Note that these are supplied by separate packages
 /bin/find /etc/profile.d -iname '*.sh' -type f | while read f; do
   if [ -f $f ]; then
 . $f
   fi
 done

Previously, the find was executed as an expanded filename wildcard
expansion as part of a 'for' loop. (c.f. 2.0-2)

When this was changed to the current code, because a pipe is used,
the subsequent commands run in a *sub-shell* of the parent /etc/profile
script executing. This means that any environment changes performed
by the files in /etc/profile.d/ are *lost* when the sub-shell returns
to the parent.

This effectively nullifies any environment changes being performed in
those files. Things like PATH setting, etc. I use them to clean up
environment variables mangled by Rational prior to setting up a shell
in Cygwin.

Please put it back to the way it was in base-files-2.0-2, with
the one exception that quote marks be placed around the $i iterator
variable so as to preserve any whitespace that might be in the filenames.

I have corrected that working code (from 2.0-2) below:

 # Run all of the profile.d scripts
 # Note that these are supplied by separate packages
 for i in /etc/profile.d/*.sh ; do
   if [ -f $i ]; then
 . $i
   fi
 done

Thank you.
Michael/



--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: BUG: base-files-2.2-1 profile.d runs in subshell - sourced filesfail

2003-08-25 Thread Igor Pechtchanski
On Mon, 25 Aug 2003, mike808 wrote:

 In base-files-2.2-1, the following was recently changed:

  # Run all of the profile.d scripts
  # Note that these are supplied by separate packages
  /bin/find /etc/profile.d -iname '*.sh' -type f | while read f; do
if [ -f $f ]; then
  . $f
fi
  done

 Previously, the find was executed as an expanded filename wildcard
 expansion as part of a 'for' loop. (c.f. 2.0-2)

 When this was changed to the current code, because a pipe is used,
 the subsequent commands run in a *sub-shell* of the parent /etc/profile
 script executing. This means that any environment changes performed
 by the files in /etc/profile.d/ are *lost* when the sub-shell returns
 to the parent.

 This effectively nullifies any environment changes being performed in
 those files. Things like PATH setting, etc. I use them to clean up
 environment variables mangled by Rational prior to setting up a shell
 in Cygwin.

 Please put it back to the way it was in base-files-2.0-2, with
 the one exception that quote marks be placed around the $i iterator
 variable so as to preserve any whitespace that might be in the filenames.

 I have corrected that working code (from 2.0-2) below:

  # Run all of the profile.d scripts
  # Note that these are supplied by separate packages
  for i in /etc/profile.d/*.sh ; do
if [ -f $i ]; then
  . $i
fi
  done

 Thank you.
 Michael/

Michael,

Your code above will not find the same files as what's currently in
/etc/profile.  The correct code (with no subshells) is included below.

# Run all of the profile.d scripts
# Note that these are supplied by separate packages
while read f; do
  if [ -f $f ]; then
. $f
  fi
done  EOF
`/bin/find /etc/profile.d -iname '*.sh' -type f`
EOF

Hope this helps,
Igor
P.S. While investigating this, I found that /etc/profile.d/mc.sh uses the
'alias' command which /bin/sh doesn't recognize.  Pavel, please take note.
-- 
http://cs.nyu.edu/~pechtcha/
  |\  _,,,---,,_[EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_[EMAIL PROTECTED]
 |,4-  ) )-,_. ,\ (  `'-'   Igor Pechtchanski, Ph.D.
'---''(_/--'  `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster.  -- Patrick Naughton

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/