backslash
Roger Oberholtzer
roger at opq.se
Thu Jun 26 00:57:54 PDT 2008
On Thu, 2008-06-26 at 08:14 +0100, Jorge Almeida wrote:
> 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!)
Ahhh. Light bulb. You are looking for a character that cannot (as
opposed to 'should not in common usage') occur in a file name. I thought
you had found backslashes and were curious about that.
Backslashes can be part of a file name, as well as a of a symbolic link
to that file name:
> touch qq\\aa "oo\zz"
> ll
-rw-r--r-- 1 roger users 0 2008-06-26 09:50 oo\zz
-rw-r--r-- 1 roger users 0 2008-06-26 09:49 qq\aa
I can't think of any character that will not occur. I have put control
characters in names (crummy too.slow keyboards).
Perhaps you could choose some obscure utf-8 character. Even though Linux
file systems are often utf-8, you could choose some obscure Burmese
character that seldom shows up in a file name...
> There are other possibilities, but are less efficient to implement
> (e.g., substitute the path with a csv string...)
>
> Jorge
> _______________________________________________
> Linux-users mailing list ( Linux-users at linux-sxs.org )
> Unsub/Password/Etc:
> http://linux-sxs.org/mailman/listinfo/linux-users
>
> Need to chat further on this subject? Check out #linux-users on irc.linux-sxs.org !
--
Roger Oberholtzer
OPQ Systems / Ramböll RST
Ramböll Sverige AB
Kapellgränd 7
P.O. Box 4205
SE-102 65 Stockholm, Sweden
Office: Int +46 8-615 60 20
Mobile: Int +46 70-815 1696
And remember:
It is RSofT and there is always something under construction.
It is like talking about large city with all constructions finished.
Not impossible, but very unlikely.
More information about the Linux-users
mailing list