backslash
Jorge Almeida
jjalmeida at gmail.com
Thu Jun 26 00:14:41 PDT 2008
On Thu, 26 Jun 2008, Roger Oberholtzer wrote:
> On Wed, 2008-06-25 at 17:25 +0100, Jorge Almeida wrote:
>> This may look a somewhat strange question, but anyway: can I be
>> reasonably sure that no file belonging to a [sane] package ever has a
>> backslash in its path?
>
> Not in the file system. Escaped characters do not get a backslash in a
> symbolic link.
>
>> touch "stupid name"
>> ln -s stupid\ name psn
>> ll psn stupid\ name
> lrwxrwxrwx 1 roger users 11 2008-06-26 08:20 psn -> stupid name
> -rw-r--r-- 1 roger users 0 2008-06-26 08:19 stupid name
>
> But perhaps in a file that describes the file system there could be a
> backslash. And note that in my access to the stupid file name, I had to
> use a backslash. Either that or enclose the name in quotes. Perhaps you
> are looking at a file that choose not to use quotes around file names,
> and opted for "\ " to deal with spaces in names?
>
I want something like this: in a dedicated directory, create a symlink
\usr\bin\less --> sys-apps/less-418
(If I were to create it by hand, I would have to press '\' twice to get
the backslash, but that's not the point.)
To find out what package owns the file /usr/bin/less, get the target of
the symlink \usr\bin\less. (This kind of thing takes less than 1s,
whereas equery took 15s...)
Any other character (except '/') would do the job, if it weren't for the
possibility that that same character can appear in the real path to the
file. So, I was hoping to be sure that '\' doesn't appear in a path (for
a file in a package, not for a file we make ourselves as a test!)
There are other possibilities, but are less efficient to implement
(e.g., substitute the path with a csv string...)
Jorge
More information about the Linux-users
mailing list