From: Corinna Vinschen <vinschen@redhat.com>
To: gcc-patches@gcc.gnu.org, gdb-patches@sourceware.org
Subject: Re: [RFA/libiberty] Darwin has case-insensitive filesystems
Date: Wed, 15 Jun 2011 10:45:00 -0000 [thread overview]
Message-ID: <20110615104419.GA8011@calimero.vinschen.de> (raw)
In-Reply-To: <201106150958.p5F9wJ7x019158@glazunov.sibelius.xs4all.nl>
On Jun 15 11:58, Mark Kettenis wrote:
> > Date: Wed, 15 Jun 2011 10:22:36 +0200
> > From: Corinna Vinschen <...>
Please do not quote my email address in the body of your message.
Thank you.
> > IMHO it's actually a pity that the filename comparison behaves differently
> > on different systems. I think it would make sense to behave identical on
> > all systems. What about this: Always search case-sensitive. If file has
> > been found, return. Otherwise, search case-insensitive.
>
> Over my dead body. On a proper operating system filenames are
> case-sensitive. Your suggestion would create spurious matches.
Indeed. Probably the case sensitivity should not be hardcoded in a
low-level function at all. The application should decide if it wants
case-sensitive or case-insensitive filename comparison. This way,
the comparison could be based on OS, filesystem, or user choice.
> Even on case-preserving filesystems I'd argue that treating them as
> case-sensitive is still the right approach. If that creates problems,
> it means somebody was sloppy and didn't type the proper name of the
> file or some piece of code in the toolchain arbitrarily changed the
> case of a filename. I don't mind punishing people for that. They
> have to learn that on a proper operating system file names are
> case-sensitive!
I wasn't aware that gcc, gdb, and other tools using libiberty are
supposed to punish people for the features of the OS they are working
on. At one point I actually thought they were supposed to *help*
developers. I seem to be wrong.
> > Talking about case-insensitive comparison, the filename_cmp and
> > filename_ncmp functions don't work for multibyte codesets, only for
> > singlebyte codesets. Given that UTF-8 is standard nowadays, shouldn't
> > these functions be replaced with multibyte-aware versions?
>
> For UTF-8, that isn't necessary. Normal string manipulation functions
> work just fine on them, since UTF-8 strings don't contain any embedded
> NUL characters. It's only when you try to be too clever about
> case-insensitivity that you run into problems.
If you read the text you're replying to once more, you see that I'm
explicitely talking about case-insensitive comparison. In that case,
the functions won't work correctly, unless you use a singlebyte codeset.
The tolower function on a single byte just doesn't make sense in
multibyte charsets. The right thing to do would be something along
the lines of
mbstowcs (wide_a, a);
mbstowcs (wide_b, b);
return wcscasecmp (wide_a, wide_b);
> > Along the same lines, the entire set of safe-ctype functions only
> > work for ASCII and EBCDIC...
>
> That really should only matter for displaying filenames.
It matters for case-insensitive filename comparison as well.
> Anyway. I really don't care how deep a hole people have dug for
> themselves in trying to support Windows in all its various broken
> configurations.
I can't help but notice that you seem to have a strained relationship to
Windows. However, if you read the OP again, you'll notice that the patch
was supposed to help developers on MacOS, not Windows. For Windows the
function already performs case-insensitive comparison, albeit wrong.
Corinna
--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat
next prev parent reply other threads:[~2011-06-15 10:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-14 21:33 Joel Brobecker
2011-06-14 21:38 ` DJ Delorie
2011-07-01 17:58 ` Joel Brobecker
2011-06-14 21:57 ` Andrew Pinski
2011-06-14 22:02 ` DJ Delorie
2011-06-15 4:25 ` Joel Brobecker
2011-06-15 8:23 ` Corinna Vinschen
2011-06-15 9:59 ` Mark Kettenis
2011-06-15 10:45 ` Corinna Vinschen [this message]
2011-06-15 10:55 ` Pedro Alves
2011-06-15 11:00 ` Robert Dewar
2011-06-15 17:30 ` Eli Zaretskii
2011-06-15 10:46 ` Joseph S. Myers
2011-06-15 10:59 ` Corinna Vinschen
2011-06-15 17:29 ` Eli Zaretskii
2011-06-15 19:42 ` Corinna Vinschen
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=20110615104419.GA8011@calimero.vinschen.de \
--to=vinschen@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=gdb-patches@sourceware.org \
/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