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

Bug#255577: XSI:isms in several scripts



Package: apt
Version: 0.9.7.4
Followup-For: Bug #255577

Refreshing this patch for current policy and changes in apt.

>From policy section 10.4, scripts may assume that /bin/sh supports:

- test with binary operators -a, -o; and
- local to create scoped variables.

Regarding the use of bash:

- debian/apt.bug-script must as it makes use of yesno [1,2];
- dselect/{install,update} use the $"foo" translation syntax which
  could be made more portable [3] but this is hardly required since
  bash is Priority: required -- switching to /bin/sh and portable
  syntax may provide some speedup, but does anyone use these dpkg
  methods any more?

The other change is to replace direct calls to egrep (deprecated).

[1] /usr/share/doc/reportbug/README.developers.gz
[2] http://bugs.debian.org/313402
[3] http://www.gnu.org/software/gettext/manual/html_node/Preparing-Shell-Scripts.html

--
diff -u a/buildlib/libversion.mak b/buildlib/libversion.mak
--- a/buildlib/libversion.mak	2012-04-24 14:58:13.912120000 +0800
+++ b/buildlib/libversion.mak	2012-09-06 17:54:58.102874814 +0800
@@ -10,5 +10,5 @@
 # Please increase MAJOR with each ABI break,
 # with each non-ABI break to the lib, please increase MINOR.
 # The versionnumber is extracted from apt-inst/makefile - see also there.
-LIBAPTINST_MAJOR=$(shell egrep '^MAJOR=' $(BASE)/apt-inst/makefile |cut -d '=' -f 2)
-LIBAPTINST_MINOR=$(shell egrep '^MINOR=' $(BASE)/apt-inst/makefile |cut -d '=' -f 2)
+LIBAPTINST_MAJOR=$(shell grep -E '^MAJOR=' $(BASE)/apt-inst/makefile |cut -d '=' -f 2)
+LIBAPTINST_MINOR=$(shell grep -E '^MINOR=' $(BASE)/apt-inst/makefile |cut -d '=' -f 2)
diff -u a/dselect/install b/dselect/install
--- a/dselect/install	2012-04-24 14:58:13.912120000 +0800
+++ b/dselect/install	2012-09-06 18:13:17.546426852 +0800
@@ -64,7 +64,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


Reply to: