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

Bug#255577: XSI:isms in several scripts



Package: apt
Version: 0.6.25
Severity: minor
Tags: patch

The shell-scripts contain several XSI:isms.  This is a violation of
policy (10.4).  The included patch fixes these.  It also replaces
egrep with grep -E, since the former is deprecated, and modifies the
two bash-scripts into sh-scripts.


Regards: David Weinehall

diff -ur apt-0.6.25-old/debian/preinst apt-0.6.25/debian/preinst
--- apt-0.6.25-old/debian/preinst	2001-02-21 06:25:20.000000000 +0200
+++ apt-0.6.25/debian/preinst	2004-06-15 19:25:44.000000000 +0300
@@ -1,17 +1,17 @@
 #! /bin/sh
 
 # dpkg does this for us while we are upgrading..
-#if [ "$1" = "upgrade" -a -L /var/state/apt -a -e /var/lib/apt -a ! -L /var/state/apt ] && dpkg --compare-versions "$2" ">=" "0.4.10"; then
+#if [ "$1" = "upgrade" ] && [ -L /var/state/apt ] && [ -e /var/lib/apt ] && [ ! -L /var/state/apt ] && dpkg --compare-versions "$2" ">=" "0.4.10"; then
 #  rm /var/state/apt
 #fi
 
-if [ "$1" = "upgrade" -o "$1" = "install" -a "$2" != "" ]; then
-  if [ ! -e /var/lib/apt -a -e /var/state/apt ]; then
+if ( [ "$1" = "upgrade" ] || [ "$1" = "install" ] ) && [ "$2" != "" ]; then
+  if [ ! -e /var/lib/apt ] && [ -e /var/state/apt ]; then
     # upgrading from /var/state/apt using apt.
     # it's probably running now so we want to ensure /var/state/apt
     # is still valid afterwards. and since we're upgrading
 
-    if [ -x /usr/bin/perl -a -d /var/state/apt -a ! -L /var/state/apt ] &&
+    if [ -x /usr/bin/perl ] && [ -d /var/state/apt ] && [ ! -L /var/state/apt ] &&
       perl -e 'exit 1 if ((stat("/var/lib"))[0] != (stat("/var/state/apt"))[0])'
     then
       # same fs, we can mv it
diff -ur apt-0.6.25-old/debian/prerm apt-0.6.25/debian/prerm
--- apt-0.6.25-old/debian/prerm	2001-02-21 06:25:20.000000000 +0200
+++ apt-0.6.25/debian/prerm	2004-06-21 22:45:47.000000000 +0300
@@ -2,7 +2,7 @@
 
 #DEBHELPER#
 
-if [ "$1" = "upgrade" -o "$1" = "failed-upgrade" ] && 
+if ( [ "$1" = "upgrade" ] || [ "$1" = "failed-upgrade" ] ) && 
    dpkg --compare-versions "$2" "<<" 0.4.10
 then
   if [ ! -d /var/state/apt/ ]; then
diff -ur apt-0.6.25-old/debian/rules apt-0.6.25/debian/rules
--- apt-0.6.25-old/debian/rules	2004-05-09 01:10:10.000000000 +0300
+++ apt-0.6.25/debian/rules	2004-06-21 22:42:39.000000000 +0300
@@ -72,8 +72,8 @@
 #export DH_VERBOSE=1
 
 # Find the libapt-pkg major version for use in other control files
-export LIBAPTPKG_MAJOR:=$(shell egrep '^MAJOR=' apt-pkg/makefile |cut -d '=' -f 2)
-export LIBAPTINST_MAJOR:=$(shell egrep '^MAJOR=' apt-inst/makefile |cut -d '=' -f 2)
+export LIBAPTPKG_MAJOR:=$(shell grep -E '^MAJOR=' apt-pkg/makefile |cut -d '=' -f 2)
+export LIBAPTINST_MAJOR:=$(shell grep -E '^MAJOR=' apt-inst/makefile |cut -d '=' -f 2)
 
 # Determine which package we should provide in the control files
 LIBAPTPKG_PROVIDE=libapt-pkg$(GLIBC_VER)$(LIBSTDCPP_VER)-$(LIBAPTPKG_MAJOR)
Only in apt-0.6.25/dselect: .install.swp
diff -ur apt-0.6.25-old/dselect/install apt-0.6.25/dselect/install
--- apt-0.6.25-old/dselect/install	2002-10-16 08:21:53.000000000 +0300
+++ apt-0.6.25/dselect/install	2004-06-21 23:26:44.000000000 +0300
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 # Set the textdomain for the translations using $"..."
 TEXTDOMAIN="apt"
@@ -24,7 +24,6 @@
 yesno() {
 # $1 = prompt
 # $2 = default(y)
-	local ans def defp
 	if [ "$2" ];then
 		case $2 in
 			Y|y)	defp="[Y/n]" def=y;;
@@ -64,7 +63,7 @@
 # Finished OK
 if [ $RES -eq 0 ]; then
 
-   if [ `ls $ARCHIVES $ARCHIVES/partial | egrep -v "^lock$|^partial$" | wc -l` \
+   if [ `ls $ARCHIVES $ARCHIVES/partial | grep -E -v "^lock$|^partial$" | wc -l` \
         -eq 0 ]; then
       exit 0
    fi
diff -ur apt-0.6.25-old/dselect/update apt-0.6.25/dselect/update
--- apt-0.6.25-old/dselect/update	2002-10-16 08:21:53.000000000 +0300
+++ apt-0.6.25/dselect/update	2004-06-15 19:27:21.000000000 +0300
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 set -e
 
 # Set the textdomain for the translations using $"..."



Reply to: