From d52eaa4814d307d9e62f8a0d22e3959fa97d9ec5 Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Mon, 8 Mar 2021 07:54:04 +0100 Subject: [PATCH] instead of checking for defined-ness and then comparing with the empty string, we can just use 'length' which returns undef if its argument is undef --- mmdebstrap | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mmdebstrap b/mmdebstrap index 80987cc..c611f8d 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -1219,16 +1219,16 @@ sub run_hooks { # If the hook script needs a writable TMPDIR, then it can always use /tmp # inside the chroot. This is also why we do not set a new MMDEBSTRAP_TMPDIR # environment variable. - if (defined $ENV{TMPDIR} && $ENV{TMPDIR} ne "") { + if (length $ENV{TMPDIR}) { push @env_opts, '--unset=TMPDIR'; } # The APT_CONFIG variable, if set, will confuse any manual calls to # apt-get. If you want to use the same config used by mmdebstrap, the # original value is stored in MMDEBSTRAP_APT_CONFIG. - if (defined $ENV{APT_CONFIG} && $ENV{APT_CONFIG} ne "") { + if (length $ENV{APT_CONFIG}) { push @env_opts, '--unset=APT_CONFIG'; } - if (defined $ENV{APT_CONFIG} && $ENV{APT_CONFIG} ne "") { + if (length $ENV{APT_CONFIG}) { push @env_opts, "MMDEBSTRAP_APT_CONFIG=$ENV{APT_CONFIG}"; } # Storing the mode is important for hook scripts to potentially change @@ -1871,7 +1871,7 @@ sub run_setup() { } # setting PATH for chroot, ldconfig, start-stop-daemon... - if (defined $ENV{PATH} && $ENV{PATH} ne "") { + if (length $ENV{PATH}) { ## no critic (Variables::RequireLocalizedPunctuationVars) $ENV{PATH} = "$ENV{PATH}:/usr/sbin:/usr/bin:/sbin:/bin"; } else {