libwww-perl / URI

The Perl URI module
https://metacpan.org/pod/URI
Other
41 stars 48 forks source link

5.11 breaks HTML::FormatExternal #102

Closed firefart closed 2 years ago

firefart commented 2 years ago

When installing HTML::FormatExternal the latest 5.11 version leads to errors during build. If I downgrade to 5.10 it works again.

Here is some example output

Logs ```text # HTML::FormatText::Elinks program_version $VAR1 = '0.13.2'; # $output = "123 567 9012\nabc def ghij\n"; # Colon character is ordinary in filenames: 0 # Temporary directory /tmp/e8BGskz3_e # Failed test 'HTML::FormatText::Elinks format_file() filename "/tmp/e8BGskz3_e/-###"' # at t/FormatExternal.t line 321. # 'Local directory # /[1]root/[2].cpanm/[3]work/[4]1657174058.2983/[5]HTML-FormatExternal-26/ # # drwxr-xr-x 7 root root 4096 Jul 7 06:08 [6].. # drwxr-sr-x 8 root rt 4096 Jul 7 06:08 [7]blib # drwxr-sr-x 3 rt rt 4096 Aug 29 2015 [8]debian # drwxr-sr-x 2 rt rt 4096 Aug 29 2015 [9]devel # drwxr-sr-x 2 rt rt 4096 Aug 29 2015 [10]examples # drwxr-sr-x 2 rt rt 4096 Aug 29 2015 [11]inc # drwxr-sr-x 3 rt rt 4096 Aug 29 2015 [12]lib # drwxr-sr-x 2 rt rt 4096 Aug 29 2015 [13]t # drwxr-sr-x 2 rt rt 4096 Aug 29 2015 [14]xt # drwxr-sr-x 2 rt rt 4096 Aug 29 2015 [15]xtools # -rw-r--r-- 1 rt rt 35068 Jun 29 2007 [16]COPYING # -rw-r--r-- 1 rt rt 2294 Aug 29 2015 [17]Changes # -rw-r--r-- 1 rt rt 1241 Aug 29 2015 [18]MANIFEST # -rw-r--r-- 1 rt rt 3104 Nov 15 2013 [19]MANIFEST.SKIP # -rw-r--r-- 1 rt rt 1547 Aug 29 2015 [20]META.json # -rw-r--r-- 1 rt rt 853 Aug 29 2015 [21]META.yml # -rw-r--r-- 1 root rt 1582 Jul 7 06:07 [22]MYMETA.json # -rw-r--r-- 1 root rt 893 Jul 7 06:07 [23]MYMETA.yml # -rw-r--r-- 1 root rt 32579 Jul 7 06:07 [24]Makefile # -rwxr-xr-x 1 rt rt 2558 Apr 23 2015 [25]Makefile.PL # -rw-r--r-- 1 rt rt 1684 Jun 5 2013 [26]README # -rw-r--r-- 1 rt rt 4390 Aug 29 2015 [27]SIGNATURE # -rw-r--r-- 1 root rt 0 Jul 7 06:08 [28]pm_to_blib # # -------------------------------------------------------------------------- # # References # # Visible links # 1. file:///root/ # 2. file:///root/.cpanm/ # 3. file:///root/.cpanm/work/ # 4. file:///root/.cpanm/work/1657174058.2983/ # 5. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/ # 6. file:///root/.cpanm/work/1657174058.2983/ # 7. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/blib/ # 8. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/debian/ # 9. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/devel/ # 10. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/examples/ # 11. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/inc/ # 12. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/lib/ # 13. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/t/ # 14. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/xt/ # 15. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/xtools/ # 16. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/COPYING # 17. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/Changes # 18. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/MANIFEST # 19. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/MANIFEST.SKIP # 20. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/META.json # 21. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/META.yml # 22. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/MYMETA.json # 23. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/MYMETA.yml # 24. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/Makefile # 25. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/Makefile.PL # 26. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/README # 27. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/SIGNATURE # 28. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/pm_to_blib # ' # doesn't match '(?^:body.*text)' # Failed test 'HTML::FormatText::Elinks format_file() filename "/tmp/e8BGskz3_e/%57"' # at t/FormatExternal.t line 321. # 'Local directory # /[1]root/[2].cpanm/[3]work/[4]1657174058.2983/[5]HTML-FormatExternal-26/ # # drwxr-xr-x 7 root root 4096 Jul 7 06:08 [6].. # drwxr-sr-x 8 root rt 4096 Jul 7 06:08 [7]blib # drwxr-sr-x 3 rt rt 4096 Aug 29 2015 [8]debian # drwxr-sr-x 2 rt rt 4096 Aug 29 2015 [9]devel # drwxr-sr-x 2 rt rt 4096 Aug 29 2015 [10]examples # drwxr-sr-x 2 rt rt 4096 Aug 29 2015 [11]inc # drwxr-sr-x 3 rt rt 4096 Aug 29 2015 [12]lib # drwxr-sr-x 2 rt rt 4096 Aug 29 2015 [13]t # drwxr-sr-x 2 rt rt 4096 Aug 29 2015 [14]xt # drwxr-sr-x 2 rt rt 4096 Aug 29 2015 [15]xtools # -rw-r--r-- 1 rt rt 35068 Jun 29 2007 [16]COPYING # -rw-r--r-- 1 rt rt 2294 Aug 29 2015 [17]Changes # -rw-r--r-- 1 rt rt 1241 Aug 29 2015 [18]MANIFEST # -rw-r--r-- 1 rt rt 3104 Nov 15 2013 [19]MANIFEST.SKIP # -rw-r--r-- 1 rt rt 1547 Aug 29 2015 [20]META.json # -rw-r--r-- 1 rt rt 853 Aug 29 2015 [21]META.yml # -rw-r--r-- 1 root rt 1582 Jul 7 06:07 [22]MYMETA.json # -rw-r--r-- 1 root rt 893 Jul 7 06:07 [23]MYMETA.yml # -rw-r--r-- 1 root rt 32579 Jul 7 06:07 [24]Makefile # -rwxr-xr-x 1 rt rt 2558 Apr 23 2015 [25]Makefile.PL # -rw-r--r-- 1 rt rt 1684 Jun 5 2013 [26]README # -rw-r--r-- 1 rt rt 4390 Aug 29 2015 [27]SIGNATURE # -rw-r--r-- 1 root rt 0 Jul 7 06:08 [28]pm_to_blib # # -------------------------------------------------------------------------- # # References # # Visible links # 1. file:///root/ # 2. file:///root/.cpanm/ # 3. file:///root/.cpanm/work/ # 4. file:///root/.cpanm/work/1657174058.2983/ # 5. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/ # 6. file:///root/.cpanm/work/1657174058.2983/ # 7. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/blib/ # 8. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/debian/ # 9. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/devel/ # 10. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/examples/ # 11. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/inc/ # 12. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/lib/ # 13. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/t/ # 14. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/xt/ # 15. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/xtools/ # 16. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/COPYING # 17. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/Changes # 18. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/MANIFEST # 19. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/MANIFEST.SKIP # 20. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/META.json # 21. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/META.yml # 22. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/MYMETA.json # 23. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/MYMETA.yml # 24. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/Makefile # 25. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/Makefile.PL # 26. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/README # 27. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/SIGNATURE # 28. file:///root/.cpanm/work/1657174058.2983/HTML-FormatExternal-26/pm_to_blib # ' # doesn't match '(?^:body.*text)' ```

As the HTML::FormatExternal package seems pretty outdated I just wanted to create an issue here too just in case this is some introduced bug in this library.

Cross reference: https://rt.cpan.org/Ticket/Display.html?id=143689

kryde commented 2 years ago

With

use URI::file; print URI::file->new_abs("/tmp/###"),"\n";

I hoped to get file:///tmp/%23%23%23 which seems to be not so in 5.11.

I used this in FormatExternal to ensure that a weird filename is encoded in a way which is unambiguous for the program called.

oalders commented 2 years ago

This would have been introduced via #100.

oalders commented 2 years ago

@Perlbotics I think we need to consider which URI types should not be affected by this new behaviour?

Perlbotics commented 2 years ago

Whoaah. I guess, it happens around line 104 in URI.pm. Let me check. Do you need a quick fix fast?

oalders commented 2 years ago

@Perlbotics I can revert #100 and upload a new release. That would leave time to be thorough about a fix and get some new tests in place. We could then re-introduce the changes with the tweaks. Does that sound reasonable?

Perlbotics commented 2 years ago

Hi Olaf (@oalders), sounds reasonable.

Locally, I added a testcase for the given issue 102 and ran the test suite again. The problem is that the sub in line 100 of URI.pm does not work for schemes that do not have an authority part and those where '#' should be escaped. Same for '?', I guess. Other candidates: sftp, ftp, ldap, rsync, etc.

Quick fix for issue#102 (leaving similar problems open) Insert at line 103: return if $_[0] =~ /^file/; #-- selective for issue#102

I'll return to this in the evening. Sorry for the inconvenience.

Update: Problem is a zero size match as in scheme:///, scheme://#, scheme://?. In case of file:/// it is worse since it returns an empty string which is turned into the current directory (at least with new_abs())!

Changing line 105 from: my $orig = $2; into my $orig = $2 || return; should do the trick.

oalders commented 2 years ago

Closed via 725fbfb6d59fbe8

oalders commented 2 years ago

5.12 has just been released to CPAN. Thanks @firefart for raising the issue!