Hi,

From: Christian Perrier
Subject: Re: Bug#361829: Also happens for Swedish
Date: Wed, 6 Dec 2006 19:40:42 +0100

> Quoting Kobayashi Noritada ([EMAIL PROTECTED]):
> > Hi Daniel and Christian,
> > 
> > >   Vill du fortsätta? [J/n/?] j
> > >   Ogiltigt svar.  Ange ett giltigt kommando eller "?" för hjälp.
> > 
> > This bug may be annoying for all of those who use aptitude with
> > languages which have localized Y/N input, as known from many
> > duplicated bug reports.  Since aptitude is used by many unskilled
> > users, it would be better if we can ship unaffected versions in etch
> > either by completely fixing this bug or by temporarily changing values
> > of yes_key and no_key to y and n in po files for all languages.  If
> > this bug is easy to fix, the former approach would be better;
> > otherwise the latter would be proper.
> 
> 
> Not perfect solution but, unless someone comes up to investigate why
> the lcoalized keys aren't working, that is maybe better.

So, I've investigated why, and found the reason.

yes_key and no_key is only used to set keybindings for the visual
interface (at vscreen_init() in src/vscreen/vscreen.cc), not for the
commandline interface.  Prompt for the commandline interface is
described in src/cmdline/cmdline_prompt.cc, which has a following
function:

  bool cmdline_do_prompt(bool as_upgrade,
                       pkgset &to_install,
                       pkgset &to_hold,
                       pkgset &to_remove,
                       pkgset &to_purge,
                       bool showvers,
                       bool showdeps,
                       bool showsize,
                       bool always_prompt,
                       int verbose,
                       bool assume_yes,
                       bool force_no_change)
  {
     (...snip...)
          bool valid_response=false;
  
          while(!valid_response)
            {
              valid_response=true;
              fflush(stdout);
  
              string response=prompt_string(_("Do you want to continue? [Y/n/?] 
"));
              string::size_type loc=0;
  
              while(loc<response.size() && isspace(response[loc]))
                ++loc;
  
              if(loc==response.size())
                {
                  response='y';
                  loc=0;
                }
  
              switch(toupper(response[loc]))
                {
                case 'Y':
                  rval=true;
                  cont=true;
                  break;
                case 'N':
                  rval=false;
                  cont=true;
                  break;
                case 'D':
                  showdeps=!showdeps;
                  if(showdeps)
                    printf(_("\nDependency information will be shown.\n\n"));
                  else
                    printf(_("\nDependency information will not be 
shown.\n\n"));
                  break;
                  (...snip...)
                default:
                  printf(_("Invalid response.  Please enter a valid command or 
'?' for help.\n"));
                  valid_response=false;
                  break;
                }
            }
     (...snip...)
  }

This code obviously explayins the bug. :-)

I'll try to create a patch tomorrow.

(I have a little question about what happens if some languages set
such as 'd' as yes_key, but (although it is not checked) it seems
there are no languages setting characters except for 'y' and 'j' as
yes_key and characters except for 'n' as no_key, so there are no
problems now...)

Regards,

-nori

Reply via email to