delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/03/04/14:52:43

Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3AA29CC8.F86326A5@phekda.freeserve.co.uk>
Date: Sun, 04 Mar 2001 19:51:36 +0000
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.17 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: DJGPP workers <djgpp-workers AT delorie DOT com>,
Jim Meyering <meyering AT ascend DOT com>
Subject: Fetish.pm band-aid (Fileutils testsuite)
Reply-To: djgpp-workers AT delorie DOT com

Hello.

I've been having trouble getting parts of the Fileutils test suite to
work. Some of the tests use Fetish.pm, which seems to have problems with
DJGPP:

1. _shell_quote() generates file names enclosed in single quotes. The
input file names are quoted using _shell_quote(). The Perl system() call
to generate test input then fails with the error "Cannot redirect input:
No such file or directory (ENOENT)". Presumably because this is because
the file name gets passed on the command-line with single quotes, but the
actual file has a file name with no quotes.

2. There seems to be a problem using '2> /dev/null' with the Perl system()
call. "Ambiguous redirect" errors are generated.

These problems seem related. I wonder what Perl's system() call does for
the DJGPP port. Does DJGPP's system() call support '2> /dev/null'-style
redirection, or is it implemented by bash?

Anyhow, please find below a band-aid that uses DJGPP's 'redir' to get
round the problem. This may help whoever ports Sh-utils and Textutils
(Prashant IIRC), since Fetish.pm says it's used in their testsuites.

How I encountered the problems with Fetish.pm. I am using DJGPP 2.03, bash
2.04, Perl 5.005_02. I tried to use the 'dd' testsuite from Fileutils
4.0.40 to test 'dd' from the Fileutils 4.0 DJGPP port I'm working on. With
a similar patch (exactly same changes, but Fetish.pm is newer in 4.0.40)
the ported 'dd' passes 'misc', 'skip-seek' and 'skip-seek2'. It fails
'not-rewound' - I think because of redirection issues in the script.

Thanks, bye, Rich =]

*** orig/fileutils-4.0.40/tests/Fetish.pm       Sun Nov 26 23:04:40 2000
--- gnu.dev/fileutils-4.0.40/tests/Fetish.pm    Sun Mar  4 18:25:44 2001
*************** sub _compare_files ($$$$$)
*** 102,108 ****
        warn "$program_name: test $test_name: ${info}mismatch, comparing "
        . "$actual (actual) and $expected (expected)\n";
        # Ignore any failure, discard stderr.
!       system "diff -c $actual $expected 2>/dev/null";
      }
  
    return $differ;
--- 102,109 ----
        warn "$program_name: test $test_name: ${info}mismatch, comparing "
        . "$actual (actual) and $expected (expected)\n";
        # Ignore any failure, discard stderr.
!       #system "diff -c $actual $expected 2>/dev/null";
!       system "redir -e /dev/null diff -c3 $actual $expected";
      }
  
    return $differ;
*************** sub run_tests ($$$$$)
*** 300,306 ****
  
          if ($type eq 'IN')
            {
!             push @args, _shell_quote $file;
            }
          elsif ($type eq 'AUX' || $type eq 'OUT' || $type eq 'ERR')
            {
--- 301,308 ----
  
          if ($type eq 'IN')
            {
!             #push @args, _shell_quote $file;
!             push @args, $file;
            }
          elsif ($type eq 'AUX' || $type eq 'OUT' || $type eq 'ERR')
            {
*************** sub run_tests ($$$$$)
*** 344,350 ****
        $tmp{OUT} = "$test_name.O";
        $tmp{ERR} = "$test_name.E";
        push @junk_files, $tmp{OUT}, $tmp{ERR};
!       my @cmd = ($prog, @args, "> $tmp{OUT}", "2> $tmp{ERR}");
        my $cmd_str = join ' ', @cmd;
        warn "Running command: `$cmd_str'\n" if $debug;
        my $rc = 0xffff & system $cmd_str;
--- 346,353 ----
        $tmp{OUT} = "$test_name.O";
        $tmp{ERR} = "$test_name.E";
        push @junk_files, $tmp{OUT}, $tmp{ERR};
!       #my @cmd = ($prog, @args, "> $tmp{OUT}"), "2> $tmp{ERR}");
!       my @cmd = ("redir", "-e", $tmp{ERR}, $prog, @args, "> $tmp{OUT}");
        my $cmd_str = join ' ', @cmd;
        warn "Running command: `$cmd_str'\n" if $debug;
        my $rc = 0xffff & system $cmd_str;

- Raw text -


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