On 22 Jul 1998 [EMAIL PROTECTED] wrote:

>1. There is no plain "...\1..." or such a string
>   in APACIs configure script anywhere. We use
>   "...\\1..." which is correct and should not
>   lead to problems.

I'm sure no great shell programmer, but let me try to explain again. My
"echo" (all three of them, the bash builtin, /bin/echo and /usr/bin/echo)
interpret the backslash sequences by default. The "configure" script uses
constructs like this:

echo "...\\1..." > file

If I get this right the shell parses the "...\\1..." as ...\1... and
passes it along to echo. The echo replaces the \1 with ASCII(1) then. 
Normally echo doesn't replace the \1 unless called with "echo -e" but mine
does. 

Here's an example:

# module=something
# echo "s%^.*\\(SharedModule.*$module\\..*\\)%# \\1%g" > echotest
# echo -E "s%^.*\\(SharedModule.*$module\\..*\\)%# \\1%g" >> echotest
# /bin/echo "s%^.*\\(SharedModule.*$module\\..*\\)%# \\1%g" >> echotest
# /bin/echo -E "s%^.*\\(SharedModule.*$module\\..*\\)%# \\1%g" >> echotest
# /usr/bin/echo "s%^.*\\(SharedModule.*$module\\..*\\)%# \\1%g" >> echotest
# /usr/bin/echo -E "s%^.*\\(SharedModule.*$module\\..*\\)%# \\1%g" >> echotest

Here the resulted "echotest" file (also attached in case it gets mangled
by the mailer):

s%^.*\(SharedModule.*something\..*\)%# %g
s%^.*\(SharedModule.*something\..*\)%# \1%g
s%^.*\(SharedModule.*something\..*\)%# %g
s%^.*\(SharedModule.*something\..*\)%# \1%g
s%^.*\(SharedModule.*something\..*\)%# %g
s%^.*\(SharedModule.*something\..*\)%# \1%g

>2. We tested the stuff under Linux and none of
>   our boxes shows the problem.
>
>So either your /bin/echo is broken or there is
>another subtle difference between your Linux box
>and yours. I've for instance tested under Debian 1.3
>and others under RedHat 5.1.

I know my bash-echo is non-default, because I compiled it myself. About
the other echos I can't remember though. But I may not be the only one
with a "broken" echo and it's easy to fix in the "configure" script by
making the echo command customizable. 

>OTOH we cannot easily replace echo by an own
>$ECHO in a very protable way because how should
>check which echo works fine. Even the -E is not
>portable.

I know it's not, that's why I suggested to use a variable $ECHO. I didn't
mean to check for it automatically, but then people like me with broken
echos have to change a single like in the configure script to get it
working. I suggest adding a comment:

# Change this to "echo -E" if your echo is broken
ECHO=echo

and a short comment in some README file:

"If configure fails with:

Syntax error --- The configuration file is used only to
define the list of included modules or to set Makefile in src
options or Configure rules, and I don't see that at all:
[...]

replace "ECHO=echo" with "ECHO=echo -E" in the configure script."


If you *do* want to test for it automatically, you could do it by running: 

echo "\\101" > testfilefile

for example. If the resulting tesfile is two bytes (and contains "A" and
"RET") then you need echo -E. If it's 5 bytes and contains "\101" "RET" 
it's ok. 


Or here's another one:

# echo "\\101" | wc -c
      2
# echo -E "\\101" | wc -c
      5

Or another:

if [ `echo -n "\\101"` != "\\101" ]; then
  echo "Your echo is broken, using \"echo -E\""
  ECHO="echo -E"
else
  echo "\"echo\" looks fine."
  ECHO="echo"
fi

Or:

if [ `echo -n "\\101"` = "A" }; then
...

>So please check again your system and
>either provide us with more details (exactly
>which construct in configure makes the problem)
>or try to fix your (perhaps) broken /bin/echo.

As for me, I did a simple "%s/echo/echo -E/g" on the configure script and
this fixed it. But like I said, I think others may not be able to find out
how to get it running that easy. At least add a note to some README file
pointing out the problem, I can't believe it I'm the only one with a
non-default echo ;)

>Please reply with more information. Thanks.

Hope it was understandable now :-)
Andi
s%^.*\(SharedModule.*something\..*\)%# %g
s%^.*\(SharedModule.*something\..*\)%# \1%g
s%^.*\(SharedModule.*something\..*\)%# %g
s%^.*\(SharedModule.*something\..*\)%# \1%g
s%^.*\(SharedModule.*something\..*\)%# %g
s%^.*\(SharedModule.*something\..*\)%# \1%g

Reply via email to