public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: "Stephan Müller" <fruktopus@gmail.com>
To: util-linux@vger.kernel.org
Subject: Re: cfdisk, wrong interpretation of yes in non-english language
Date: Tue, 26 Aug 2014 14:54:33 +0200	[thread overview]
Message-ID: <53FC8389.1030702@gmail.com> (raw)
In-Reply-To: <c68ad99b4a25dcb54d691841c1f049a0@nutyx.org>

Am 26.08.2014 13:33, schrieb tnut@nutyx.org:
> Le 2014-08-26 12:41, Stephan Müller a écrit :
>> Am 26.08.2014 11:18, schrieb tnut@nutyx.org:
>>> I'm building a new installer for the NuTyX distribution.
>>>
>>> If another language then english is choose as native language, some answer are wrong interpreted
>>>
>>> I think you should check both cases are wrong instead of one of them or do the test in the opposite way
>>>
>>> Here is a proposal of patch:
>>>
>>>
>>> --- util-linux-2.25/disk-utils/cfdisk.c 2014-07-21 13:36:21.000000000 +0000
>>> +++ util-linux-2.25-new/disk-utils/cfdisk.c     2014-08-25 18:52:17.000000000 +0000
>>> @@ -1834,8 +1834,8 @@
>>>                           buf, sizeof(buf));
>>>
>>>                 ref = 1;
>>> -               if (rc <= 0 || strcasecmp(buf, "yes") != 0
>>> -                           || strcasecmp(buf, _("yes")) != 0) {
>>> +               if (rc <= 0 ||  (strcasecmp(buf, "yes") != 0
>>> +                           && strcasecmp(buf, _("yes")) != 0)) {
>>>                         info = _("Did not write partition table to disk");
>>>                         break;
>>>                 }
>>>
>>
>> Why are both tests necessary at all? If NLS is disabled, both tests
>> agree. If it is enabled, we should test against the gettext translated
>> version only (2nd strcasecmp).
>>
> 
> I did this test before, unfortunatly if the translation is wrong done asking yes or no it's not working without double check
> 

Ah, ok. So we have English as backup. You could always type "yes" to write your partition table - no matter of your locale. Still I don't get why this ever worked with NLS enabled - did it? Say a for French, _("yes") expands to "oui". So

  strcasecmp(buf, "yes") != 0 || strcasecmp(buf, ("oui")) != 0

is always true. So not some, but all affirmative answers are mistreated. Your patch will fix that.

 ~stephan


  reply	other threads:[~2014-08-26 12:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-26  9:18 cfdisk, wrong interpretation of yes in non-english language tnut
2014-08-26 10:41 ` Stephan Müller
2014-08-26 11:33   ` tnut
2014-08-26 12:54     ` Stephan Müller [this message]
2014-08-26 17:58 ` Karel Zak
2014-08-26 19:28   ` tnut
2014-08-26 20:23   ` Karel Zak

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=53FC8389.1030702@gmail.com \
    --to=fruktopus@gmail.com \
    --cc=util-linux@vger.kernel.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