[Pkg-varnish-devel] Bug#664857: varnish: reload-vcl exits with code 0 if vcl.load or vcl.use fails

Knut Arne Bjørndal knut.arne.bjorndal at easyconnect.no
Wed Mar 21 12:44:29 UTC 2012


Package: varnish
Version: 2.1.3-8
Severity: normal
Tags: patch

If the VCL has errors the reload-vcl script exits successfully anyway. I've
tested with both 2.1 from squeeze and 3.0.2, with both bash and dash.

The problem seems to be that the exitstatus variable disappears after the if
$varnishadm ... vcl.load block. I suspect this is due to the redirect through
grep that causes the block to run in a subshell.

I'm attaching a patch that moves this grep to the place where the logfile is
output instead, which avoids the subshell.



-- System Information:
Debian Release: 6.0.4
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

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

Versions of packages varnish depends on:
ii  adduser                   3.112+nmu2     add and remove users and groups
ii  gcc                       4:4.4.5-1      The GNU C compiler
ii  libc6                     2.11.3-2       Embedded GNU C Library: Shared lib
ii  libc6-dev [libc-dev]      2.11.3-2       Embedded GNU C Library: Developmen
ii  libncurses5               5.7+20100313-5 shared libraries for terminal hand
ii  libvarnish1               2.1.3-8        shared libraries for Varnish

varnish recommends no packages.

varnish suggests no packages.

-- no debconf information
-------------- next part --------------
--- debian/reload-vcl.orig	2012-03-21 13:36:32.174223469 +0100
+++ debian/reload-vcl	2012-03-21 13:37:09.669963485 +0100
@@ -160,12 +160,12 @@
 else
     printf "$msg_compile_failed" $vcl_label $vcl_file
     exitstatus=1
-fi | grep -v "^$" > $logfile
+fi > $logfile
 
 # Blather
 if [ -z "${quiet}" -o -n "$exitstatus" ]
 then
-    cat >&2 $logfile
+    grep -v '^$' >&2 $logfile
 fi
 
 # Cleanup


More information about the Pkg-varnish-devel mailing list