[pmg-devel] applied: [PATCH] d/postinst: avoid processing non existent '*' templates due to glob

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Jun 3 19:39:37 CEST 2020


if there's no file at all in that path the wildcard glob won't expand
and POSIX shell will use '*' as filename, which will then fail.

Avoid that.

Reported-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 debian/postinst | 1 +
 1 file changed, 1 insertion(+)

diff --git a/debian/postinst b/debian/postinst
index d3b17cf..bde65bb 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -5,6 +5,7 @@ set -e
 
 ucf_register_templates() {
     for template in /etc/pmg/templates/*; do
+	[ -e "$template" ] || continue;
 	template_base=$(basename "${template}")
 	if echo "${template_base}" | grep -q '\.ucf-'; then
 		continue
-- 
2.20.1




More information about the pmg-devel mailing list