2013-04-14

Found a bug in 'less'

Recently I noticed that I had accidentally created a file named '\' (a single backslash character was the name of the file) in a subdirectory. This can easily happen when your pinky finger brushes across the backslash key when hitting ENTER. It seemed improbable that there would be a bug in a program like 'less', so I sent in a bug report and will let GNU (and you) be the final judge (disclaimer: I edited the original email somewhat for this blog, to make it easier to understand, but the substance is unchanged):
from:    Smithfarm
to:      bug-less@gnu.org
date:    Sun, Apr 7, 2013 at 12:01 AM
subject: Apparent bug in 'less'

When I have a file named \ (i.e. the entire filename consists of one
backslash) and that file is in the current directory, the following
command works as expected:

$ less \\
[displays "Contents of the file named \" on the screen]

However, when the file is in a subdirectory, nothing is displayed on
the screen. Instead, I get the following error:

$ less sub/\\
sub/\ is a directory
$

Note: "cat sub/\\" works as expected:

$ cat sub/\\
Contents of the file named \
$

Here's the version I'm using:
$ less --version
less 456 (POSIX regular expressions)
Copyright (C) 1984-2012 Mark Nudelman

Hope this helps.

No comments:

Post a Comment