#995948 lesspipe doesn’t properly quote filenames

Package:
less
Source:
less
Description:
pager program similar to more
Submitter:
Christoph Anton Mitterer
Date:
2025-03-31 05:51:01 UTC
Severity:
important
#995948#5
Date:
2021-10-08 17:54:39 UTC
From:
To:
Hey.

In most (all?) cases, lesspipe simply uses the filename as
is (i.e. $1) and neither uses anything like "--" (as far
as available) in the commands it calls.

This is prone to fail, as soon as one has filenames that may
be mistaken for command options, e.g. ones that start with
- or --
.


I guess there are two things one can do here (and probably one has do
to actually both):
1) Go through the list of all commands, find out which of them supports
"--" or similar options and just add them

2) For all other cases, a nice trick is to quote any pathnames as
absolute or relative paths (these are typically never mistaken for
options).
Well an absolute path is anyway "quoted" in that sense, a relative
path needs a "./" added.

I have a function for this (see attachment).


What do you think should we do?


Cheers,
Chris.