duncs / clusterssh

Cluster SSH - Cluster Admin Via SSH
https://github.com/duncs/clusterssh/wiki
896 stars 79 forks source link

Multiple ranges no longer working #97

Closed lazyfrosch closed 6 years ago

lazyfrosch commented 6 years ago

Cluster Example:

test icinga{a,b}-test{1,2}

Error:

Unescaped left brace in regex is illegal here in regex; marked by <-- HERE in m/\{a,b}-test{ <-- HERE 1,2\}/ at /usr/share/perl5/App/ClusterSSH/Range.pm line 84.

This worked without a problem before. I'm on 4.10_02 on Debian testing (buster)

lazyfrosch commented 6 years ago

My quick fix: Make the RegExp non-greedy

--- /usr/share/perl5/App/ClusterSSH/Range.pm.orig   2017-11-17 15:36:50.900955097 +0100
+++ /usr/share/perl5/App/ClusterSSH/Range.pm    2017-11-17 15:36:55.908944004 +0100
@@ -68,7 +68,7 @@
             next;
         }

-        my ( $base, $spec ) = $item =~ m/^(.*?\{(.*)\}.*?)$/;
+        my ( $base, $spec ) = $item =~ m/^(.*?\{(.*?)\}.*?)$/;

         for my $section ( split( /,/, $spec ) ) {
             my ( $start, $end );
lazyfrosch commented 6 years ago

Oh btw. it works with single patterns:

test icinga-test{2,3}
duncs commented 6 years ago

Thanks for the report and the fix - this has been pushed to the git repo