less and vi fail on file whose name begins with +

Teske, Devin Devin.Teske at fisglobal.com
Mon Jul 16 05:13:36 UTC 2012



On Jul 15, 2012, at 10:03 PM, Thomas Mueller <mueller23 at insightbb.com> wrote:

> I notice in my latest build of FreeBSD 9.0-STABLE (#11), a problem with less and vi with files whose name begins with +.
> 
> These files occur in /var/db/pkg/(pkg-name)/
> 
> For instance, if I cd /var/db/pkg/png-1.4.8
> and type 
> less +DESC 
> I get
> 
> Missing filename ("less --help" for help)
> 
> but if I type the filename with full path, or even 
> less ./+DESC 
> it works OK
> 
> I also tried going to /tmp and
> echo abcdefg > +junk1.txt
> and the same bug with less showed up (no problem with echo).
> 
> I tried vi instead of less, not really wanting to edit the file,
> and vi tried to open a temporary file on /tmp with a strange name.
> 
> Has anybody noticed this bug?  It affects i386 and amd64 at least.
> 
> I have no access to test on other architectures.
> 
> If this bug is found, we no doubt want it to be squashed before 9.1-RELEASE.
> 

Neither of these are "bugs" and I assure you they are as old as the hills (maybe not vi but always vim -- did you recently alias vi to vim?)

For less, try this:

less +/wheel < /etc/group

The + precedes an initial command. Similar with vi[m].

Simple way 'round is to use "--", e.g. below:

vi -- +DESC

-- 
Devin

_____________
The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.


More information about the freebsd-stable mailing list