Browse Source

unset LANGUAGE for showing [Y/n] answer hints

nl_langinfo is used to acquire the YESEXPR of the language used,
but it will return the one from LC_MESSAGES, which might be different
from the language chosen for display of the question (based on LANGUAGE)
so this commit removes the [Y/n] help text from the questions itself and
moves it to the prompt creation in which the usage of LC_MESSAGES is
forced for it, so that the helptext shown actually represents the
characters accepted as input for the question.

There is still room for problems of course starting with an untranslated
"[Y/n]" but a translated YESEXPR or the problem that the question is
asked in a completely different language which might have a conflicting
definition of [Y/n] input or the user simple ignores the helptext and
assumes that an answer matching the question language is accepted, but
the mayority of users will never have this problem to begin with, so we
should be fine (or at least a bit finer than before).

Closes nothing really, but should at least help a bit with bugs like
deb:194614, deb:471102, lp:1205578, and countless others.
debian/1.8.y
David Kalnischkies 9 years ago
parent
commit
55732492dd
  1. 35
      cmdline/apt-get.cc
  2. 2
      configure.ac
  3. 576
      po/apt-all.pot
  4. 580
      po/ar.po
  5. 584
      po/ast.po
  6. 580
      po/bg.po
  7. 579
      po/bs.po
  8. 580
      po/ca.po
  9. 580
      po/cs.po
  10. 579
      po/cy.po
  11. 580
      po/da.po
  12. 584
      po/de.po
  13. 586
      po/dz.po
  14. 586
      po/el.po
  15. 588
      po/es.po
  16. 582
      po/eu.po
  17. 580
      po/fi.po
  18. 580
      po/fr.po
  19. 582
      po/gl.po
  20. 580
      po/hu.po
  21. 584
      po/it.po
  22. 586
      po/ja.po
  23. 578
      po/km.po
  24. 580
      po/ko.po
  25. 579
      po/ku.po
  26. 580
      po/lt.po
  27. 578
      po/mr.po
  28. 580
      po/nb.po
  29. 580
      po/ne.po
  30. 582
      po/nl.po
  31. 582
      po/nn.po
  32. 580
      po/pl.po
  33. 584
      po/pt.po
  34. 580
      po/pt_BR.po
  35. 584
      po/ro.po
  36. 580
      po/ru.po
  37. 584
      po/sk.po
  38. 588
      po/sl.po
  39. 580
      po/sv.po
  40. 584
      po/th.po
  41. 582
      po/tl.po
  42. 859
      po/tr.po
  43. 584
      po/uk.po
  44. 580
      po/vi.po
  45. 582
      po/zh_CN.po
  46. 581
      po/zh_TW.po
  47. 4
      test/integration/test-bug-596498-trusted-unsigned-repo

35
cmdline/apt-get.cc

@ -130,13 +130,42 @@ class CacheFile : public pkgCacheFile
/* Returns true on a Yes.*/
bool YnPrompt(bool Default=true)
{
/* nl_langinfo does not support LANGUAGE setting, so we unset it here
to have the help-message (hopefully) match the expected characters */
char * language = getenv("LANGUAGE");
if (language != NULL)
language = strdup(language);
if (language != NULL)
unsetenv("LANGUAGE");
if (Default == true)
// TRANSLATOR: Yes/No question help-text: defaulting to Y[es]
// e.g. "Do you want to continue? [Y/n] "
// The user has to answer with an input matching the
// YESEXPR/NOEXPR defined in your l10n.
c2out << " " << _("[Y/n]") << " " << std::flush;
else
// TRANSLATOR: Yes/No question help-text: defaulting to N[o]
// e.g. "Should this file be removed? [y/N] "
// The user has to answer with an input matching the
// YESEXPR/NOEXPR defined in your l10n.
c2out << " " << _("[y/N]") << " " << std::flush;
if (language != NULL)
{
setenv("LANGUAGE", language, 0);
free(language);
}
if (_config->FindB("APT::Get::Assume-Yes",false) == true)
{
// TRANSLATOR: "Yes" answer printed for a yes/no question if --assume-yes is set
c1out << _("Y") << endl;
return true;
}
else if (_config->FindB("APT::Get::Assume-No",false) == true)
{
// TRANSLATOR: "No" answer printed for a yes/no question if --assume-no is set
c1out << _("N") << endl;
return false;
}
@ -1076,7 +1105,7 @@ static bool CheckAuth(pkgAcquire& Fetcher)
if (_config->FindI("quiet",0) < 2
&& _config->FindB("APT::Get::Assume-Yes",false) == false)
{
c2out << _("Install these packages without verification [y/N]? ") << flush;
c2out << _("Install these packages without verification?") << flush;
if (!YnPrompt(false))
return _error->Error(_("Some packages could not be authenticated"));
@ -1281,8 +1310,8 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
if (_config->FindI("quiet",0) < 2 &&
_config->FindB("APT::Get::Assume-Yes",false) == false)
{
c2out << _("Do you want to continue [Y/n]? ") << flush;
c2out << _("Do you want to continue?") << flush;
if (YnPrompt() == false)
{
c2out << _("Abort.") << endl;

2
configure.ac

@ -18,7 +18,7 @@ AC_CONFIG_AUX_DIR(buildlib)
AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
PACKAGE="apt"
PACKAGE_VERSION="0.9.7.6ubuntu2"
PACKAGE_VERSION="0.9.9.4"
PACKAGE_MAIL="APT Development Team <deity@lists.debian.org>"
AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"$PACKAGE_VERSION")

576
po/apt-all.pot

File diff suppressed because it is too large

580
po/ar.po

File diff suppressed because it is too large

584
po/ast.po

File diff suppressed because it is too large

580
po/bg.po

File diff suppressed because it is too large

579
po/bs.po

File diff suppressed because it is too large

580
po/ca.po

File diff suppressed because it is too large

580
po/cs.po

File diff suppressed because it is too large

579
po/cy.po

File diff suppressed because it is too large

580
po/da.po

File diff suppressed because it is too large

584
po/de.po

File diff suppressed because it is too large

586
po/dz.po

File diff suppressed because it is too large

586
po/el.po

File diff suppressed because it is too large

588
po/es.po

File diff suppressed because it is too large

582
po/eu.po

File diff suppressed because it is too large

580
po/fi.po

File diff suppressed because it is too large

580
po/fr.po

File diff suppressed because it is too large

582
po/gl.po

File diff suppressed because it is too large

580
po/hu.po

File diff suppressed because it is too large

584
po/it.po

File diff suppressed because it is too large

586
po/ja.po

File diff suppressed because it is too large

578
po/km.po

File diff suppressed because it is too large

580
po/ko.po

File diff suppressed because it is too large

579
po/ku.po

File diff suppressed because it is too large

580
po/lt.po

File diff suppressed because it is too large

578
po/mr.po

File diff suppressed because it is too large

580
po/nb.po

File diff suppressed because it is too large

580
po/ne.po

File diff suppressed because it is too large

582
po/nl.po

File diff suppressed because it is too large

582
po/nn.po

File diff suppressed because it is too large

580
po/pl.po

File diff suppressed because it is too large

584
po/pt.po

File diff suppressed because it is too large

580
po/pt_BR.po

File diff suppressed because it is too large

584
po/ro.po

File diff suppressed because it is too large

580
po/ru.po

File diff suppressed because it is too large

584
po/sk.po

File diff suppressed because it is too large

588
po/sl.po

File diff suppressed because it is too large

580
po/sv.po

File diff suppressed because it is too large

584
po/th.po

File diff suppressed because it is too large

582
po/tl.po

File diff suppressed because it is too large

859
po/tr.po

File diff suppressed because it is too large

584
po/uk.po

File diff suppressed because it is too large

580
po/vi.po

File diff suppressed because it is too large

582
po/zh_CN.po

File diff suppressed because it is too large

581
po/zh_TW.po

File diff suppressed because it is too large

4
test/integration/test-bug-596498-trusted-unsigned-repo

@ -27,7 +27,7 @@ aptgetupdate
testequal "$PKGTEXT
WARNING: The following packages cannot be authenticated!
cool
Install these packages without verification [y/N]? N
Install these packages without verification? [y/N] N
E: Some packages could not be authenticated" aptget install cool --assume-no -d
find aptarchive/ \( -name 'Release.gpg' -o -name 'InRelease' \) -delete
@ -37,7 +37,7 @@ aptgetupdate
testequal "$PKGTEXT
WARNING: The following packages cannot be authenticated!
cool
Install these packages without verification [y/N]? N
Install these packages without verification? [y/N] N
E: Some packages could not be authenticated" aptget install cool --assume-no -d
sed -i -e 's#deb#deb [trusted=yes]#' $DEBFILE

Loading…
Cancel
Save