less and vi fail on file whose name begins with +

Mateusz Guzik mjguzik at gmail.com
Mon Jul 16 05:13:33 UTC 2012


On Mon, Jul 16, 2012 at 01:03:30AM -0400, Thomas Mueller 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
> 

+ has special meaning in ls:
+cmd   Causes  the specified cmd to be executed each time a new file is
              examined.  For example, +G causes less to initially display each
              file starting at the end rather than the beginning.


> 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.
> 

That's expected.

-- 
Mateusz Guzik <mjguzik gmail.com>


More information about the freebsd-stable mailing list