Package: w3m Version: 0.5.3-19 Severity: wishlist Tags: patch Running w3mman2html.cgi from the commandline I noticed a Perl 5.18 warning. When I (temporarily) added "-w" to the hashbang I saw a couple of other issues that I've fixed at the same time.
$ /tmp/w3mman2html.cgi w3mman >&- defined(%hash) is deprecated at /tmp/w3mman2html.cgi line 223. (Maybe you should just omit the defined()?) Name "main::line" used only once: possible typo at /tmp/w3mman2html.cgi line 37. Use of uninitialized value $2 in concatenation (.) or string at /tmp/w3mman2html.cgi line 161, <F> line 43. The first issue (occurring last in the file) is a new warning in Perl 5.18, which practically hands you the patch. The second one is even simpler to fix: at line 37, "@line = ();" is wiping an array that is never used anywhere else. The third one's more complicated. The line s@(\W)(mailto:)?(\w[\w.\-]*\@\w[\w.\-]*\.[\w.\-]*\w)@$1<a href="mailto:$3">$2$3</a>@g; is designed to find email addresses and turn them into mailto: URLs; but there may or may not be a (mailto:). Perhaps more importantly, there might not be an initial (\W) either (if for instance the string happens to be at the start of a line). Fortunately you can just use a \b to match a word boundary and (mailto:|) to match either the prefix or nothing. (The easiest testcase for this is git(1), which ends with an address repeated without and then with the mailto: prefix.) -- JBR with qualifications in linguistics, experience as a Debian sysadmin, and probably no clue about this particular package
diff -ru w3m-0.5.3.orig/scripts/w3mman/w3mman2html.cgi.in w3m-0.5.3/scripts/w3mman/w3mman2html.cgi.in --- w3m-0.5.3.orig/scripts/w3mman/w3mman2html.cgi.in 2014-11-25 20:54:23.000000000 +0000 +++ w3m-0.5.3/scripts/w3mman/w3mman2html.cgi.in 2014-11-25 20:50:04.873592134 +0000 @@ -34,7 +34,6 @@ EOF $keyword =~ s:([^-\w\200-\377.,])::g; open(F, "$MAN -k $keyword 2> /dev/null |"); - @line = (); while(<F>) { chop; $_ = &html_quote($_); @@ -158,7 +157,7 @@ } s@(http|ftp)://[\w.\-/~]+[\w/]@<a href="$&">$&</a>@g; - s@(\W)(mailto:)?(\w[\w.\-]*\@\w[\w.\-]*\.[\w.\-]*\w)@$1<a href="mailto:$3">$2$3</a>@g; + s@\b(mailto:|)(\w[\w.\-]*\@\w[\w.\-]*\.[\w.\-]*\w)@<a href="mailto:$2">$1$2</a>@g; s@(\W)(\~?/[\w.][\w.\-/~]*)@$1 . &file_ref($2)@ge; s@(include(<\/?[bu]\>|\s)*\<)([\w.\-/]+)@$1 . &include_ref($3)@ge; if ($prev && m@^\s*(\<[bu]\>)*(\w[\w.\-]*)(\</[bu]\>)*(\([\dm]\w*\))@) { @@ -222,7 +221,7 @@ local($p); (! -d && -x) || return 0; - if (! defined(%PATH)) { + if (! %PATH) { for $p (split(":", $ENV{'PATH'})) { $p =~ s@/+$@@; $PATH{$p} = 1;