PATCH: bad sed expression

David Relson relson at osagesoftware.com
Sun Jan 5 16:41:11 CET 2003


At 10:37 AM 1/5/03, Clint Adams wrote:

> > Can you explain a bit more fully?  My linux box with bash 2.05 is happy
> > with either form of the sed expression.  What environment are you running
> > on and which sed expression words and which fails for you?
>
>Yes.  I'm trying to run ../../../bogofilter/tests/t.systest.d/t.grftest -v
>so $0 is set to "../../../bogofilter/tests/t.systest.d/t.grftest".
>When this gets passed to sed, the first match to the RE "./t." is
>"r/te", and thus "../../../bogofilter/tests/t.systest.d/t.grftest"
>becomes "../../../bogofiltests/t.systest.d/t.grftest", which is a
>non-existent path.  By making the RE "\./t\.", "./t.blah" will become
>"blah", but "../../../bogofilter/tests/t.systest.d/t.grftest" will be
>unchanged.  This is probably not a good idea either, so perhaps the RE
>should be ".*/t\."
>
>On the other hand, maybe all that branching is unnecessary and you could
>use something like
>
>Index: tests/t.frame
>===================================================================
>RCS file: /cvsroot/bogofilter/bogofilter/tests/t.frame,v
>retrieving revision 1.16.2.1
>diff -u -r1.16.2.1 t.frame
>--- tests/t.frame       2 Jan 2003 14:58:20 -0000       1.16.2.1
>+++ tests/t.frame       5 Jan 2003 15:36:20 -0000
>@@ -13,22 +13,15 @@
>  : ${relpath=..}
>
>  if [ -z "$RUN_FROM_MAKE" ] ; then
>-   NAME=`echo $0 | sed s at ./t.@@`
>-   DATE=`date +"%Y%m%d"`
>-   TMPDIR="$NAME.$DATE"
>-   rm -rf $TMPDIR
>-   mkdir  $TMPDIR
>     SUPPRESS_DELETE="NO"
>-else
>-#   SUPPRESS_DELETE=NO
>+fi
>+
>      while : ; do
>         TMPDIR=./checks.$$.`date +"%Y%m%dT%H%M%S"`
>-       if test x$SUPPRESS_DELETE = xNO ; then TMPDIR=./outputs.`date 
>+"%m%d"` ; fi
>         [ -d $TMPDIR ] || mkdir $TMPDIR
>          [ -d $TMPDIR ] && break
>         sleep 1
>      done
>-fi
>
>  if test "x$SUPPRESS_DELETE" = "x" ; then
>      trap "rm -r -f core ${TMPDIR}" 0





More information about the bogofilter-dev mailing list