Wireshark mailing list archives

Re: checkhf.pl fails only on pre-commit hook


From: Hadriel Kaplan <hadriel.kaplan () oracle com>
Date: Fri, 4 Apr 2014 23:49:07 -0400


Change this at line 563 in checkhf.pl:

    for my $k (sort keys %{$href}) {
        printf "%-40.40s %5.5s %s\n", $title, $href->{$k} // "undef", $k;
    }

to this:

    for my $k (sort keys %{$href}) {
        my $h = ($href->{$k}) ?  $href->{$k} : "undef";
        printf "%-40.40s %5.5s %s\n", $title, $h, $k;
    }

It's infinitesimally worse performance, but it's perl so that hardly matters.
;)

-hadriel


On Apr 4, 2014, at 11:42 PM, Hadriel Kaplan <hadriel.kaplan () oracle com> wrote:


What version of Perl do you have?  I think that line 564's logical-or only became available in Perl 5.10.

(it's not a regex search, but a ternary conditional-or apparently, because, ya know... Perl can't possibly have only 
20 ways of doing something when it could instead have 21 ways... and at the same time get the bonus of re-using 
common character syntax used for completely different purposes; otherwise what fun would Perl be if it were easy to 
debug?)

-hadriel


On Apr 4, 2014, at 11:35 PM, Hadriel Kaplan <hadriel.kaplan () oracle com> wrote:


On Apr 4, 2014, at 11:26 PM, Hadriel Kaplan <hadriel.kaplan () oracle com> wrote:

I barely know perl, but checkhf.pl line 564 does indeed look bogus to me. (the double slashes are what it thinks is 
starting a regex search pattern that's not terminated I believe)

Actually, no it's fine. I don't know why your computer's choking on it.

I even tried running it with the debug option for all the valid numbers and it's working fine for me.

Weird.


Having said that, that function shouldn't be being called/invoked, afaict.  It's only supposed to be invoked if the 
command to run that script uses a "--debug=<number>" or "-d <number>" option I think. And the pre-commit script 
does not do that. Unless $FILE is somehow a string that appears to be that option?  Try putting a 'echo $FILE' in 
the pre-commit script before the "./tools/checkhf.pl $FILE" line and see what it's printing out when you do 'git 
commit'.  Maybe something weird is going on with the 'git diff-index ... | grep ...' result?

-hadriel

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
          mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
           mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
            mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe


Current thread: