Re: pdksh not setting $? with exit status of commands

2005-01-20 Thread David Kramer
Igor Pechtchanski  cs.nyu.edu> writes:
> > Cygwin Configuration Diagnostics
> > Current System Time: Wed Jan 19 16:13:42 2005
> >
> > Windows XP Professional Ver 5.1 Build 2600 Service Pack 1
> > [snip]
> > Found: C:\cygwin\bin\grep.exe
> > Found: c:\SFU\common\grep.exe
> > Warning: C:\cygwin\bin\grep.exe hides c:\SFU\common\grep.exe
> 
> Ah, I think this may be your problem.  Are you *sure* you're using the
> Cygwin grep?  In general, mixing MS SFU and Cygwin in the PATH is not a
> good idea.
> 
> Try explicitly using /bin/grep, i.e.,

Guilty as charged.  That was it.  Thank you.
I did one better and uninstalled MS SFU, which is about what it deserves.
Now it works as preditcted.

Thank you for the help, and for the clue-by-4 on the diagnostic tool that 
uncovered the problem.


--
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: pdksh not setting $? with exit status of commands

2005-01-19 Thread Igor Pechtchanski
On Wed, 19 Jan 2005, David Kramer wrote:

> Igor Pechtchanski  cs.nyu.edu> writes:
> > On Wed, 19 Jan 2005, David Kramer wrote:
> >
> > > When I execute commands in the pdksh shell that should set an exit
> > > value, $? is not being set.  When I use the bash shell, it is.
> > >
> > > In pdksh:
> > > /c/windevel> grep o regexps
> > > oo
> > > /c/windevel> echo $?
> > > 0
> > > /c/windevel> grep Z regexps
> > > /c/windevel> echo $?
> > > 0
> >
> > Can't reproduce this here, sorry:
> >
> > $ pdksh
> > $ cygcheck -f /bin/pdksh
> > pdksh-5.2.14-3
> > $ grep o regexps ; echo $?
> > oo
> > 0
> > $ grep Z regexps ; echo $?
> > 1
>
> I see a functional difference in your example and mine.  You ran grep
> then echo separated by a ;, while I ran it on two separate lines.

Hmm, interesting.  I tried both ways, and they both worked identically for
me, so I posted the one that used less space...

> These should do the same thing (as it does on my other target, AIX), but
> it doesn't appear to.
>
> When I run your example in my Cygwin pdksh shell, I get the same results
> as you.  It looks like I can use that format as a workaround for the
> problem, but I sure would like to understand why it doesn't work as
> expected in my example, when both examples produce the same results in
> AIX's ksh, so I can predict these kinds of problems in the future
> better.
>
> Cygwin Configuration Diagnostics
> Current System Time: Wed Jan 19 16:13:42 2005
>
> Windows XP Professional Ver 5.1 Build 2600 Service Pack 1
> [snip]
> Found: C:\cygwin\bin\grep.exe
> Found: c:\SFU\common\grep.exe
> Warning: C:\cygwin\bin\grep.exe hides c:\SFU\common\grep.exe

Ah, I think this may be your problem.  Are you *sure* you're using the
Cygwin grep?  In general, mixing MS SFU and Cygwin in the PATH is not a
good idea.

Try explicitly using /bin/grep, i.e.,

$ /bin/grep o regexps
oo
$ echo $?
0
$ /bin/grep Z regexps
$ echo $?
1

Igor Pechtchanski, Cygwin volunteer PDksh maintainer
-- 
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!

"The Sun will pass between the Earth and the Moon tonight for a total
Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT

--
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: pdksh not setting $? with exit status of commands

2005-01-19 Thread David Kramer
Igor Pechtchanski  cs.nyu.edu> writes:
> On Wed, 19 Jan 2005, David Kramer wrote:
> 
> > When I execute commands in the pdksh shell that should set an exit
> > value, $? is not being set.  When I use the bash shell, it is.
> 
> Please review and follow  to provide
> enough information about your installation.

Will do in future, thank you.

> > In pdksh:
> > /c/windevel> grep o regexps
> > oo
> > /c/windevel> echo $?
> > 0
> > /c/windevel> grep Z regexps
> > /c/windevel> echo $?
> > 0
> 
> Can't reproduce this here, sorry:
> 
> $ pdksh
> $ cygcheck -f /bin/pdksh
> pdksh-5.2.14-3
> $ grep o regexps ; echo $?
> oo
> 0
> $ grep Z regexps ; echo $?
> 1

I see a functional difference in your example and mine.  
You ran grep then echo separated by a ;, 
while I ran it on two separate lines.  
These should do the same thing (as it does on my other target, AIX), 
but it doesn't appear to.  

When I run your example in my Cygwin pdksh shell, 
I get the same results as you.  It looks like I can use 
that format as a workaround for the problem, but I sure
would like to understand why it doesn't work as expected in my 
example, when both examples produce the same results in AIX's ksh,
so I can predict these kinds of problems in the future better.

Thanks for your help.  





Cygwin Configuration Diagnostics
Current System Time: Wed Jan 19 16:13:42 2005

Windows XP Professional Ver 5.1 Build 2600 Service Pack 1

Path:   ~\bin
c:\Program Files\Subversion\bin
C:\cygwin\usr\local\bin
C:\cygwin\bin
C:\cygwin\bin
C:\cygwin\usr\X11R6\bin
c:\sybase\OLEDB
c:\sybase\ODBC
c:\sybase\ASEP_Win32
c:\sybase\OCS-12_5\dll
c:\sybase\OCS-12_5\lib3p
c:\sybase\OCS-12_5\bin
c:\WINDOWS\system32
c:\WINDOWS
c:\WINDOWS\System32\Wbem
c:\sybase\DLL
c:\sybase\BIN
k:\apps\pvcs\vm60\nt
c:\windevel
c:\SFU\Perl\bin\
c:\SFU\common\
c:\Program Files\Subversion\bin
c:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT
c:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin
c:\Program Files\Microsoft Visual Studio\Common\Tools
c:\Program Files\Microsoft Visual Studio\VC98\bin
c:\Program Files\Microsoft Visual Studio\VC98\Bin
c:\Program Files\Microsoft Visual Studio\COMMON\IDE\IDE98
c:\windevel\svn1\bin
c:\windevel\svn1\scripts

Output from C:\cygwin\bin\id.exe (nontsec)
UID: 15668(dkramer) GID: 10545(mkgroup-l-d)
10545(mkgroup-l-d)

Output from C:\cygwin\bin\id.exe (ntsec)
UID: 15668(dkramer) GID: 10545(mkgroup-l-d)
0(root)  544(Administrators)  
545(Users)   10545(mkgroup-l-d)

SysDir: C:\WINDOWS\System32
WinDir: C:\WINDOWS

HOME = `c:\Documents and Settings\dkramer'
LD_LIBRARY_PATH = `C:\cygwin\usr\lib:\usr\X11R6\lib'
MAKE_MODE = `unix'
USER = `dkramer'

c:  hd  NTFS   76245Mb  35% CP CS UN PA FC 
d:  cd   N/AN/A
h:  net NTFS2048Mb   2% CP CS UN PA FC dH_Home
k:  net NTFS   32384Mb  93% CP CSPAdata
o:  net NTFS4096Mb  26% CP CS UN PA FC old_dH_Shared
r:  net NTFS   26208Mb  92% CP CSPAcm_data
s:  net NTFS5120Mb   0% CP CS UN PA FC dH_Shared
t:  net NTFS   16383Mb  71% CP CS UN PA FC IT_Share

C:\cygwin  / system  binmode
C:\cygwin/bin  /usr/bin  system  binmode
C:\cygwin/lib  /usr/lib  system  binmode
C:\cygwin\usr\X11R6\lib\X11\fonts  /usr/X11R6/lib/X11/fonts  system  binmode
.  /cygdrive system 
binmode,cygdrive

Found: C:\cygwin\bin\awk.exe
Found: C:\cygwin\bin\bash.exe
Found: C:\cygwin\bin\cat.exe
Found: c:\SFU\common\cat.exe
Warning: C:\cygwin\bin\cat.exe hides c:\SFU\common\cat.exe
Found: C:\cygwin\bin\cp.exe
Found: c:\SFU\common\cp.exe
Warning: C:\cygwin\bin\cp.exe hides c:\SFU\common\cp.exe
Found: C:\cygwin\bin\cpp.exe
Found: C:\cygwin\bin\find.exe
Found: c:\SFU\common\find.exe
Warning: C:\cygwin\bin\find.exe hides c:\SFU\common\find.exe
Found: C:\cygwin\bin\gcc.exe
Found: C:\cygwin\bin\gdb.exe
Found: C:\cygwin\bin\grep.exe
Found: c:\SFU\common\grep.exe
Warning: C:\cygwin\bin\grep.exe hides c:\SFU\common\grep.exe
Found: C:\cygwin\bin\ld.exe
Found: C:\cygwin\bin\ls.exe
Found: c:\SFU\common\ls.exe
Warning: C:\cygwin\bin\ls.exe hides c:\SFU\common\ls.exe
Found: C:\cygwin\bin\make.exe
Found: C:\cygwin\bin\mv.exe
Found: c:\SFU\common\mv.exe
Warning: C:\cygwin\bin\mv.exe hides c:\SFU\common\mv.exe
Found: C:\cygwin\bin\rm.exe
Found: c:\SFU\common\rm.exe
Warning: C:\cygwin\bin\rm.exe hides c:\SFU\common\rm.exe
Found: C:\cygwin\bin\sed.exe
Found: c:\SFU\common\sed.exe
Warning: C:\cygwin\bin\sed.exe hides c:\SFU\common\sed.exe
Found: C:\cygwin\bin\sh.exe
Found: C:\cygwin\bin\tar.exe

   92k 2004/06/08 C:\cygwin\bi

Re: pdksh not setting $? with exit status of commands

2005-01-19 Thread Igor Pechtchanski
On Wed, 19 Jan 2005, David Kramer wrote:

> When I execute commands in the pdksh shell that should set an exit
> value, $? is not being set.  When I use the bash shell, it is.

Please review and follow  to provide
enough information about your installation.

> In pdksh:
> /c/windevel> grep o regexps
> oo
> /c/windevel> echo $?
> 0
> /c/windevel> grep Z regexps
> /c/windevel> echo $?
> 0
>
> [snip bash session]
>
> Grep is just one command I'm using for demonstration.  This is true of
> all commands I've tried so far.  Even when I write my own script and
> exit 1 from it, $? is zero afterwards, which is really hurting my
> automation efforts.

Can't reproduce this here, sorry:

$ pdksh
$ cygcheck -f /bin/pdksh
pdksh-5.2.14-3
$ grep o regexps ; echo $?
oo
0
$ grep Z regexps ; echo $?
1

> Oh, and I have to use a ksh-like shell, because the same scripts need to
> run on an AIX box with ksh and no bash.

Well, this seems to be a problem with your Cygwin installation, but that
aside, using bourne-shell syntax should work for both bash and ksh.

Igor Pechtchanski, Cygwin volunteer PDksh maintainer
-- 
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!

"The Sun will pass between the Earth and the Moon tonight for a total
Lunar eclipse..." -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT

--
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: pdksh not setting $? with exit status of commands

2005-01-19 Thread David Kramer
Dave Korn  artimi.com> writes:

> 
> > -Original Message-
> > From: cygwin-owner On Behalf Of David Kramer
> > Sent: 19 January 2005 15:20
> 
> > When I execute commands in the pdksh shell that should set an 
> > exit value, $? is
> > not being set.  When I use the bash shell, it is.  
> 
>   This one already came up very recently.  Search the list archives.
> 
> cheers, 
>   DaveK

I *did* STFW first.  The closest thread I could find is "negative error status:
gcc vs. cl", which invloves both negative exit values and Windows commands,
neither of which are relevant to my problem.  I'm trying to use Cygwin binaries
inside Cygwin's pdksh shell, and expecting 0 or 1.

If you can recall anything else about the thread you mentioned, I would
appreciate it.  For what it's worth, the search page will not let me search on
"$?".  I tried searching for "ksh exit"

Thanks for your help.



--
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: pdksh not setting $? with exit status of commands

2005-01-19 Thread Dave Korn
> -Original Message-
> From: cygwin-owner On Behalf Of David Kramer
> Sent: 19 January 2005 15:20

> When I execute commands in the pdksh shell that should set an 
> exit value, $? is
> not being set.  When I use the bash shell, it is.  

  This one already came up very recently.  Search the list archives.

cheers, 
  DaveK
-- 
Can't think of a witty .sigline today


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