[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#577117: apt: dselect/install - modernize if-statements not to use 'x'



Package: apt
Version: 0.7.25.3
Severity: wishlist
Tags: patch


The following patch suggest discarding old style tests:

    if [ x$VAR = "xvalue" ]

As the [ ] already handles that, as in:

    if [ "$VAR" = "value" ]

This would improve readability.

-- Package-specific info:

-- /etc/apt/preferences --

-- (/etc/apt/sources.list present, but not submitted) --


-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-trunk-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages apt depends on:
ii  debian-archive-keyring        2009.01.31 GnuPG archive keys of the Debian a
ii  libc6                         2.10.2-6   Embedded GNU C Library: Shared lib
ii  libgcc1                       1:4.4.2-9  GCC support library
ii  libstdc++6                    4.4.2-9    The GNU Standard C++ Library v3

apt recommends no packages.

Versions of packages apt suggests:
pn  apt-doc                       <none>     (no description available)
pn  aptitude | synaptic | wajig   <none>     (no description available)
ii  bzip2                         1.0.5-4    high-quality block-sorting file co
ii  dpkg-dev                      1.15.5.6   Debian package development tools
ii  lzma                          4.43-14    Compression method of 7z format in
ii  python-apt                    0.7.94.2   Python interface to libapt-pkg

-- no debconf information
>From bbdee7c2b1eb3212028e95753048fd62e843ad68 Mon Sep 17 00:00:00 2001
From: Jari Aalto <jari.aalto@cante.net>
Date: Fri, 9 Apr 2010 21:50:59 +0300
Subject: [PATCH 2/2] dselect/install: cleanup unnecessary 'x' variable addenums
Organization: Private
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

Signed-off-by: Jari Aalto <jari.aalto@cante.net>
---
 dselect/install |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dselect/install b/dselect/install
index 5851999..316579d 100755
--- a/dselect/install
+++ b/dselect/install
@@ -46,7 +46,7 @@ yesno() {
 	echo $ans | tr YN yn
 }
 
-if [ x$WAIT = "xtrue" ]; then
+if [ "$WAIT" = "true" ]; then
    $APTGET $OPTS "$APT_OPT0" "$APT_OPT1" -d dselect-upgrade
    echo $"Press enter to continue." && read RES
    $APTGET $OPTS "$APT_OPT0" "$APT_OPT1" dselect-upgrade
@@ -70,8 +70,8 @@ if [ $RES -eq 0 ]; then
    fi
 
    NEWLS=$(ls -ld $ARCHIVES)
-   if [ x$CHECKDIR = "xtrue" ]; then
-      if [ "x$OLDLS" = "x$NEWLS" ]; then
+   if [ "$CHECKDIR" = "true" ]; then
+      if [ "$OLDLS" = "$NEWLS" ]; then
          exit 0
       fi
    fi
-- 
1.7.0


Reply to: