[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fix AT_SETUP's sh-escaping

From: Ralf Wildenhues
Subject: Re: fix AT_SETUP's sh-escaping
Date: Thu, 9 Nov 2006 19:00:56 +0100
User-agent: Mutt/1.5.13 (2006-11-01)

* Paul Eggert wrote on Thu, Nov 09, 2006 at 07:00:56AM CET:
> "Joel E. Denny" <address@hidden> writes:
> > However, I get FAILED for 67 (Backslash in a test title).  Here's an 
> > update to your patch that fixes it:
> By inspection I noticed some other bugs in that area.  The shell
> quoting was wrong (unportable) in several places; I suppose this might
> explain the failure symptoms on other platforms.  I installed this:

Several comments:
1) I don't see how Paul's quoting changes actually fix a portability
issue, but it's pretty clear that they don't hurt.

2) The change to use $CONFIG_SHELL for the micro-suite may help for
consistent (mis)treatment of backslashes by 'echo' within the outer
and the inner testsuite.  However, it does not help wrt. the desired
behavior: that backslashes are output unchanged by the testsuite.

I started on a fix for (2) by turning AT_CHECK_AT_TITLE to use an
'expout' file, so that the backslash killer inside _AT_CHECK:
  echo "m4_ifval([$7],[AS_ESCAPE([$3])],[$3])" | $at_diff - "$at_stdout" || 

is avoided.  This helps things on some but not all systems, e.g. OpenBSD
will still fail test 67.  So then I delved into lib/autotest/general.m4
to try to kill echos in there, came up with waaay ugly and probably
nonportable things like

cat <<_ATEOF | awk 'BEGIN { FS = ";" }
         NR == 1 {
           for (n = split($ 0, a, " "); n; n--) selected[a[n]] = 1
           if (selected[$ 1]) {
             printf " %3d: %-18s %s\n", $ 1, $ 2, $ 3
             if ($ 4) printf "      %s\n", $ 4

At this point I noticed that not only is the contents of $at_help_all
used in several other context with 'echo' (see the keywords handling),
but also the test titles are output with 'echo', and so on.

At which point I gave up.  I think using cat and here-documents
everywhere is a complete waste.  IMHO we should document that
backslashes in AT_SETUP's argument are dangerous (who would need that
anyway?), disable the test (because it will pass when all echos in use
do not interpret backslashes), and revisit the issue once we can assume
'printf' to be portable.

Would you agree?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]