[Pkg-shadow-devel] [Git][debian/adduser][master] 2 commits: Add login to test Dependencies
Marc Haber (@zugschlus)
gitlab at salsa.debian.org
Sat Feb 22 06:54:25 GMT 2025
Marc Haber pushed to branch master at Debian / adduser
Commits:
47c9287b by Marc Haber at 2025-02-22T07:42:26+01:00
Add login to test Dependencies
- - - - -
42c88018 by Marc Haber at 2025-02-22T07:51:19+01:00
allow adduser to run without Encode and I18N::Langinfo installed
Thanks: Yves-Alexis Perez, Bastian Germann
Closes: #1098508
It turned out that autopkgtest chroots are not minimal, most probably
since the package is built inside the same chroot before the tests are
run. Thus, adduser's inability to run without libperl5.40 was not
detected, and I had the impression that libperl5.40 would belong to the
minimal package set, which is not the case. In passing, we changed the
code to block eval, which allows us to run with perlcritic right now.
That required $codeset to be a variable.
- - - - -
4 changed files:
- AdduserCommon.pm
- adduser
- debian/tests/control
- deluser
Changes:
=====================================
AdduserCommon.pm
=====================================
@@ -1,8 +1,6 @@
package Debian::AdduserCommon 3.139;
use 5.40.0;
use utf8;
-use Encode;
-use I18N::Langinfo qw(langinfo CODESET);
# Subroutines shared by the "adduser" and "deluser" utilities.
#
@@ -29,6 +27,7 @@ use I18N::Langinfo qw(langinfo CODESET);
use parent qw(Exporter);
use Fcntl qw(:flock SEEK_END);
+my $codeset;
use Debian::AdduserLogging 3.139;
use Debian::AdduserRetvalues 3.139;
@@ -37,15 +36,36 @@ BEGIN {
Debian::AdduserRetvalues->VERSION != version->declare('3.139') ) {
die "wrong module version in adduser, check your packaging or path";
}
+ local $ENV{PERL_DL_NONLAZY}=1;
+ eval {
+ require Encode;
+ Encode->import(qw(encode decode));
+ };
+ if ($@) {
+ *encode = sub { return $_[1]; };
+ *decode = sub { return $_[1]; };
+ }
+ $codeset="US-ASCII";
+ eval {
+ require I18N::Langinfo;
+ I18N::Langinfo->import(qw(langinfo CODESET YESEXPR NOEXPR));
+ $codeset = I18N::Langinfo->CODESET;
+ };
+ if ($@) {
+ *langinfo = sub { return shift; };
+ *YESEXPR = sub { "^[yY]" };
+ *NOEXPR = sub { "^[nN]" };
+ }
}
use vars qw(@EXPORT $VAR1);
-my $charset = langinfo(CODESET);
+my $charset = langinfo($codeset);
BEGIN {
local $ENV{PERL_DL_NONLAZY}=1;
- # we need to use eval expression form here, perl cookbok 12.2.3
- eval " use Locale::gettext; "; ## no critic
+ eval {
+ use Locale::gettext;
+ };
if ($@) {
*gettext = sub { shift };
*textdomain = sub { "" };
=====================================
adduser
=====================================
@@ -24,7 +24,6 @@
use 5.40.0;
use utf8;
-use Encode;
use Getopt::Long;
@@ -40,28 +39,36 @@ BEGIN {
}
my $version = "DVERSION";
+my $encode_loaded = 0;
+my $codeset;
BEGIN {
local $ENV{PERL_DL_NONLAZY}=1;
- # we need to disable perlcritic here since this construct
- # needs experession form eval, see perl cookbook 12.2.3
- ## no critic
- eval "
+ eval {
require POSIX;
POSIX->import(qw(setlocale));
- ";
- ## use critic
+ };
if ($@) {
*setlocale = sub { return 1 };
} else {
setlocale( &POSIX::LC_MESSAGES, "" );
}
- ## no critic
- eval "
+ eval {
+ require Encode;
+ Encode->import(qw(encode decode));
+ };
+ $encode_loaded = 1;
+ if ($@) {
+ $encode_loaded = 0;
+ *encode = sub { return $_[1]; };
+ *decode = sub { return $_[1]; };
+ }
+ $codeset = "US-ASCII";
+ eval {
require I18N::Langinfo;
- I18N::Langinfo->import(qw(langinfo CODESET YESEXPR NOEXPR))
- ";
- ## use critic
+ I18N::Langinfo->import(qw(langinfo CODESET YESEXPR NOEXPR));
+ $codeset = I18N::Langinfo->CODESET;
+ };
if ($@) {
*langinfo = sub { return shift; };
*YESEXPR = sub { "^[yY]" };
@@ -70,9 +77,11 @@ BEGIN {
}
my $yesexpr = langinfo(YESEXPR());
-my $charset = langinfo(CODESET);
-binmode(STDOUT, ":encoding($charset)");
-binmode(STDERR, ":encoding($charset)");
+my $charset = langinfo($codeset);
+if ($encode_loaded) {
+ binmode(STDOUT, ":encoding($charset)");
+ binmode(STDERR, ":encoding($charset)");
+}
my %config; # configuration hash
=====================================
debian/tests/control
=====================================
@@ -1,7 +1,7 @@
Test-Command: /usr/bin/prove -v debian/tests/f
-Depends: cron, perl
+Depends: cron, perl, login
Restrictions: needs-root
Test-Command: cd testsuite/ && ./runsuite.sh
-Depends: cron, perl
+Depends: cron, perl, login
Restrictions: allow-stderr breaks-testbed needs-root
=====================================
deluser
=====================================
@@ -22,8 +22,6 @@
use 5.40.0;
use utf8;
-use Encode;
-use I18N::Langinfo qw(langinfo CODESET);
use Getopt::Long;
@@ -39,34 +37,54 @@ BEGIN {
}
my $version = "DVERSION";
+my $encode_loaded = 0;
+my $codeset;
my $install_more_packages;
BEGIN {
local $ENV{PERL_DL_NONLAZY}=1;
- # we need to disable perlcritic here since this construct
- # needs experession form eval, see perl cookbook 12.2.3
- eval "use File::Find;"; ## no critic
+ eval {
+ use File::Find;
+ };
if ($@) {
$install_more_packages = 1;
}
- #no warnings "File::Find";
- eval "use File::Temp;"; ## no critic
+ eval {
+ use File::Temp;
+ };
if ($@) {
- $install_more_packages = 1;
+ $install_more_packages = 1;
+ };
+ eval {
+ require Encode;
+ Encode->import(qw(encode decode));
+ };
+ $encode_loaded = 1;
+ if ($@) {
+ $encode_loaded = 0;
+ *encode = sub { return $_[1]; };
+ *decode = sub { return $_[1]; };
+ }
+ $codeset = "US-ASCII";
+ eval {
+ require I18N::Langinfo;
+ I18N::Langinfo->import(qw(langinfo CODESET YESEXPR NOEXPR));
+ $codeset = I18N::Langinfo->CODESET;
+ };
+ if ($@) {
+ *langinfo = sub { return shift; };
+ *YESEXPR = sub { "^[yY]" };
+ *NOEXPR = sub { "^[nN]" };
}
}
BEGIN {
- # we need to disable perlcritic here since this construct
- # needs experession form eval, see perl cookbook 12.2.3
- ## no critic
- eval "
+ eval {
require POSIX;
POSIX->import(qw(setlocale));
- ";
- ## use critic
+ };
if ($@) {
*setlocale = sub { return 1 };
} else {
@@ -74,7 +92,7 @@ BEGIN {
}
}
-my $charset = langinfo(CODESET);
+my $charset = langinfo($codeset);
binmode(STDOUT, ":encoding($charset)");
binmode(STDERR, ":encoding($charset)");
View it on GitLab: https://salsa.debian.org/debian/adduser/-/compare/6ace968683ccc24223948daf463c6ff16e8ab94d...42c88018a546f414ae3fff695d147d3836a56503
--
View it on GitLab: https://salsa.debian.org/debian/adduser/-/compare/6ace968683ccc24223948daf463c6ff16e8ab94d...42c88018a546f414ae3fff695d147d3836a56503
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-shadow-devel/attachments/20250222/3f54060d/attachment-0001.htm>
More information about the Pkg-shadow-devel
mailing list