Skip Menu |

This queue is for tickets about the Perl-Tidy CPAN distribution.

Report information
The Basics
Id: 133130
Status: resolved
Priority: 0/
Queue: Perl-Tidy

People
Owner: Nobody in particular
Requestors: ShriverSteve [...] prahs.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Bug in latest version, 20200619
Date: Sat, 8 Aug 2020 00:03:10 +0000
To: "bug-Perl-Tidy [...] rt.cpan.org" <bug-Perl-Tidy [...] rt.cpan.org>
From: "Shriver, Steve" <ShriverSteve [...] prahs.com>
Greetings, Using the latest version available from CPAN cpanm --local-lib=~/perl5 Perl::Tidy --> Working on Perl::Tidy Fetching http://www.cpan.org/authors/id/S/SH/SHANCOCK/Perl-Tidy-20200619.tar.gz ... OK Configuring Perl-Tidy-20200619 ... OK Building and testing Perl-Tidy-20200619 ... OK Successfully installed Perl-Tidy-20200619 (upgraded from 20191203) 1 distribution installed Making sure to run the new version: ~/perl5/bin/perltidy --version This is perltidy, v20200619 I run the command against a file and get the following error: ~/perl5/bin/perltidy -b -bext="/" -log -pro=.../perltidyrc load_data Use of uninitialized value $Perl::Tidy::Formatter::SUB_PATTERN in concatenation (.) or string at /home/shriversteve/perl5/lib/perl5/Perl/Tidy/Formatter.pm line 6581. However, the previous version of perltidy works, /opt/prism/perl5/perlbrew/perls/current/bin/perltidy --version This is perltidy, v20191203 /opt/prism/perl5/perlbrew/perls/current/bin/perltidy -b -bext='/' -log -pro=.../perltidyrc load_data ls -lart load* -rw-r--r-- 1 shriversteve domain users 1.6K Aug 7 16:20 load_data.LOG -rwxr-xr-x 1 shriversteve domain users 5.9K Aug 7 16:20 load_data* I have not defined sub-alias-list in my perltidyrc file. Do you need to see my config file? (reading the module) Just guessing, but is it possible that make_block_pattern() (where the error occurs) is getting called before make_sub_matching_pattern()? (read the file more) Well, in check_options(), make_closing_side_comment_list_pattern() is called earlier. Dunno, just a thought. Hope this helps. Smile, Steve
Subject: Re: [rt.cpan.org #133130] AutoReply: Bug in latest version, 20200619
Date: Sat, 8 Aug 2020 00:28:38 +0000
To: "bug-Perl-Tidy [...] rt.cpan.org" <bug-Perl-Tidy [...] rt.cpan.org>
From: "Shriver, Steve" <ShriverSteve [...] prahs.com>
Hey, Found the error, or the difference at least. In Perl::Tidy::Formatter version 20200110, the $SUB_PATTERN is defined in the BEGIN block, at line 441. However, this chunk (434..442) appears to have been removed from the BEGIN block of version 20200619, and is in make_sub_matching_pattern(). Hope this helps! Smile, Steve PS -- to test my theory, I did a backup and modified the file like this: diff -wu /home/shriversteve/perl5/lib/perl5/Perl/Tidy/Formatter.pm.* /home/shriversteve/perl5/lib/perl5/Perl/Tidy/Formatter.pm --- /home/shriversteve/perl5/lib/perl5/Perl/Tidy/Formatter.pm.20200807_172243 2020-08-07 17:22:43.190403952 -0700 +++ /home/shriversteve/perl5/lib/perl5/Perl/Tidy/Formatter.pm 2020-08-07 17:23:05.695249002 -0700 @@ -373,6 +373,16 @@ @q = qw< } ) ] >; @is_closing_token{@q} = (1) x scalar(@q); + # Patterns for standardizing matches to block types for regular subs and + # anonymous subs. Examples + # 'sub process' is a named sub + # 'sub ::m' is a named sub + # 'sub' is an anonymous sub + # 'sub:' is a label, not a sub + # 'substr' is a keyword + $SUB_PATTERN = '^sub\s+(::|\w)'; # match normal sub + $ASUB_PATTERN = '^sub$'; # match anonymous sub + $ANYSUB_PATTERN = '^sub\b'; # match either type of sub } # whitespace codes The patched file works correctly. __ Not sure if that is how you would want to do it, but it follows the pattern of the previous verison. Cheers! On 07/Aug/20, 8:04 PM, "Bugs in Perl-Tidy via RT" <bug-Perl-Tidy@rt.cpan.org> wrote: Greetings, This message has been automatically generated in response to the creation of a trouble ticket regarding: "Bug in latest version, 20200619", a summary of which appears below. There is no need to reply to this message right now. Your ticket has been assigned an ID of [rt.cpan.org #133130]. Your ticket is accessible on the web at: https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Frt.cpan.org%2FTicket%2FDisplay.html%3Fid%3D133130&amp;data=02%7C01%7CShriverSteve%40prahs.com%7C4418817a29a2414b5b2e08d83b2ea283%7C1cef9a5962ec418a96662b3afc2d2cb0%7C0%7C1%7C637324418772547135&amp;sdata=afJc6xAOxrZrQrw%2FvnNImfHIuTBUXoS%2BYBuUMHeJCnM%3D&amp;reserved=0 Please include the string: [rt.cpan.org #133130] in the subject line of all future correspondence about this issue. To do so, you may reply to this message. Thank you, bug-Perl-Tidy@rt.cpan.org ------------------------------------------------------------------------- Greetings, Using the latest version available from CPAN cpanm --local-lib=~/perl5 Perl::Tidy --> Working on Perl::Tidy Fetching https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.cpan.org%2Fauthors%2Fid%2FS%2FSH%2FSHANCOCK%2FPerl-Tidy-20200619.tar.gz&amp;data=02%7C01%7CShriverSteve%40prahs.com%7C4418817a29a2414b5b2e08d83b2ea283%7C1cef9a5962ec418a96662b3afc2d2cb0%7C0%7C1%7C637324418772547135&amp;sdata=euwqjNv6ySZmsnW1M3IxK%2FIPKWkWIPR3Hbg6L%2BXcPM8%3D&amp;reserved=0 ... OK Configuring Perl-Tidy-20200619 ... OK Building and testing Perl-Tidy-20200619 ... OK Successfully installed Perl-Tidy-20200619 (upgraded from 20191203) 1 distribution installed Making sure to run the new version: ~/perl5/bin/perltidy --version This is perltidy, v20200619 I run the command against a file and get the following error: ~/perl5/bin/perltidy -b -bext="/" -log -pro=.../perltidyrc load_data Use of uninitialized value $Perl::Tidy::Formatter::SUB_PATTERN in concatenation (.) or string at /home/shriversteve/perl5/lib/perl5/Perl/Tidy/Formatter.pm line 6581. However, the previous version of perltidy works, /opt/prism/perl5/perlbrew/perls/current/bin/perltidy --version This is perltidy, v20191203 /opt/prism/perl5/perlbrew/perls/current/bin/perltidy -b -bext='/' -log -pro=.../perltidyrc load_data ls -lart load* -rw-r--r-- 1 shriversteve domain users 1.6K Aug 7 16:20 load_data.LOG -rwxr-xr-x 1 shriversteve domain users 5.9K Aug 7 16:20 load_data* I have not defined sub-alias-list in my perltidyrc file. Do you need to see my config file? (reading the module) Just guessing, but is it possible that make_block_pattern() (where the error occurs) is getting called before make_sub_matching_pattern()? (read the file more) Well, in check_options(), make_closing_side_comment_list_pattern() is called earlier. Dunno, just a thought. Hope this helps. Smile, Steve
Hi Steve, Thanks for the bug report and especially for the analysis. I can reproduce this if I use the parameter -cscl='sub', and it looks like the problem can be fixed by moving the call to make_sub_matching_pattern() up near the start of the routine, as you noted. I'll fix this in the next release. The temporary workaround would be to remove 'sub' from a -cscl directive in your config file. Thanks again, Steve
Yes, your patch looks fine. Steve
Subject: Re: [rt.cpan.org #133130] Bug in latest version, 20200619
Date: Mon, 10 Aug 2020 20:25:48 +0000
To: "bug-Perl-Tidy [...] rt.cpan.org" <bug-Perl-Tidy [...] rt.cpan.org>
From: "Shriver, Steve" <ShriverSteve [...] prahs.com>
Steve H, I like your suggestion of moving the method call, it is fewer changes: diff /home/shriversteve/perl5/lib/perl5/Perl/Tidy/Formatter.pm.20200807_172243 /home/shriversteve/perl5/lib/perl5/Perl/Tidy/Formatter.pm 5762a5763 Show quoted text
> make_sub_matching_pattern();
5797d5797 < make_sub_matching_pattern(); Not sure if it hides the problem or solves it, but it makes my error go away! Smile, Steve Steve Shriver, Sr Software Engineer, Prism Team On 07/Aug/20, 8:56 PM, "Steve Hancock via RT" <bug-Perl-Tidy@rt.cpan.org> wrote: <URL: https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Frt.cpan.org%2FTicket%2FDisplay.html%3Fid%3D133130&amp;data=02%7C01%7CShriverSteve%40prahs.com%7C4f8abf3a2bd841143d4108d83b35e2d8%7C1cef9a5962ec418a96662b3afc2d2cb0%7C0%7C1%7C637324449920231848&amp;sdata=bM8L1xmznYTGrlzGvmkTcmNwSj2yrVpqRPV6D4L8l68%3D&amp;reserved=0 > Yes, your patch looks fine. Steve
I agree, that's the correct fix and how I have updated the development version. Otherwise it would not be possible to use both the new --sub-alias-list and --closing-side-comment-list options together. Thanks, Steve
This is fixed in v20200822. Thanks again for the bug report.