GNU bug report logs - #18258
t0251-gpt-unicode.sh fails when the C.UTF-8 locale is unavailable

Previous Next

Package: parted;

Reported by: ludo <at> gnu.org (Ludovic Courtès)

Date: Wed, 13 Aug 2014 11:55:01 UTC

Severity: normal

To reply to this bug, email your comments to 18258 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-parted <at> gnu.org:
bug#18258; Package parted. (Wed, 13 Aug 2014 11:55:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to ludo <at> gnu.org (Ludovic Courtès):
New bug report received and forwarded. Copy sent to bug-parted <at> gnu.org. (Wed, 13 Aug 2014 11:55:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: bug-parted <at> gnu.org
Subject: t0251-gpt-unicode.sh fails when the C.UTF-8 locale is unavailable
Date: Wed, 13 Aug 2014 13:53:53 +0200
Hello,

t0251-gpt-unicode.sh requires the C.UTF-8 locale and fails if it isn’t
available.

What about:

  1. Exiting with 77 when the locale is unavailable?

  2. Choosing another locale, such as en_US.utf8?  As of GNU libc 2.19,
     C.UTF-8 (or any other spelling) does not exist.

Thanks,
Ludo’.




Information forwarded to bug-parted <at> gnu.org:
bug#18258; Package parted. (Wed, 13 Aug 2014 19:56:02 GMT) Full text and rfc822 format available.

Message #8 received at 18258 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: "Brian C. Lane" <bcl <at> redhat.com>
Cc: 18258 <at> debbugs.gnu.org
Subject: Re: bug#18258: t0251-gpt-unicode.sh fails when the C.UTF-8 locale is
 unavailable
Date: Wed, 13 Aug 2014 21:55:26 +0200
"Brian C. Lane" <bcl <at> redhat.com> skribis:

> See my patch here:
>
> http://lists.alioth.debian.org/pipermail/parted-devel/2014-July/004568.html

-export LC_ALL=C.UTF-8
+if [ -e "/usr/share/locale/en_US/" ]; then
+    export LC_ALL=en_US.UTF-8
+else
+    export LC_ALL=C.UTF-8
+fi

The problem is that this directory is not necessarily where locale data
resides.

One way to check whether the locale encoding is supported would be
with ‘wc -m’:

--8<---------------cut here---------------start------------->8---
$ printf 'foo\341\264\244'|LC_ALL=C wc -m
6

$ printf 'foo\341\264\244'|LC_ALL=en_US.utf8 wc -m
4
--8<---------------cut here---------------end--------------->8---

The test could look for a valid UTF-8 locale like this:

--8<---------------cut here---------------start------------->8---
found_locale=no
for locale in en_US de_DE fr_FR es_ES
do
  LC_ALL="$locale.utf8"

  # In a UTF-8 locale, the string below prints as 4 characters.
  if [ `printf 'foo\341\264\244' | wc -m` -eq 4 ]; then
    found_locale=yes
    break
  fi
done

if [ "$found_locale" != "yes" ]; then
  echo "no valid UTF-8 locale found; skipping" >&2
  exit 77
fi
--8<---------------cut here---------------end--------------->8---

Thoughts?

Thanks,
Ludo’.




Information forwarded to bug-parted <at> gnu.org:
bug#18258; Package parted. (Wed, 13 Aug 2014 21:00:04 GMT) Full text and rfc822 format available.

Message #11 received at 18258 <at> debbugs.gnu.org (full text, mbox):

From: "Brian C. Lane" <bcl <at> redhat.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 18258 <at> debbugs.gnu.org
Subject: Re: bug#18258: t0251-gpt-unicode.sh fails when the C.UTF-8 locale is
 unavailable
Date: Wed, 13 Aug 2014 13:59:44 -0700
On Wed, Aug 13, 2014 at 09:55:26PM +0200, Ludovic Courtès wrote:
> The test could look for a valid UTF-8 locale like this:
> 
> --8<---------------cut here---------------start------------->8---
> found_locale=no
> for locale in en_US de_DE fr_FR es_ES
> do
>   LC_ALL="$locale.utf8"
> 
>   # In a UTF-8 locale, the string below prints as 4 characters.
>   if [ `printf 'foo\341\264\244' | wc -m` -eq 4 ]; then
>     found_locale=yes
>     break
>   fi
> done
> 
> if [ "$found_locale" != "yes" ]; then
>   echo "no valid UTF-8 locale found; skipping" >&2
>   exit 77
> fi
> --8<---------------cut here---------------end--------------->8---
> 
> Thoughts?

Nice! I like that better.

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)




Information forwarded to bug-parted <at> gnu.org:
bug#18258; Package parted. (Tue, 19 Aug 2014 14:41:02 GMT) Full text and rfc822 format available.

Message #14 received at 18258 <at> debbugs.gnu.org (full text, mbox):

From: Phillip Susi <psusi <at> ubuntu.com>
To: Ludovic Courtès <ludo <at> gnu.org>, 18258 <at> debbugs.gnu.org
Subject: Re: bug#18258: t0251-gpt-unicode.sh fails when the C.UTF-8 locale
 is unavailable
Date: Tue, 19 Aug 2014 10:40:19 -0400
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 8/13/2014 7:53 AM, Ludovic Courtès wrote:
> Hello,
> 
> t0251-gpt-unicode.sh requires the C.UTF-8 locale and fails if it
> isn’t available.
> 
> What about:
> 
> 1. Exiting with 77 when the locale is unavailable?
> 
> 2. Choosing another locale, such as en_US.utf8?  As of GNU libc
> 2.19, C.UTF-8 (or any other spelling) does not exist.

How can the C locale possibly not exist on a system that is not
totally broken?  It is the default and fallback locale when you don't
have any locales installed.



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJT82HTAAoJEI5FoCIzSKrwGhAIAKy0t2kj5KOWM+GO6S5G7RiK
W9nFK2kFR5iD8w31H/5a+qSDWsnFh0pbxEIy47jX/5ujfmeyCRtpI+Ox+ajnu2B/
6oqnkxq/KyOYqIRRiqx3BrF4FPIoc+QiKZpmCxwfUs8QkMzGKcawz1yz3vMk0zcW
gTi3CKo8Rtemdb/KSjaJ172BpuCzrFB0v9iQ41KXy+N1cnZbtmF9xi6otJTtwdQS
bYwMA+k6YyfA041P5k2NKOEEFOL3JVG+fbWvbfFT38q7BD8BHkcOQwpgRyp1oN+3
ijh5c/MEg3eHK63chqYa5QQmuHUDfPE/8vQ5NgkAHmNYX7dh8uZrcV6KfjBp6Ao=
=uDJU
-----END PGP SIGNATURE-----




Information forwarded to bug-parted <at> gnu.org:
bug#18258; Package parted. (Tue, 19 Aug 2014 20:12:01 GMT) Full text and rfc822 format available.

Message #17 received at 18258 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Phillip Susi <psusi <at> ubuntu.com>
Cc: 18258 <at> debbugs.gnu.org
Subject: Re: bug#18258: t0251-gpt-unicode.sh fails when the C.UTF-8 locale is
 unavailable
Date: Tue, 19 Aug 2014 22:11:21 +0200
Phillip Susi <psusi <at> ubuntu.com> skribis:

> How can the C locale possibly not exist on a system that is not
> totally broken?  It is the default and fallback locale when you don't
> have any locales installed.

C always exists, but C.UTF-8 no.

Ludo’.




Information forwarded to bug-parted <at> gnu.org:
bug#18258; Package parted. (Fri, 22 Aug 2014 20:27:02 GMT) Full text and rfc822 format available.

Message #20 received at 18258 <at> debbugs.gnu.org (full text, mbox):

From: mhw <at> netris.org
To: Phillip Susi <psusi <at> ubuntu.com>
Cc: Ludovic Courtès <ludo <at> gnu.org>, 18258 <at> debbugs.gnu.org
Subject: Re: bug#18258: t0251-gpt-unicode.sh fails when the C.UTF-8 locale is
 unavailable
Date: Fri, 22 Aug 2014 16:25:49 -0400
Phillip Susi <psusi <at> ubuntu.com> writes:

> On 8/13/2014 7:53 AM, Ludovic Courtès wrote:
>> Hello,
>> 
>> t0251-gpt-unicode.sh requires the C.UTF-8 locale and fails if it
>> isn’t available.
>> 
>> What about:
>> 
>> 1. Exiting with 77 when the locale is unavailable?
>> 
>> 2. Choosing another locale, such as en_US.utf8?  As of GNU libc
>> 2.19, C.UTF-8 (or any other spelling) does not exist.
>
> How can the C locale possibly not exist on a system that is not
> totally broken?  It is the default and fallback locale when you don't
> have any locales installed.

C.UTF-8 is a non-standard Debian extension.  It is not available in
upstream GNU libc, and it is absent from other popular distributions
such as Fedora and Arch.

See:

  https://bugzilla.redhat.com/show_bug.cgi?id=902094
  https://bugs.archlinux.org/task/32296
  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=522776

      Mark




This bug report was last modified 10 years and 302 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.