varnishcache / pkg-varnish-cache

Package building scripts for official Debian and Redhat packages of Varnish Cache.
22 stars 32 forks source link

[varnishreload] VCL_PREFIX is unbound #177

Closed gquintard closed 43 minutes ago

gquintard commented 2 hours ago

varnishreload -h calls usage() before VCL_PREFIX=${VCL_PREFIX:-reload} so we have an empty variable on our hand:

$ varnishreload -h
/usr/bin/varnishreload: line 105: VCL_PREFIX: unbound variable
Usage: /usr/bin/varnishreload [-l <label>] [-m <max>] [-n <workdir>]
           [-p <prefix>] [-w <warmup>] [<file>]
       /usr/bin/varnishreload -h

Reload and use a VCL on a running Varnish instance.

Available options:
-h           : show this help and exit
-l <label>   : name of the VCL label to reload
-m <max>     : maximum number of available reloads to leave behind
-n <workdir> : specify the name or directory for the varnishd instance
-p <prefix>  : prefix for the name of the loaded and discarded VCLs
-w <warmup>  : the number of seconds between load and use operations

When <label> is empty or missing, the active VCL is reloaded. If the
reloaded VCL is a label, the underlying VCL program is reloaded, and
the label is updated to reference the new program.

When <prefix> is empty or missing, the names of the loaded and later
discarded VCLs will start with 'reload'.

When <file> is empty or missing, the selected VCL's file is used but
reload will fail if it wasn't loaded from a file. The <file>, when
specified, is passed as-is to the vcl.load command. Refer to the
varnishd manual regarding the handling of absolute or relative paths.

Upon success, the name of the loaded VCL is constructed from the
prefix, current date and time, like for example:

Afterwards available VCLs created by this script are discarded until
<max> are left, unless it was empty or undefined. VCLs referenced by
a label aren't discarded.

The obvious and naive fix is to add VCL_PREFIX=${VCL_PREFIX:-reload} before the option parsing, but you still need it after it too, or you need to error out if -p ""

gquintard commented 2 hours ago

@dridi , I can't assign you, but I can tag you :-)

dridi commented 1 hour ago

Where is this happening? Not on the master branch.

gquintard commented 1 hour ago

Well, on Arch of course! I'll check the packaging info, see if they are lagging behind

gquintard commented 43 minutes ago

they are. Closing