parallel: --plus bug in {+.}/{+..}/{+...}.

This commit is contained in:
Ole Tange 2021-11-07 23:09:03 +01:00
parent 06d992e1cf
commit 9b3066e071
15 changed files with 55 additions and 30 deletions

View file

@ -4,6 +4,12 @@
Quote of the month:
GNU parallelという神ツールを発見した
-- @schnell1232@twitter
How I love GNU parallel
-- @dathanvp@twitter Dathan Pattishall
GNU Parallelめっちゃ便利で偉い
-- аiгbus @airbus_P

View file

@ -385,7 +385,7 @@ _parset_main() {
return 255
fi
if [ "$_parset_NAME" = "--version" ] ; then
echo "parset 20211022 (GNU parallel `parallel --minversion 1`)"
echo "parset 20211023 (GNU parallel `parallel --minversion 1`)"
echo "Copyright (C) 2007-2021 Ole Tange, http://ole.tange.dk and Free Software"
echo "Foundation, Inc."
echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>"

View file

@ -384,7 +384,7 @@ _parset_main() {
return 255
fi
if [ "$_parset_NAME" = "--version" ] ; then
echo "parset 20211022 (GNU parallel `parallel --minversion 1`)"
echo "parset 20211023 (GNU parallel `parallel --minversion 1`)"
echo "Copyright (C) 2007-2021 Ole Tange, http://ole.tange.dk and Free Software"
echo "Foundation, Inc."
echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>"

View file

@ -385,7 +385,7 @@ _parset_main() {
return 255
fi
if [ "$_parset_NAME" = "--version" ] ; then
echo "parset 20211022 (GNU parallel `parallel --minversion 1`)"
echo "parset 20211023 (GNU parallel `parallel --minversion 1`)"
echo "Copyright (C) 2007-2021 Ole Tange, http://ole.tange.dk and Free Software"
echo "Foundation, Inc."
echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>"

View file

@ -363,7 +363,7 @@ _parset_main() {
return 255
fi
if [ "$_parset_NAME" = "--version" ] ; then
echo "parset 20211022 (GNU parallel `parallel --minversion 1`)"
echo "parset 20211023 (GNU parallel `parallel --minversion 1`)"
echo "Copyright (C) 2007-2021 Ole Tange, http://ole.tange.dk and Free Software"
echo "Foundation, Inc."
echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>"

View file

@ -365,7 +365,7 @@ _parset_main() {
return 255
fi
if [ "$_parset_NAME" = "--version" ] ; then
echo "parset 20211022 (GNU parallel `parallel --minversion 1`)"
echo "parset 20211023 (GNU parallel `parallel --minversion 1`)"
echo "Copyright (C) 2007-2021 Ole Tange, http://ole.tange.dk and Free Software"
echo "Foundation, Inc."
echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>"

View file

@ -390,7 +390,7 @@ _parset_main() {
return 255
fi
if [ "$_parset_NAME" = "--version" ] ; then
echo "parset 20211022 (GNU parallel `parallel --minversion 1`)"
echo "parset 20211023 (GNU parallel `parallel --minversion 1`)"
echo "Copyright (C) 2007-2021 Ole Tange, http://ole.tange.dk and Free Software"
echo "Foundation, Inc."
echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>"

View file

@ -355,7 +355,7 @@ _parset_main() {
return 255
fi
if [ "$_parset_NAME" = "--version" ] ; then
echo "parset 20211022 (GNU parallel `parallel --minversion 1`)"
echo "parset 20211023 (GNU parallel `parallel --minversion 1`)"
echo "Copyright (C) 2007-2021 Ole Tange, http://ole.tange.dk and Free Software"
echo "Foundation, Inc."
echo "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>"

View file

@ -26,7 +26,7 @@
use strict;
use Getopt::Long;
$Global::progname="niceload";
$Global::version = 20211022;
$Global::version = 20211023;
Getopt::Long::Configure("bundling","require_order");
get_options_from_array(\@ARGV) || die_usage();
if($opt::version) {

View file

@ -2264,7 +2264,7 @@ sub check_invalid_option_combinations() {
sub init_globals() {
# Defaults:
$Global::version = 20211022;
$Global::version = 20211023;
$Global::progname = 'parallel';
$::name = "GNU Parallel";
$Global::infinity = 2**31;
@ -2295,14 +2295,16 @@ sub init_globals() {
# = {.}.{+.} = {+/}/{/.}.{+.}
# = {..}.{+..} = {+/}/{/..}.{+..}
# = {...}.{+...} = {+/}/{/...}.{+...}
'{+/}' => 's:/[^/]*$::',
'{+.}' => 's:.*\.::',
'{+..}' => 's:.*\.([^.]*\.):$1:',
'{+...}' => 's:.*\.([^.]*\.[^.]*\.):$1:',
'{..}' => 's:\.[^/.]+$::; s:\.[^/.]+$::',
'{...}' => 's:\.[^/.]+$::; s:\.[^/.]+$::; s:\.[^/.]+$::',
'{/..}' => 's:.*/::; s:\.[^/.]+$::; s:\.[^/.]+$::',
'{/...}' => 's:.*/::; s:\.[^/.]+$::; s:\.[^/.]+$::; s:\.[^/.]+$::',
'{+/}' => 's:/[^/]*$:: || s:.*$::',
# a.b => b; a => ''
'{+.}' => 's:.*\.:: || s:.*$::',
# a.b.c => b.c; a.b => ''; a => ''
'{+..}' => 's:.*\.([^/.]+\.[^/.]+)$:$1: || s:.*$::',
'{+...}' => 's:.*\.([^/.]+\.[^/.]+\.[^/.]+)$:$1: || s:.*$::',
'{..}' => 's:\.[^/.]+\.[^/.]+$::',
'{...}' => 's:\.[^/.]+\.[^/.]+\.[^/.]+$::',
'{/..}' => 's:.*/::; s:\.[^/.]+\.[^/.]+$::',
'{/...}' => 's:.*/::; s:\.[^/.]+\.[^/.]+\.[^/.]+$::',
# n choose k = Binomial coefficient
'{choose_k}' => 'for $t (2..$#arg){ if($arg[$t-1] ge $arg[$t]) { skip() } }',
# {##} = number of jobs

View file

@ -3293,7 +3293,7 @@ B<--env>:
parallel --env doubleit -S server doubleit ::: 1 2 3 ::: a b
If your environment (aliases, variables, and functions) is small you
can copy the full environment without having to B<export -f>
can copy the full environment without having to B<export -f >
anything. See B<env_parallel>.

View file

@ -122,7 +122,7 @@ GetOptions(
"help" => \$opt::dummy,
) || exit(255);
$Global::progname = ($0 =~ m:(^|/)([^/]+)$:)[1];
$Global::version = 20211022;
$Global::version = 20211023;
if($opt::version) { version(); exit 0; }
@Global::sortoptions = grep { ! /^-D$/ }
shell_quote(@ARGV_before[0..($#ARGV_before-$#ARGV-1)]);

View file

@ -600,7 +600,7 @@ $Global::Initfile && unlink $Global::Initfile;
exit ($err);
sub parse_options {
$Global::version = 20211022;
$Global::version = 20211023;
$Global::progname = 'sql';
# This must be done first as this may exec myself

View file

@ -24,7 +24,14 @@ par_ctagstring() {
parallel --ctagstring 'I{1}\tB{2}' echo ::: 1 ::: a | wc -c
}
par_pct() {
par_plus() {
echo '### --plus'
echo '(It is OK to start with extra / or end with extra .)'
parallel -k --plus echo {} = {+/}/{/} = {.}.{+.} = {+/}/{/.}.{+.} = \
{..}.{+..} = {+/}/{/..}.{+..} = {...}.{+...} = \
{+/}/{/...}.{+...} \
::: a a.b a.b.c a.b.c.d a/1 a.b/1.2 a.b.c/1.2.3 a.b.c.d/1.2.3.4
echo '### Test {%...} {%%...} {#...} {##...}'
a=z.z.z.foo
echo ${a#z*z.}

View file

@ -560,15 +560,6 @@ par_parcat_args_stdin OK2
par_parcat_rm bug #51691: parcat --rm remove fifo when opened
par_parcat_rm OK1
par_parcat_rm OK file removed
par_pct ### Test {%...} {%%...} {#...} {##...}
par_pct z.foo
par_pct z.foo
par_pct foo
par_pct foo
par_pct foo.z
par_pct foo.z
par_pct foo
par_pct foo
par_perlexpr_with_newline Perl expression spanning 2 lines
par_pipe_N1_regexp bug #55131: --regexp --recstart hangs
par_pipe_N1_regexp These should give the same
@ -727,6 +718,25 @@ par_pipepart_recend_recstart 9
par_pipepart_recend_recstart 10
par_pipepart_roundrobin ### bug #45769: --round-robin --pipepart gives wrong results
par_pipepart_roundrobin 2
par_plus ### --plus
par_plus (It is OK to start with extra / or end with extra .)
par_plus a = /a = a. = /a. = a. = /a. = a. = /a.
par_plus a.b = /a.b = a.b = /a.b = a.b. = /a.b. = a.b. = /a.b.
par_plus a.b.c = /a.b.c = a.b.c = /a.b.c = a.b.c = /a.b.c = a.b.c. = /a.b.c.
par_plus a.b.c.d = /a.b.c.d = a.b.c.d = /a.b.c.d = a.b.c.d = /a.b.c.d = a.b.c.d = /a.b.c.d
par_plus a/1 = a/1 = a/1. = a/1. = a/1. = a/1. = a/1. = a/1.
par_plus a.b/1.2 = a.b/1.2 = a.b/1.2 = a.b/1.2 = a.b/1.2. = a.b/1.2. = a.b/1.2. = a.b/1.2.
par_plus a.b.c/1.2.3 = a.b.c/1.2.3 = a.b.c/1.2.3 = a.b.c/1.2.3 = a.b.c/1.2.3 = a.b.c/1.2.3 = a.b.c/1.2.3. = a.b.c/1.2.3.
par_plus a.b.c.d/1.2.3.4 = a.b.c.d/1.2.3.4 = a.b.c.d/1.2.3.4 = a.b.c.d/1.2.3.4 = a.b.c.d/1.2.3.4 = a.b.c.d/1.2.3.4 = a.b.c.d/1.2.3.4 = a.b.c.d/1.2.3.4
par_plus ### Test {%...} {%%...} {#...} {##...}
par_plus z.foo
par_plus z.foo
par_plus foo
par_plus foo
par_plus foo.z
par_plus foo.z
par_plus foo
par_plus foo
par_profile ### Test -J profile, -J /dir/profile, -J ./profile
par_profile local local
par_profile abs abs