Skip to contentSkip to conversation

cfdisk, wrong interpretation of yes in non-english language

PATCH [email protected] 3 participants 7 messages Aug 26, 2014 Util-Linux package

lore
Share & tools
lore
#0 lore raw

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:

disk-utils/cfdisk.c 2014-08-25 18:52:17.000000000 +0000 renamed from disk-utils/cfdisk.c 2014-07-21 13:36:21.000000000 +0000 +2 -2
@@ -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

#1 lore raw

Am 26.08.2014 11:18, schrieb [email protected]:

Quoted 13 lines

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:

disk-utils/cfdisk.c 2014-08-25 18:52:17.000000000 +0000 line 1841

Quoted 10 lines
disk-utils/cfdisk.c 2014-08-25 18:52:17.000000000 +0000 renamed from disk-utils/cfdisk.c 2014-07-21 13:36:21.000000000 +0000 +2 -2
@@ -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

#2 lore raw

Le 2014-08-26 12:41, Stephan Müller a écrit :

Quoted 32 lines

Am 26.08.2014 11:18, schrieb [email protected]:

Quoted 24 lines

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

disk-utils/cfdisk.c 2014-08-25 18:52:17.000000000 +0000 renamed from disk-utils/cfdisk.c 2014-07-21 13:36:21.000000000 +0000 +2 -2
@@ -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;
Quoted 2 lines
                }

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

Quoted 7 lines

regards

stephan
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to [email protected]
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

#3 lore raw

Am 26.08.2014 13:33, schrieb [email protected]:

Quoted 31 lines · Stephan Müller
Quoted 15 lines

Am 26.08.2014 11:18, schrieb [email protected]:

Quoted 14 lines

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:

disk-utils/cfdisk.c 2014-08-25 18:52:17.000000000 +0000 renamed from disk-utils/cfdisk.c 2014-07-21 13:36:21.000000000 +0000 +0 -0
@@ -1834,8 +1834,8 @@
                          buf, sizeof(buf));
 
Quoted 14 lines

disk-utils/cfdisk.c 2014-08-25 18:52:17.000000000 +0000

Quoted 9 lines
disk-utils/cfdisk.c 2014-08-25 18:52:17.000000000 +0000 renamed from disk-utils/cfdisk.c 2014-07-21 13:36:21.000000000 +0000 +2 -2
                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).

Quoted 2 lines

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

maintainer
#4 lore raw
In reply to [email protected]

disk-utils/cfdisk.c 2014-08-25 18:52:17.000000000 +0000 line 1838

Quoted 4 lines · On Tue, Aug 26, 2014 at 11:18:09AM +0200, [email protected] wrote:
disk-utils/cfdisk.c 2014-08-25 18:52:17.000000000 +0000 renamed from disk-utils/cfdisk.c 2014-07-21 13:36:21.000000000 +0000 +2 -2
-               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

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#5 lore raw

Le 2014-08-26 19:58, Karel Zak a écrit :

Quoted 9 lines · On Tue, Aug 26, 2014 at 11:18:09AM +0200, [email protected] wrote:

disk-utils/cfdisk.c 2014-08-25 18:52:17.000000000 +0000 line 1838

Quoted 4 lines
disk-utils/cfdisk.c 2014-08-25 18:52:17.000000000 +0000 renamed from disk-utils/cfdisk.c 2014-07-21 13:36:21.000000000 +0000 +2 -2
-               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

maintainer
#6 lore raw
In reply to Karel Zak
Quoted 7 lines · Karel Zak

disk-utils/cfdisk.c 2014-08-25 18:52:17.000000000 +0000 line 1838

Quoted 4 lines · On Tue, Aug 26, 2014 at 11:18:09AM +0200, [email protected] wrote:
disk-utils/cfdisk.c 2014-08-25 18:52:17.000000000 +0000 renamed from disk-utils/cfdisk.c 2014-07-21 13:36:21.000000000 +0000 +2 -2
-               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

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com