Bug#539366: cron.daily/apt: $VERBOSE accessed before sanitised: [: 324:, Illegal number

2009-08-06 Thread Jean-Jacques Doti

Hi,

From manual page, it seems the right way to use apt-config should be :

# Set VERBOSE mode from  apt-config (or inherit from environment)
VERBOSE=0
eval $(apt-config shell VERBOSE APT::Periodic::Verbose)

instead of

# Set VERBOSE mode from  apt-config (or inherit from environment)
eval $(apt-config shell VERBOSE APT::Periodic::Verbose)
debug_echo verbose level $VERBOSE
if [ -z $VERBOSE ]; then
   VERBOSE=0
fi


I think this solves the problem with script execution.

Regards,
Jean-Jacques




--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#539366: cron.daily/apt: $VERBOSE accessed before sanitised: [: 324: Illegal number

2009-08-04 Thread martin f krafft
tags 539366 patch
thanks

Found this existing bug report last minute, so here's what I almost
submitted as new:

/etc/cron.daily/apt uses the following logic at line 324:

  eval $(apt-config shell VERBOSE APT::Periodic::Verbose)
  debug_echo verbose level $VERBOSE
  if [ -z $VERBOSE ]; then
  VERBOSE=0
  fi

Since debug_echo numerically compares $VERBOSE, this results in

  + apt-config shell VERBOSE APT::Periodic::Verbose
  + eval
  + debug_echo verbose level 
  + [  -ge 1 ]
  [: 1: Illegal number: 

and the following message mailed by cron:

  [: 324: Illegal number: 

The patch could be to set $VERBOSE if unset while passing it to
debug_echo:

--- /tmp/apt2009-08-05 07:37:48.441667500 +0200
+++ /etc/cron.daily/apt 2009-08-05 07:37:08.956785843 +0200
@@ -322,10 +322,7 @@
 set -x
 # Set VERBOSE mode from  apt-config (or inherit from environment)
 eval $(apt-config shell VERBOSE APT::Periodic::Verbose)
-debug_echo verbose level $VERBOSE
-if [ -z $VERBOSE ]; then
-VERBOSE=0
-fi
+debug_echo verbose level ${VERBOSE:=0}
 if [ $VERBOSE -le 2 ]; then
 # quiet for 0,1,2
 XSTDOUT=/dev/null



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

Kernel: Linux 2.6.31-rc3-amd64 (SMP w/1 CPU core)
Locale: LANG=en_GB, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages apt depends on:
ii  debian-archive-keyring2009.01.31 GnuPG archive keys of the Debian a
ii  libc6 2.9-23 GNU C Library: Shared libraries
ii  libgcc1   1:4.4.1-1  GCC support library
ii  libstdc++64.4.1-1The GNU Standard C++ Library v3

apt recommends no packages.

Versions of packages apt suggests:
pn  apt-doc   none (no description available)
ii  aptitude  0.4.11.11-1+b1 terminal-based package manager
ii  bzip2 1.0.5-3high-quality block-sorting file co
ii  dpkg-dev  1.15.3.1   Debian package development tools
ii  lzma  4.43-14Compression method of 7z format in
ii  python-apt0.7.10.4   Python interface to libapt-pkg

-- debconf-show failed


-- 
 .''`.   martin f. krafft madd...@d.o  Related projects:
: :'  :  proud Debian developer   http://debiansystem.info
`. `'`   http://people.debian.org/~madduckhttp://vcs-pkg.org
  `-  Debian - when you have better things to do than fixing systems


digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/)