delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/03/04/15:47:21

To: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
Cc: DJGPP workers <djgpp-workers AT delorie DOT com>
Subject: Re: Fetish.pm band-aid (Fileutils testsuite)
References: <3AA29CC8 DOT F86326A5 AT phekda DOT freeserve DOT co DOT uk>
In-Reply-To: <3AA29CC8.F86326A5@phekda.freeserve.co.uk>
From: Jim Meyering <jim AT meyering DOT net>
Date: 04 Mar 2001 21:43:26 +0100
Message-ID: <urywva5464x.fsf@ixi.eng.ascend.com>
Lines: 110
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.99
MIME-Version: 1.0
Sender: Jim Meyering <meyering AT ascend DOT com>
Reply-To: djgpp-workers AT delorie DOT com

Hi,

It'd be nice to find a portable solution (you must know that using
redir isn't portable).

I suspect perl's `system' is at fault -- though maybe only indirectly
in that it invokes a shell that is not POSIX compliant.
This might work for the first one:

  system "bash -c 'diff -c $actual $expected 2>/dev/null'";

FYI, the quotes from _shell_quote are necessary for the file
names used in some of the tests because those names contain
meta-characters.  If all you care about are the tests with
well-behaved names, you could make _shell_quote a simple no-op
function.  Or you could change it to escape individually any
offending characters.

Jim

Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk> wrote:
| 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