В Sun, 21 Nov 2010 22:09:33 +0100 Simon Paillard <spaill...@debian.org> пишет:
> tags 486877 -patch -pending > tags 442619 -pending > thanks > > Hi, > > On Sat, Nov 06, 2010 at 08:46:55PM +0300, Yuri Kozlov wrote: > > Package: adduser > > Version: 3.112+nmu1 > > Tags: l10n, patch > > Severity: normal > > > > Here patch, which resolved this problem (and #442619 too). > > Though it works *with perl-modules installed*, unfortunately, in a clean > sid chroot without perl-modules, the patch breaks adduser: > > # adduser test > Can't locate Encode.pm in @INC (@INC > contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 > /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 > /usr/local/lib/site_perl .) > at /usr/sbin/adduser line 78. BEGIN failed--compilation aborted > at /usr/sbin/adduser line 78. Ok, I look into debconf code and rewrite patch without Encode.pm. -- Best Regards, Yuri Kozlov
diff -Naur adduser-3.112+nmu1.orig/adduser adduser-3.112+nmu1/adduser --- adduser-3.112+nmu1.orig/adduser 2009-09-21 00:31:46.000000000 +0400 +++ adduser-3.112+nmu1/adduser 2010-11-22 22:36:31.787591472 +0300 @@ -66,19 +66,37 @@ } eval { require I18N::Langinfo; - import I18N::Langinfo qw(langinfo YESEXPR NOEXPR); + import I18N::Langinfo qw(langinfo CODESET YESEXPR NOEXPR); }; if ($@) { *langinfo = sub { return shift; }; *YESEXPR = sub { "^[yY]" }; *NOEXPR = sub { "^[nN]" }; + *CODESET = sub { "" }; + } else { + # idea from /usr/share/perl5/Debconf/Encoding.pm + no warnings; + eval q{ use Text::Iconv }; + use warnings; + if (! $@) { + *decode = sub { + my $string = shift; + my $converter = Text::Iconv->new(langinfo(CODESET()), "UTF-8"); + $string = $converter->convert($string); + utf8::decode($string); + return $string; + } + }; + }; + if (! defined(&decode)) { + *decode = sub { return shift; }; } } setlocale(LC_MESSAGES, ""); textdomain("adduser"); -my $yesexpr = langinfo(YESEXPR()); +my $yesexpr = decode(langinfo(YESEXPR())); my %config; # configuration hash my @defaults = ("/etc/adduser.conf"); @@ -531,7 +549,7 @@ create_homedir (1); # copy skeleton data # useradd without -p has left the account disabled (password string is '!') - my $yesexpr = langinfo(YESEXPR()); + my $yesexpr = decode(langinfo(YESEXPR())); if ($ask_passwd) { for (;;) { my $passwd = &which('passwd'); @@ -554,6 +572,7 @@ # expression will be checked to find positive answer. print (gtx("Try again? [y/N] ")); chop ($answer=<STDIN>); + $answer = decode($answer); last if ($answer !~ m/$yesexpr/o); } else { @@ -571,7 +590,7 @@ &ch_gecos($new_gecos); } else { - my $noexpr = langinfo(NOEXPR()); + my $noexpr = decode(langinfo(NOEXPR())); for (;;) { my $chfn = &which('chfn'); &systemcall($chfn, $new_name); @@ -580,6 +599,7 @@ # expression will be checked to find positive answer. print (gtx("Is the information correct? [Y/n] ")); chop (my $answer=<STDIN>); + $answer = decode($answer); last if ($answer !~ m/$noexpr/o); } }