www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2005/01/01/18:03:59

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Authentication-Warning: itservs.wilkes.edu: apache set sender to fdonahoe AT wilkes DOT edu using -f
Message-ID: <1104619376.41d727700c0c5@webmail.wilkes.edu>
Date: Sat, 1 Jan 2005 17:42:56 -0500
From: fdonahoe AT wilkes DOT edu
To: djgpp-workers AT delorie DOT com
Cc: Andrew Cottrell <andy AT exemail DOT com DOT au>
Subject: Re: Strange failure of egrep stub
MIME-Version: 1.0
User-Agent: Internet Messaging Program (IMP) 3.2
X-Originating-IP: 146.94.1.203
Reply-To: djgpp-workers AT delorie DOT com

Quoting Eli Zaretskii <eliz AT gnu DOT org>:

> > Date: Fri, 31 Dec 2004 17:07:48 -0500
> > From: fdonahoe AT wilkes DOT edu
> > 
> > The failure came on the very first time egrep was invoked.
> > Rewritten as:
> > 
> > egrep 'This is (ifnothtml|ifinfo|ifnottex) text' cond.out \
> >   >./cond-1 || exit 2
> > 
> > fails with 0 bytes in cond-1.
> 
> My first guess would be that we have some snafu with redirection.
> 
> Let's first find out whether the problem is at all with egrep. 
> What version of Bash do you have installed, and does the behavior 
> change if you use a different version of Bash?

bash 2.05b.  I was using a bash which I compiled myself from
bsh205bs using djdev 2.04.  Substituting the bash.exe from the
binary distribution bsh205bb which was compiled using djdev 2.03
makes no difference in the outcome of the test.

> .........  (I understand
> that the same command works if invoked from the cmd.exe prompt,
> right?  That is, assuming that you replace single quotes with
> double quotes, to prevent the `|' characters from being
> interpreted by cmd.exe.)
> 
I have to look very closely at the original text, but those
quotes have always been double quotes.  From the command
prompt I gave the command:
    .../tests> egrep 'This is (ifnothtml|ifinfo|ifnottex) text'
cond.out > cond-1

and compared `cond-1' with the result produced by the successful
run with Andy's grep.exe

> > grep is never given the chance to produce its output which
> > would be correct!  If grep -E be substituted for egrep in
> > all four instances, cond-[1-4] are left with correct data
> > and the whole test is passed.
> 
> What is egrep in your setup?  Is it a Bash shell script that
> invokes "grep -E" or something else?
> 
It is a 2K stub produced by

stubify -g egrep.exe
stubedit egrep.exe runfile=grep argv0=egrep

> > My conclusion is that egrep.exe invokes the djgpp2/coff grep
> > differently from the unsuopported coff grep, so that exit 2
> > happens before grep produces its output.
> 
> Sorry, I cannot understand this.  What is djgpp2/coff and what
> is ``unsupported coff grep'', and how is their invocation
> relevant to this problem?
> 
Sorry, I was grasping at straws there.  The only measureable
difference between the two greps, aside from byte count and
time stamp was that one was compressible with UPX and the
other wasn't.  It is not significant.  I compliled a grep.exe
which UPX refuses to compile and it fails just as the one which
can be compressed fails.

You may remember that the grep package 2.5.1a built two 35 byte 
shell scripts called `egrep' and `fgrep.'  egrep contains:

#!/bin/sh
exec grep -E ${1+"$@"}

Well, grep invoked this way passes the test.

Andrew Cottrell, where is the source of the grep binary of
Nov 17, 2003?

Regards,
Frank


-----------------------------------------------------------------------
This mail was sent through Wilkes Webmail: http://webmail.wilkes.edu
Wilkes Webmail is using IMP: http://horde.org/imp/

- Raw text -


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