anomy-bugs

Problems with the testall.sh script on Solaris.

From: Marvin Solomon (22305@xyz.molar.is)
Date: Wed 09 Apr 2003 - 16:45:58 GMT

  • Next message: Sam Murk: "errors when running testall"

    > Otherwise - if you think something is broken (case 2), please send the
    > following info to 22352@xyz.molar.is:
    >
    > - Architecture (e.g. Sparc, Intel, Alpha. ...)
    > - Operating system (e.g. RedHat 6.2, Solaris 8, HP-UX, ...)
    > - Perl version (the output of "perl -V")
    > - Any relevant Anomy configuration files (e.g. for the sanitizer).
    > - Copies of all result files for the failed tests (they should have the
    > extensions .ok, .out, .diff and .log).
    >
    > Thanks!

    uname -a
        SunOS build 5.7 Generic_106541-21 sun4u sparc SUNW,Ultra-60
    perl -V
        (see below)
    all config files exactly as they come "out of the can".

    I ran into quite a few problems trying to run testall.sh. Most of them were
    due to the fact that the Solaris /bin/sh is somewhat different than other
    versions of sh and quite a bit different from bash (which is what some
    of the
    scripts appear to be expecting), but one problem is perhaps a bit more
    serious:
    a couple of perl scripts start with #!/usr/bin/perl. On my system, perl
    is not
    installed there (in fact, if you follow all the defaults from the perl
    distribution, it goes in /usr/local/bin). There are several ways to get
    around
    this problem. First, the test scripts ought to call the perl scripts by
    explicitly mentioning perl: "perl whatever.pl" rather than "whatever.pl".
    Then it is only required that perl be in the user's path. Second, the perl
    scripts themselves should either be written with a trick such as
        :
        eval 'exec perl -wS $0 ${1+"$@"}'
        if 0;
    or they should be modified by some sort of "configure" step. At the very
    least, there should be some instructions in the documentation to hand-modify
    the appropriate scripts. For now, I just made /usr/bin/perl a symlink,
    but that really shouldn't be necessary.

    Here are the shell problems I found. I've attached a complete set of diffs.
        [ -e xxxx ]
            Solaris "test" doesn't support the -e flag. Use -r instead.
        echo -n xxxx
            Solaris echo doesn't support -n. In some cases, this only
    causes ugly
            output, but in other cases, it causes tests to fail. Use
                echo 'xxx\c'
        export FOO=xxx
            Not supported by Solaris sh. Use
                FOO=xxx
                export FOO
        $(some command)
            Use `some command`
        sanitizer.filenames.hlp starts with #!/bin/bash
            Use #!/bin/sh
        /bin/false is only guaranteed to return a non-zero exit code. A
    couple of
            tests assume it returns 1. On Solaris it returns -1 (which is
            truncated to 255).
        sanitizer.defaults.t expects to see
                rm: cannot remove `./.tmp.*': No such file or directory
            On Solaris, the message is
                ./.tmp.*: No such file or directory
            Other shells product other results. This script should be rewritten
                to be more portable. I just patched the .ok file.

    Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
      Platform:
        osname=solaris, osvers=2.7, archname=sun4-solaris
        uname='sunos concept 5.7 generic_106541-14 sun4u sparc sunw,ultra-60 '
        config_args='-Dinstallprefix=/usr/local/csi/perl5
    -Dprefix=/usr/local/csi'
        hint=recommended, useposix=true, d_sigaction=define
        usethreads=undef use5005threads=undef useithreads=undef
    usemultiplicity=undef
        useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef
        use64bitint=undef use64bitall=undef uselongdouble=undef
      Compiler:
        cc='gcc', ccflags ='-I/usr/local/include -D_LARGEFILE_SOURCE
    -D_FILE_OFFSET_BITS=64',
        optimize='-O',
        cppflags='-I/usr/local/include'
        ccversion='', gccversion='2.8.1', gccosandvers='solaris2.7'
        intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
        d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
        ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
    lseeksize=8
        alignbytes=8, usemymalloc=n, prototype=define
      Linker and Libraries:
        ld='gcc', ldflags =' -L/usr/local/lib '
        libpth=/usr/local/lib /usr/lib /usr/ccs/lib
        libs=-lsocket -lnsl -ldl -lm -lc
        perllibs=-lsocket -lnsl -ldl -lm -lc
        libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
      Dynamic Linking:
        dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
        cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'

    Characteristics of this binary (from libperl):
      Compile-time options: USE_LARGE_FILES
      Built under solaris
      Compiled at Apr 14 2002 04:33:31
      @INC:
        /usr/local/csi/lib/perl5/5.6.1/sun4-solaris
        /usr/local/csi/lib/perl5/5.6.1
        /usr/local/csi/lib/perl5/site_perl/5.6.1/sun4-solaris
        /usr/local/csi/lib/perl5/site_perl/5.6.1
        /usr/local/csi/lib/perl5/site_perl
        .

    ===================================================================
    RCS file: RCS/sanitizer.base64.t,v
    retrieving revision 1.1
    diff -uw -r1.1 sanitizer.base64.t
    --- sanitizer.base64.t 2003/04/09 13:04:20 1.1
    +++ sanitizer.base64.t 2003/04/09 13:32:55
    @@ -11,7 +11,7 @@
     rm -f test.log test.out
     touch test.log test.out
     
    -export BASE64_DATA="\
    +BASE64_DATA="\
     DQoNCg0KAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAJAAAAPgAAACAAAAADAAAAXgAA//BASE64
     AA8AAAACAAAAbQAAH35KUEVHUGhGbAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADIw//BASE64
     6gVnJK8bZBOD1Fak9o9rKxGSuaqTWxYb41+Xvz0rupyja3Q9KlKHLZbD7e5dJVJO//BASE64
    @@ -23,6 +23,7 @@
     Y/E1s2vjHw9clEM91auy53XFv+7U+mUZmP8A3z+VecpbqxBQfLkEHbnac9+P881I//BASE64
     dzbk4E0Lh0HTAOPunkcNg89KoSu2RnOK4zT7m5splurKaSGdcBXQkZ56HjkHHIPB//BASE64
     "
    +export BASE64_DATA
     
     for FLI in 0 1 2; do
         echo "Setting feat_log_inline = $FLI" >>test.out
    @@ -33,7 +34,7 @@
                                    "feat_log_inline = $FLI" \
                                 'file_list_rules = 1' \
                                 'file_name_tpl = /tmp/att-$$$-$F' \
    - 'file_list_1_scanner = 0:1::/bin/false' \
    + 'file_list_1_scanner = 0:1,255::/bin/false' \
                                 'file_list_1_policy = unknown:unknown:unknown:unknown' \
                                 'file_list_1 = .exe$' \
                                  <<EOF 2>>test.log >>test.out
    @@ -70,7 +71,7 @@
     ///BASE64///
     
     EOF
    - echo -n "Total base64 encoded data: " >>test.out
    + echo "Total base64 encoded data:\c" >>test.out
         grep '//BASE64' <test.out | wc >>test.out
         echo "*** Exit code was $? ***" >>test.out
     done
    ===================================================================
    RCS file: RCS/sanitizer.filenames.hlp,v
    retrieving revision 1.1
    diff -uw -r1.1 sanitizer.filenames.hlp
    --- sanitizer.filenames.hlp 2003/04/09 13:55:49 1.1
    +++ sanitizer.filenames.hlp 2003/04/09 13:57:00
    @@ -1,17 +1,17 @@
    -#!/bin/bash
    +#!/bin/sh
     #
     # This is a simple script for testing the advanced FileScan API.
     #
    -SED=$(which sed)
    +SED=`which sed`
     [ "$SED" = "" ] && exit 3
     
     FILE=$1
    -NAME=$(echo "$2" | sed -e 's/\//_/g');
    +NAME=`echo "$2" | sed -e 's/\//_/g'`;
     [ -f "$FILE" ] || exit 1
     [ "$NAME" = "" ] && NAME="$FILE"
     
     FILE2="./.tmp.rep.$$"
    -NAME2=$(echo "$NAME" | sed -e 's/\./_/g').REPLACEMENT.txt
    +NAME2=`echo "$NAME" | sed -e 's/\./_/g'`.REPLACEMENT.txt
     
     cat <<tac >$FILE2 || exit 2
     This is a simple replacement file.
    ===================================================================
    RCS file: RCS/sanitizer.filenames.t,v
    retrieving revision 1.1
    diff -uw -r1.1 sanitizer.filenames.t
    --- sanitizer.filenames.t 2003/04/09 13:33:26 1.1
    +++ sanitizer.filenames.t 2003/04/09 13:42:24
    @@ -15,7 +15,7 @@
     $ANOMY/bin/sanitizer.pl -nofprot $SAN_CONF \
         'feat_force_name = 1' \
         'file_list_rules = 11' \
    - 'file_list_1_scanner = 0:1::/bin/false' \
    + 'file_list_1_scanner = 0:1,255::/bin/false' \
         'file_list_1_policy = unknown^10:unknown^10:unknown:unknown' \
         'file_list_1 = .txt$' \
         'file_list_2_policy = save' \
    ===================================================================
    RCS file: RCS/sanitizer.fprotd.t,v
    retrieving revision 1.1
    diff -uw -r1.1 sanitizer.fprotd.t
    --- sanitizer.fprotd.t 2003/04/09 13:43:17 1.1
    +++ sanitizer.fprotd.t 2003/04/09 13:49:53
    @@ -11,9 +11,9 @@
     rm -f test.log test.out
     touch test.log test.out
     
    -if [ ! -e /usr/local/bin/f-prot ]; then
    +if [ ! -r /usr/local/bin/f-prot ]; then
         # F-Prot not installed, fake a successful run.
    - echo -n "SKIPPED: F-Prot not installed. " >&2
    + echo "SKIPPED: F-Prot not installed. \c" >&2
         cat $TEST_RESULTS/sanitizer.fprotd.ok >test.out
         exit 0
     fi
    ===================================================================
    RCS file: RCS/sanitizer.msg-crlf.t,v
    retrieving revision 1.1
    diff -uw -r1.1 sanitizer.msg-crlf.t
    --- sanitizer.msg-crlf.t 2003/04/09 13:44:55 1.1
    +++ sanitizer.msg-crlf.t 2003/04/09 13:47:20
    @@ -9,7 +9,7 @@
     
     tac
     
    -CRHACK=$(perl -e 'print "\rX-Evil-Header: boo";')
    +CRHACK=`perl -e 'print "\rX-Evil-Header: boo";'`
     
     rm -f ./.tmp.* test.log test.out
     for a in 0 1 2 3; do
    ===================================================================
    RCS file: RCS/testall.sh,v
    retrieving revision 1.1
    diff -uw -r1.1 testall.sh
    --- testall.sh 2003/04/08 20:54:39 1.1
    +++ testall.sh 2003/04/09 14:00:32
    @@ -10,11 +10,11 @@
     
     # Do we have/need the TNEF stuff?
     TNEF=0
    -[ -e ../bin/Anomy/TNEFStream.pm ] && TNEF=1
    +[ -r ../bin/Anomy/TNEFStream.pm ] && TNEF=1
     
     # Check prerequisites.
     #
    -echo -n "Checking prerequisites... "
    +echo "Checking prerequisites... \c"
     REQ="-MDigest::MD5 -MMIME::Base64 -MMIME::QuotedPrint -MIO::File"
     [ $TNEF = 1 ] && REQ="$REQ -MMIME::Body"
     perl $REQ -e1 2>/dev/null
    @@ -68,7 +68,7 @@
     for a in *.t; do
       if [ "$WHICH" = "" -o "$a" = "$WHICH" ]; then
             test=`echo $a |sed -e 's/\.t$//'`
    - /bin/echo -n "$test: "
    + /bin/echo "$test: \c"
             sh $a
             if [ ! -f "$TEST_RESULTS/$test.ok" ]; then
                 cp test.out "$TEST_RESULTS/$test.ok"
    @@ -83,7 +83,7 @@
                         mv -f $t "$TEST_RESULTS"/`echo $t |sed -e "s/^test/$test/"`
                     done
                     echo "failed (moved result files to $TEST_RESULTS)"
    - let FAILED=$FAILED+1
    + FAILED=`expr $FAILED + 1`
                 fi
             fi
       fi
    ===================================================================
    RCS file: RCS/sanitizer.defaults.ok,v
    retrieving revision 1.1
    diff -uw -r1.1 sanitizer.defaults.ok
    --- sanitizer.defaults.ok 2003/04/09 13:39:02 1.1
    +++ sanitizer.defaults.ok 2003/04/09 13:39:37
    @@ -215,4 +215,4 @@
     
     --=ABACAB:=_0006@@UtD0uere5ZCIrVlOp0vV--
     *** Exit code was 0 ***
    -rm: cannot remove `./.tmp.*': No such file or directory
    +./.tmp.*: No such file or directory



    hosted by molar.is