From 57538c384e3a0f9f45dc31eadb5e28ca798afcdd Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Sun, 27 May 2012 17:51:09 +0200 Subject: [PATCH] parallel: Bug fixes for --tollef compatibility. --- configure | 20 ++++++++++---------- configure.ac | 2 +- src/niceload | 2 +- src/parallel | 36 ++++++++++++++++++++++-------------- src/parallel.pod | 11 +++++++++-- src/parallel.texi | 11 +++++++++-- src/sql | 2 +- testsuite/Makefile | 2 +- 8 files changed, 54 insertions(+), 32 deletions(-) diff --git a/configure b/configure index 069525c5..46077594 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for parallel 20120522. +# Generated by GNU Autoconf 2.68 for parallel 20120524. # # Report bugs to . # @@ -559,8 +559,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='parallel' PACKAGE_TARNAME='parallel' -PACKAGE_VERSION='20120522' -PACKAGE_STRING='parallel 20120522' +PACKAGE_VERSION='20120524' +PACKAGE_STRING='parallel 20120524' PACKAGE_BUGREPORT='bug-parallel@gnu.org' PACKAGE_URL='' @@ -1176,7 +1176,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures parallel 20120522 to adapt to many kinds of systems. +\`configure' configures parallel 20120524 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1242,7 +1242,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of parallel 20120522:";; + short | recursive ) echo "Configuration of parallel 20120524:";; esac cat <<\_ACEOF @@ -1309,7 +1309,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -parallel configure 20120522 +parallel configure 20120524 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1326,7 +1326,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by parallel $as_me 20120522, which was +It was created by parallel $as_me 20120524, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2141,7 +2141,7 @@ fi # Define the identity of the package. PACKAGE='parallel' - VERSION='20120522' + VERSION='20120524' cat >>confdefs.h <<_ACEOF @@ -2704,7 +2704,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by parallel $as_me 20120522, which was +This file was extended by parallel $as_me 20120524, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -2766,7 +2766,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -parallel config.status 20120522 +parallel config.status 20120524 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 6aa80941..37ab4d4a 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([parallel], [20120522], [bug-parallel@gnu.org]) +AC_INIT([parallel], [20120524], [bug-parallel@gnu.org]) AM_INIT_AUTOMAKE([-Wall -Werror foreign]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([ diff --git a/src/niceload b/src/niceload index 33ef127f..4b0de4b6 100755 --- a/src/niceload +++ b/src/niceload @@ -24,7 +24,7 @@ use strict; use Getopt::Long; $Global::progname="niceload"; -$Global::version = 20120522; +$Global::version = 20120524; Getopt::Long::Configure("bundling","require_order"); get_options_from_array(\@ARGV) || die_usage(); if($::opt_version) { diff --git a/src/parallel b/src/parallel index bc5127fb..7bb84934 100755 --- a/src/parallel +++ b/src/parallel @@ -489,7 +489,7 @@ sub get_options_from_array { @::ARGV = @{$array_ref}; } my @retval = GetOptions(options_hash()); - if(not $this_is_ARGV) { + if(not $this_is_ARGV) { @{$array_ref} = @::ARGV; @::ARGV = @save_argv; } @@ -499,7 +499,7 @@ sub get_options_from_array { sub parse_options { # Returns: N/A # Defaults: - $Global::version = 20120523; + $Global::version = 20120527; $Global::progname = 'parallel'; $Global::infinity = 2**31; $Global::debug = 0; @@ -605,9 +605,27 @@ sub parse_options { wait_and_exit(0); } } + if($::opt_tollef and not $::opt_gnu) { + # Behave like tollef parallel (from moreutils) + $::opt_u = 1; + $Global::grouped = 0; + $Global::quoting = 1; + $::opt_q = 1; + if(defined $::opt_l) { + $::opt_load = $::opt_l; + $::opt_l = undef; + } + if(not defined $::opt_arg_sep) { + $Global::arg_sep = "--"; + } + if(not grep(/$Global::arg_sep/, @ARGV)) { + unshift(@ARGV, $ENV{SHELL}, "-c", "--"); + } + } + if(defined $::opt_nonall) { # Append a dummy empty argument - push @ARGV, ":::", ""; + push @ARGV, $Global::arg_sep, ""; } if(defined $::opt_tty) { # Defaults for --tty: -j1 -u @@ -624,16 +642,6 @@ sub parse_options { $::opt_transfer = 1; $::opt_cleanup = 1; } - if($::opt_tollef and not $::opt_gnu) { - # Behave like tollef parallel (from moreutils) - if(defined $::opt_l) { - $::opt_load = $::opt_l; - $::opt_l = undef; - } - if(not defined $::opt_arg_sep) { - $Global::arg_sep = "--"; - } - } if(defined $::opt_l) { if($::opt_l eq "-0") { # -l -0 (swallowed -0) @@ -781,7 +789,7 @@ sub read_options { $ARGV[0]=~s/^--hashbang *//; # remove --hashbang if it is set my $argfile = pop @ARGV; # exec myself to split $ARGV[0] into separate fields - exec "$0 --skip-first-line -a $argfile @ARGV"; + exec "tail -n +1 $argfile | $0 @ARGV"; } Getopt::Long::Configure("bundling","pass_through"); diff --git a/src/parallel.pod b/src/parallel.pod index 85f2f27d..e952680c 100644 --- a/src/parallel.pod +++ b/src/parallel.pod @@ -1226,8 +1226,15 @@ later, followed by SIGKILL 200 ms later. =item B<--tollef> -Make GNU B behave like Tollef's parallel command. To -override use B<--gnu>. +Make GNU B behave more like Tollef's parallel command. It +activates B<-u>, B<-q>, and B<--arg-sep -->. It also causes B<-l> to +change meaning to B<--load>. + +Not giving '--' is unsupported. + +B. + +To override use B<--gnu>. =item B<--verbose> diff --git a/src/parallel.texi b/src/parallel.texi index 4adf90ea..2efc1340 100644 --- a/src/parallel.texi +++ b/src/parallel.texi @@ -1306,8 +1306,15 @@ later, followed by SIGKILL 200 ms later. @item @strong{--tollef} @anchor{@strong{--tollef}} -Make GNU @strong{parallel} behave like Tollef's parallel command. To -override use @strong{--gnu}. +Make GNU @strong{parallel} behave more like Tollef's parallel command. It +activates @strong{-u}, @strong{-q}, and @strong{--arg-sep --}. It also causes @strong{-l} to +change meaning to @strong{--load}. + +Not giving '--' is unsupported. + +@strong{Do not use --tollef unless you know what you are doing}. + +To override use @strong{--gnu}. @item @strong{--verbose} @anchor{@strong{--verbose}} diff --git a/src/sql b/src/sql index f14b916c..33eaf132 100755 --- a/src/sql +++ b/src/sql @@ -556,7 +556,7 @@ $Global::Initfile && unlink $Global::Initfile; exit ($err); sub parse_options { - $Global::version = 20120522; + $Global::version = 20120524; $Global::progname = 'sql'; # This must be done first as this may exec myself diff --git a/testsuite/Makefile b/testsuite/Makefile index 087fe530..dbbf558e 100644 --- a/testsuite/Makefile +++ b/testsuite/Makefile @@ -45,7 +45,7 @@ portable: sudo echo time bash Portable.sh -timings: tests-to-run/* +timings: tests-to-run/* ../src/parallel ls tests-to-run/*.sh | xargs -n1 echo /usr/bin/time -f %e bash >/tmp/timing.script stdout bash -x /tmp/timing.script >/tmp/timing.out echo usr.bin.time_END >>/tmp/timing.out