Package: less
Version: 590-1ubuntu0.22.04.1
Severity: normal
Tags: upstream

Dear Maintainer,

LESSEDIT expands the same things that are expanded in prompts, which
ends up meaning that this:

     (export LESSEDIT="bash --noprofile --norc -c 'echo ~/.bashrc'" && less 
some_file.c )

when you press v from less to fire it, ends up printing:

     /home/bkerin/bashrc

rather than:

     /home/bkerin/.bashrc

as expected.

It's entirely unclear from the docs that this is going to happen.  The
docs in the PROMPT section present a listof expansion beginning with %
and another list beginning with ?, and state that a period terminates
the true part of the conditional begun with ?.  The *do not* say that .
and : are metacharacters even if ? hasn't been used.  Either they should
not be treated as metacharacters in this case, or it should be clearly
documented that they are, so users know to escape them.

This is not an academic example since doing e.g.:

(export LESSEDIT="bash --noprofile --norc -i -c 'export SOME_MODE_VAR=def && 
source /etc/profile && source ~/.profile && some_func_from_profile'" && 
some_program_using_less_in_a_weird_way)

is a fairly obvious way to modally pull in stuff in ~/.profile for when
launching an editor from some_program_using_less_in_a_weird_way

Now that I know (after reading source) that the
very-common-in-file-names . character has to be escaped it all works
fine.

-- System Information:
Debian Release: bookworm/sid
  APT prefers jammy-updates
  APT policy: (500, 'jammy-updates'), (500, 'jammy-security'), (500, 'jammy'), 
(100, 'jammy-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.5.0-17-generic (SMP w/20 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages less depends on:
ii  libc6      2.35-0ubuntu3.6
ii  libtinfo6  6.3-2ubuntu0.1

less recommends no packages.

less suggests no packages.

-- no debconf information

Reply via email to