From: Eli Zaretskii <eliz@gnu.org>
To: Vladimir Prus <vladimir@codesourcery.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: Better realpath
Date: Fri, 20 Jun 2008 02:49:00 -0000 [thread overview]
Message-ID: <ulk11gsma.fsf@gnu.org> (raw)
In-Reply-To: <200806191006.43356.vladimir@codesourcery.com>
> From: Vladimir Prus <vladimir@codesourcery.com>
> Date: Thu, 19 Jun 2008 10:06:42 +0400
> Cc: gdb-patches@sources.redhat.com
>
> > I don't think such radical measures would be necessary. We could
> > either (a) use canonicalize_filename, which doesn't check for
> > existence,
>
> Hmm, the documentation at
>
> http://www.gnu.org/software/libc/manual/html_mono/libc.html
>
> say:
>
> Function: char * canonicalize_file_name (const char *name)
>
> If any of the path components is missing the function returns a NULL pointer.
My version of libc.info says something different:
In any of the path components except the last one is missing the
function returns a NULL pointer.
The "except the last" part makes all the difference.
I guess we need to try this to see which one is true.
> > or (2) use realpath on the argument's leading directories
> > (i.e. call `dirname' to remove the last portion of the file name). Am
> > I missing something?
>
> And this will check dirname existance? This semantics is mid-way between checking
> everything for existance, and not checking anything. Is this really intuitive and
> desirable?
I was aiming for consistency with canonicalize_file_name, assuming it
behaves like my reference above says.
> > > Second is down-casing. If we don't want brute down-casing, and we want truly canonic
> > > names of paths, then "C:/documents and settings" should become "C:/Documents and Settings",
> > > and that requires actually poking at the file system to see what exact spelling is stored.
> >
> > No, that's not necessary either. All you need is run the result of
> > GetFullPathName through GetLongPathName: if it fails, it means the
> > file does not exist, and you need to return it in whatever letter-case
> > it was passed to us; if it succeeds, it will return the file name as
> > it's recorded in the filesystem.
>
> That does not contradict what I say -- it *does* require poking at the file system,
Well, _any_ file-related system call eventually pokes the file system.
What I meant is that we don't need to do that yourself in application
code.
> ... what will be the return value of GetLongPathName on "C:/DOCUME~1/nonexistent/nonexistent2"
> and "C:/documents and settings/nonexistent/nonexistent2". Presumably, GetLongPathName will
> fail in both cases, and GDB will think those paths are unequal.
That's true, but it's no worse than today: FILENAME_CMP does not
handle comparison of short 8+3 aliases with their long variants. So
we don't need to do this if we don't want to. If we do want to handle
these cases, I guess we could iteratively chop directories from the
right and run them through GetLongPathName until we get to one that
does exist. But I don't know if this is worth the hassle. After all,
in the context of GDB, a file name recorded in the debug info could
well cease to exist by the time GDB tries to canonicalize its name.
> GetLongPathName, also, is not available on Windows 95. Is that an issue?
I don't think so.
> 2. Make lrealpath check for dirname existance only. The filename part will have to
> be downcased on Windows.
It doesn't need to be downcased: FILENAME_CMP copes with letter-case
differences.
> Now, which of those approaches you:
>
> - Will be willing to accept?
Any one of them, actually.
> - Will be willing to hack on, and push in libibery?
"Willing", yes; "have time to", probably no.
prev parent reply other threads:[~2008-06-19 18:58 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-14 11:09 Vladimir Prus
2008-06-14 11:30 ` Pierre Muller
2008-06-14 12:14 ` Vladimir Prus
2008-06-14 14:29 ` Eli Zaretskii
2008-06-14 15:10 ` Vladimir Prus
2008-06-14 22:05 ` Eli Zaretskii
2008-06-14 22:26 ` Vladimir Prus
2008-06-15 17:37 ` Eli Zaretskii
2008-06-15 17:43 ` Daniel Jacobowitz
2008-06-15 21:04 ` Eli Zaretskii
2008-06-16 3:17 ` Daniel Jacobowitz
2008-06-16 3:32 ` Eli Zaretskii
2008-06-18 18:39 ` Stan Shebs
2008-06-18 20:47 ` DJ Delorie
2008-06-18 15:22 ` Vladimir Prus
2008-06-18 21:08 ` Eli Zaretskii
2008-06-19 7:27 ` Vladimir Prus
2008-06-20 2:49 ` Eli Zaretskii [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ulk11gsma.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=gdb-patches@sources.redhat.com \
--cc=vladimir@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox