From: Philipp Stephani <p.stephani2@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: Re: Add a predicate for canonical file name
Date: Tue, 13 Sep 2016 06:54:04 +0000 [thread overview]
Message-ID: <CAArVCkRtGc=P4ykVgApq441LFUM+odffMS8n4cxjby7k7qErmQ@mail.gmail.com> (raw)
In-Reply-To: <jwvk2egx58t.fsf-monnier+gmane.emacs.devel@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1945 bytes --]
Stefan Monnier <monnier@iro.umontreal.ca> schrieb am Mo., 12. Sep. 2016 um
22:09 Uhr:
> > Using string= here will cause false negatives, e.g. with Windows file
> > names that use backslashes vs forward slashes, or due to letter-case
> > differences on case-insensitive file systems. Did you really mean
> > that?
>
> Indeed, such notions have already been requested and discussed here, and
> it's not clear exactly what is needed and when.
>
> I can see several different meanings of "canonical", i.e. representative
> member of an equivalence class (and I'd be inclined to prefer a function
> that checks for "equivalence" between two file names rather than
> a function that tries to find one canonical name). The equivalence
> classes could be:
>
> - equivalent regardless of the actual on-disk data. I.e. this can't
> take symlinks or hard links into account. Questions remain about
> whether it could presume the "normal semantics of the most common
> file-system". E.g. should it assume case-insensitive names in
> MacOS/Windows and case-sensitive in GNU/Linux?
>
You couldn't even do that because case-folding on Windows depends on the
file system. The only possibilities I see here are converting backslashes
into slashes (or vice versa), and collapsing "//" and "/./". You couldn't
even collapse "/../" because of symlinks. (Or you could ignore directory
symlinks, as in https://golang.org/pkg/path/#Clean).
>
> - equivalent in practice for the current state of the file-system.
> You can test this equivalence by comparing the output of
> `file-attributes', except when the name corresponds to a file that
> doesn't exist (yet?).
>
Like all filesystem operations, this easily introduces race conditions if
decisions are made based on it: What might be an equivalent file name now
(pointing to the same inode), might not be a nanosecond later.
Over all, such an operation sounds more useful than it actually is.
[-- Attachment #2: Type: text/html, Size: 3050 bytes --]
next prev parent reply other threads:[~2016-09-13 6:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-12 8:23 Add a predicate for canonical file name Tino Calancha
2016-09-12 17:13 ` Eli Zaretskii
2016-09-12 20:01 ` Stefan Monnier
2016-09-13 6:54 ` Philipp Stephani [this message]
2016-09-13 12:14 ` Stefan Monnier
2016-10-14 21:39 ` John Yates
2016-10-15 22:05 ` Richard Stallman
2016-10-15 23:07 ` Kalle Olavi Niemitalo
2016-10-16 0:02 ` John Yates
2016-10-16 1:05 ` Kalle Olavi Niemitalo
2016-10-16 10:42 ` Richard Stallman
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='CAArVCkRtGc=P4ykVgApq441LFUM+odffMS8n4cxjby7k7qErmQ@mail.gmail.com' \
--to=p.stephani2@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.