Bug 249305 - www/w3m: w3mman -l file does not work
Summary: www/w3m: w3mman -l file does not work
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: MANTANI Nobutaka
Depends on:
Reported: 2020-09-14 07:42 UTC by Dustin Boyd
Modified: 2020-09-22 05:52 UTC (History)
0 users

See Also:
nobutaka: maintainer-feedback+

Remove -l flag in CGI script (367 bytes, patch)
2020-09-14 07:42 UTC, Dustin Boyd
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dustin Boyd 2020-09-14 07:42:20 UTC
Created attachment 217947 [details]
Remove -l flag in CGI script

'w3mman -l file' relies on the -l flag of some man implementations, which ignores system manual sections and assumes any arguments are paths to files.  It first constructs a URL that gets passed to the w3mman2html.cgi script, which then checks for a query parameter named 'local' and ultimately opens that file in w3m after converting the output of '$MAN -l $file', where $MAN is /usr/bin/man if the W3MMAN_MAN environment variable is unset or an empty string.

Unfortunately, FreeBSD's man(1) does not have a -l flag, instead checking arguments against the shell pattern */* to determine whether they're paths or not.  Consequently, the resulting invocation '/usr/bin/man -l /path/to/file' will fail with an error that -l is an invalid flag for man(1).

A patch is attached that removes the -l flag in the w3mman2html.cgi script to fix this issue, resulting in '/usr/bin/man /path/to/file' being executed instead.
Comment 1 commit-hook freebsd_committer 2020-09-22 05:48:51 UTC
A commit references this bug:

Author: nobutaka
Date: Tue Sep 22 05:48:21 UTC 2020
New revision: 549559
URL: https://svnweb.freebsd.org/changeset/ports/549559

  Remove "-l" option of man command that FreeBSD's one does not have.

  PR:		249305
  Submitted by:	Dustin Boyd <memreflect@pm.me>

Comment 2 MANTANI Nobutaka freebsd_committer 2020-09-22 05:52:56 UTC
Fixed, thanks!