All of lore.kernel.org
 help / color / mirror / Atom feed
* cfdisk, wrong interpretation of yes in non-english language
@ 2014-08-26  9:18 tnut
  2014-08-26 10:41 ` Stephan Müller
  2014-08-26 17:58 ` Karel Zak
  0 siblings, 2 replies; 7+ messages in thread
From: tnut @ 2014-08-26  9:18 UTC (permalink / raw)
  To: util-linux

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;
                 }

Regards


Thierry Nuttens

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cfdisk, wrong interpretation of yes in non-english language
  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 17:58 ` Karel Zak
  1 sibling, 1 reply; 7+ messages in thread
From: Stephan Müller @ 2014-08-26 10:41 UTC (permalink / raw)
  To: util-linux

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).

 regards

 stephan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cfdisk, wrong interpretation of yes in non-english language
  2014-08-26 10:41 ` Stephan Müller
@ 2014-08-26 11:33   ` tnut
  2014-08-26 12:54     ` Stephan Müller
  0 siblings, 1 reply; 7+ messages in thread
From: tnut @ 2014-08-26 11:33 UTC (permalink / raw)
  To: Stephan Müller; +Cc: util-linux

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).
>
>  regards
>
>  stephan
> --
> To unsubscribe from this list: send the line "unsubscribe util-linux" 
> in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

I did this test before, unfortunatly if the translation is wrong done 
asking yes or no it's not working without double check

regards

Thierry




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cfdisk, wrong interpretation of yes in non-english language
  2014-08-26 11:33   ` tnut
@ 2014-08-26 12:54     ` Stephan Müller
  0 siblings, 0 replies; 7+ messages in thread
From: Stephan Müller @ 2014-08-26 12:54 UTC (permalink / raw)
  To: util-linux

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cfdisk, wrong interpretation of yes in non-english language
  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 17:58 ` Karel Zak
  2014-08-26 19:28   ` tnut
  2014-08-26 20:23   ` Karel Zak
  1 sibling, 2 replies; 7+ messages in thread
From: Karel Zak @ 2014-08-26 17:58 UTC (permalink / raw)
  To: tnut; +Cc: util-linux

On Tue, Aug 26, 2014 at 11:18:09AM +0200, tnut@nutyx.org wrote:
> -               if (rc <= 0 || strcasecmp(buf, "yes") != 0
> -                           || strcasecmp(buf, _("yes")) != 0) {
> +               if (rc <= 0 ||  (strcasecmp(buf, "yes") != 0
> +                           && strcasecmp(buf, _("yes")) != 0)) {

 Fixed, thanks!

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cfdisk, wrong interpretation of yes in non-english language
  2014-08-26 17:58 ` Karel Zak
@ 2014-08-26 19:28   ` tnut
  2014-08-26 20:23   ` Karel Zak
  1 sibling, 0 replies; 7+ messages in thread
From: tnut @ 2014-08-26 19:28 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

Le 2014-08-26 19:58, Karel Zak a écrit :
> On Tue, Aug 26, 2014 at 11:18:09AM +0200, tnut@nutyx.org wrote:
>> -               if (rc <= 0 || strcasecmp(buf, "yes") != 0
>> -                           || strcasecmp(buf, _("yes")) != 0) {
>> +               if (rc <= 0 ||  (strcasecmp(buf, "yes") != 0
>> +                           && strcasecmp(buf, _("yes")) != 0)) {
>
>  Fixed, thanks!
>
>     Karel

Actually there is another problem with the NLS, but is it possible to 
test the latest git or svn version ? as it could be allready fixed in 
the latest version

Thanks

Thierry

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: cfdisk, wrong interpretation of yes in non-english language
  2014-08-26 17:58 ` Karel Zak
  2014-08-26 19:28   ` tnut
@ 2014-08-26 20:23   ` Karel Zak
  1 sibling, 0 replies; 7+ messages in thread
From: Karel Zak @ 2014-08-26 20:23 UTC (permalink / raw)
  To: tnut; +Cc: util-linux

On Tue, Aug 26, 2014 at 07:58:17PM +0200, Karel Zak wrote:
> On Tue, Aug 26, 2014 at 11:18:09AM +0200, tnut@nutyx.org wrote:
> > -               if (rc <= 0 || strcasecmp(buf, "yes") != 0
> > -                           || strcasecmp(buf, _("yes")) != 0) {
> > +               if (rc <= 0 ||  (strcasecmp(buf, "yes") != 0
> > +                           && strcasecmp(buf, _("yes")) != 0)) {
> 
>  Fixed, thanks!

 Sorry, committed with typo, should be fixed now.

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-08-26 20:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2014-08-26 17:58 ` Karel Zak
2014-08-26 19:28   ` tnut
2014-08-26 20:23   ` Karel Zak

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.