Re: [pacman-dev] [PATCH 1/1] always accept untranslated answers 'Y' and 'N'

2016-11-11 Thread Christian Hesse
Christian Hesse  on Fri, 2016/11/11 21:34:
> Lukas Fleischer  on Fri, 2016/11/11 21:23:
> > On Fri, 11 Nov 2016 at 21:15:48, Christian Hesse wrote:  
> > > From: Christian Hesse 
> > > 
> > > 'YES' translates to 'JA' in German, thus answer 'J' is expected for
> > > positive answer. This changes the behaviour to always accept 'Y'
> > > and 'N', in addition to the translated values.  
> >
> > Not sure whether it is a problem in practice but what happens if "N" is
> > translated to "Y" in some language? Do we really want to accept if the
> > user enters "Y" in that case?  
> 
> A valid point...
> Does such a language exist?

Answering myself... Yes!
So we definitely do *not* want this.

Nevertheless... Learned some interesting facts about languages. :D
-- 
main(a){char*c=/*Schoene Gruesse */"B?IJj;MEH"
"CX:;",b;for(a/*Best regards my address:*/=0;b=c[a++];)
putchar(b-1/(/*Chriscc -ox -xc - && ./x*/b/42*2-3)*42);}


pgpsZnEGKdJvM.pgp
Description: OpenPGP digital signature


Re: [pacman-dev] [PATCH 1/1] always accept untranslated answers 'Y' and 'N'

2016-11-11 Thread Florian Weigelt
"Yes" in Swahili it is "Ndiyo", in Arabic it's "Na'am", Greek is "Nai", ...
apt on Ubuntu allows to answer with "J" for "Yes" on a German locale.
But I am not sure if apt unconditionally allows to answer with "Y/N". In
general I think it's a bad idea. Either allow localized input only, or
Y/N only.

On 11/11/16 21:34, Christian Hesse wrote:
> Lukas Fleischer  on Fri, 2016/11/11 21:23:
>> On Fri, 11 Nov 2016 at 21:15:48, Christian Hesse wrote:
>>> From: Christian Hesse 
>>>
>>> 'YES' translates to 'JA' in German, thus answer 'J' is expected for
>>> positive answer. This changes the behaviour to always accept 'Y'
>>> and 'N', in addition to the translated values.
>>
>> Not sure whether it is a problem in practice but what happens if "N" is
>> translated to "Y" in some language? Do we really want to accept if the
>> user enters "Y" in that case?
> 
> A valid point...
> Does such a language exist?
> 
> All my systems are configured with English locale, except my wife's and my
> mother's one. My blind typing for pacman commands breaks there. :-p
> 
> Well, possibly I should just set the root account to English locale... :D
> 



signature.asc
Description: OpenPGP digital signature


Re: [pacman-dev] [PATCH 1/1] always accept untranslated answers 'Y' and 'N'

2016-11-11 Thread Dave Reisner
On Fri, Nov 11, 2016 at 09:34:05PM +0100, Christian Hesse wrote:
> Lukas Fleischer  on Fri, 2016/11/11 21:23:
> > On Fri, 11 Nov 2016 at 21:15:48, Christian Hesse wrote:
> > > From: Christian Hesse 
> > > 
> > > 'YES' translates to 'JA' in German, thus answer 'J' is expected for
> > > positive answer. This changes the behaviour to always accept 'Y'
> > > and 'N', in addition to the translated values.
> >
> > Not sure whether it is a problem in practice but what happens if "N" is
> > translated to "Y" in some language? Do we really want to accept if the
> > user enters "Y" in that case?
> 
> A valid point...
> Does such a language exist?

It does! Looks like Uzbek would break if we did this:

src/pacman/po/uz.po:msgid "No"
src/pacman/po/uz.po-msgstr "Yo'q"

> All my systems are configured with English locale, except my wife's and my
> mother's one. My blind typing for pacman commands breaks there. :-p
> 
> Well, possibly I should just set the root account to English locale... :D
> -- 
> main(a){char*c=/*Schoene Gruesse */"B?IJj;MEH"
> "CX:;",b;for(a/*Best regards my address:*/=0;b=c[a++];)
> putchar(b-1/(/*Chriscc -ox -xc - && ./x*/b/42*2-3)*42);}


Re: [pacman-dev] [PATCH 1/1] always accept untranslated answers 'Y' and 'N'

2016-11-11 Thread Christian Hesse
Lukas Fleischer  on Fri, 2016/11/11 21:23:
> On Fri, 11 Nov 2016 at 21:15:48, Christian Hesse wrote:
> > From: Christian Hesse 
> > 
> > 'YES' translates to 'JA' in German, thus answer 'J' is expected for
> > positive answer. This changes the behaviour to always accept 'Y'
> > and 'N', in addition to the translated values.
>
> Not sure whether it is a problem in practice but what happens if "N" is
> translated to "Y" in some language? Do we really want to accept if the
> user enters "Y" in that case?

A valid point...
Does such a language exist?

All my systems are configured with English locale, except my wife's and my
mother's one. My blind typing for pacman commands breaks there. :-p

Well, possibly I should just set the root account to English locale... :D
-- 
main(a){char*c=/*Schoene Gruesse */"B?IJj;MEH"
"CX:;",b;for(a/*Best regards my address:*/=0;b=c[a++];)
putchar(b-1/(/*Chriscc -ox -xc - && ./x*/b/42*2-3)*42);}


pgpLZwupj5OVz.pgp
Description: OpenPGP digital signature


Re: [pacman-dev] [PATCH 1/1] always accept untranslated answers 'Y' and 'N'

2016-11-11 Thread Lukas Fleischer
On Fri, 11 Nov 2016 at 21:15:48, Christian Hesse wrote:
> From: Christian Hesse 
> 
> 'YES' translates to 'JA' in German, thus answer 'J' is expected for
> positive answer. This changes the behaviour to always accept 'Y'
> and 'N', in addition to the translated values.
> 
> Signed-off-by: Christian Hesse 
> ---
>  src/pacman/util.c | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/src/pacman/util.c b/src/pacman/util.c
> index fd7438b..e878cb3 100644
> --- a/src/pacman/util.c
> +++ b/src/pacman/util.c
> @@ -1587,9 +1587,13 @@ static int question(short preset, const char *format, 
> va_list args)
> fprintf(stream, "%s\n", response);
> }
>  
> -   if(mbscasecmp(response, _("Y")) == 0 || mbscasecmp(response, 
> _("YES")) == 0) {
> +   if(mbscasecmp(response, "Y") == 0 /* always accept 
> untranslated */
> +   || mbscasecmp(response, _("Y")) == 0
> +   || mbscasecmp(response, _("YES")) == 0) {
> return 1;
> -   } else if(mbscasecmp(response, _("N")) == 0 || 
> mbscasecmp(response, _("NO")) == 0) {
> +   } else if(mbscasecmp(response, "N") == 0 /* always accept 
> untranslated */
> +   || mbscasecmp(response, _("N")) == 0
> +   || mbscasecmp(response, _("NO")) == 0) {

Not sure whether it is a problem in practice but what happens if "N" is
translated to "Y" in some language? Do we really want to accept if the
user enters "Y" in that case?

> return 0;
> }
> }
> -- 
> 2.10.2


[pacman-dev] [PATCH 1/1] always accept untranslated answers 'Y' and 'N'

2016-11-11 Thread Christian Hesse
From: Christian Hesse 

'YES' translates to 'JA' in German, thus answer 'J' is expected for
positive answer. This changes the behaviour to always accept 'Y'
and 'N', in addition to the translated values.

Signed-off-by: Christian Hesse 
---
 src/pacman/util.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/pacman/util.c b/src/pacman/util.c
index fd7438b..e878cb3 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -1587,9 +1587,13 @@ static int question(short preset, const char *format, 
va_list args)
fprintf(stream, "%s\n", response);
}
 
-   if(mbscasecmp(response, _("Y")) == 0 || mbscasecmp(response, 
_("YES")) == 0) {
+   if(mbscasecmp(response, "Y") == 0 /* always accept untranslated 
*/
+   || mbscasecmp(response, _("Y")) == 0
+   || mbscasecmp(response, _("YES")) == 0) {
return 1;
-   } else if(mbscasecmp(response, _("N")) == 0 || 
mbscasecmp(response, _("NO")) == 0) {
+   } else if(mbscasecmp(response, "N") == 0 /* always accept 
untranslated */
+   || mbscasecmp(response, _("N")) == 0
+   || mbscasecmp(response, _("NO")) == 0) {
return 0;
}
}
-- 
2.10.2