[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug#10305: coreutils-8.14, "rm -r" fails with EBADF
From: |
Paul Eggert |
Subject: |
Re: bug#10305: coreutils-8.14, "rm -r" fails with EBADF |
Date: |
Tue, 26 Jun 2012 10:56:59 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 |
Shouldn't regex be avoiding strcasecmp entirely?
That is, couldn't there be a weird locale that considers
the lower-case equivalent of "U" to be "uu", or something
weird like that?
For this particular case c-strcase seems overkill, so how
about the following further patch?
diff --git a/lib/regcomp.c b/lib/regcomp.c
index 7eb003b..6d5525a 100644
--- a/lib/regcomp.c
+++ b/lib/regcomp.c
@@ -899,8 +899,10 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
!= 0);
#else
codeset_name = nl_langinfo (CODESET);
- if (strcasecmp (codeset_name, "UTF-8") == 0
- || strcasecmp (codeset_name, "UTF8") == 0)
+ if ((codeset_name[0] == 'U' || codeset_name[0] == 'u')
+ && (codeset_name[1] == 'T' || codeset_name[1] == 't')
+ && (codeset_name[2] == 'F' || codeset_name[2] == 'f')
+ && strcmp (codeset_name + 3 + (codeset_name[3] == '-'), "8") == 0)
dfa->is_utf8 = 1;
/* We check exhaustively in the loop below if this charset is a
diff --git a/modules/regex b/modules/regex
index 5371bab..cfc5d07 100644
--- a/modules/regex
+++ b/modules/regex
@@ -26,7 +26,6 @@ mbsinit [test $ac_use_included_regex = yes]
nl_langinfo [test $ac_use_included_regex = yes]
stdbool [test $ac_use_included_regex = yes]
stdint [test $ac_use_included_regex = yes]
-strcase [test $ac_use_included_regex = yes]
wchar [test $ac_use_included_regex = yes]
wcrtomb [test $ac_use_included_regex = yes]
wctype-h [test $ac_use_included_regex = yes]