OILS / regtest / patches / shorewall6 / shorewall-assoc-quote.patch View on Github | oils.pub

148 lines, 132 significant
1From 39d124cf439a25bf28d58a39e9ff95d5059349be Mon Sep 17 00:00:00 2001
2From: Andrii Sultanov <sultanovandriy@gmail.com>
3Date: Wed, 22 Oct 2025 20:20:52 +0100
4Subject: [PATCH] configure: Quote assoc array keys as strings
5
6This prevents the following error in osh:
7
8 >>> shorewall6: Unpacking /var/cache/distfiles/shorewall6-5.2.8.tar.bz2...
9 vendor=${params[HOST]}
10 ^~~~
11 ./configure:96: fatal: Assoc array keys must be strings: $x 'x' "$x" etc. (OILS-ERR-101)
12
13For more details, see the following:
14
15https://github.com/oils-for-unix/oils/issues/2438
16
17https://www.oilshell.org/blog/2016/10/20.html
18
19Signed-off-by: Andrii Sultanov <sultanovandriy@gmail.com>
20---
21 Shorewall-core/configure | 50 ++++++++++++++++++++--------------------
22 1 file changed, 25 insertions(+), 25 deletions(-)
23
24diff --git a/Shorewall-core/configure b/Shorewall-core/configure
25index 741f74475..09b8f2bb7 100755
26--- a/configure
27+++ b/configure
28@@ -93,7 +93,7 @@ done
29
30 cd $(dirname $0)
31
32-vendor=${params[HOST]}
33+vendor=${params['HOST']}
34
35 if [ -z "$vendor" ]; then
36 if [ -f /etc/os-release ]; then
37@@ -117,48 +117,48 @@ if [ -z "$vendor" ]; then
38 ;;
39 esac
40
41- params[HOST]="$vendor"
42+ params['HOST']="$vendor"
43 fi
44 fi
45
46 if [ -z "$vendor" ]; then
47 case `uname` in
48 Darwin)
49- params[HOST]=apple
50+ params['HOST']=apple
51 rcfile=shorewallrc.apple
52 ;;
53 cygwin*|CYGWIN*)
54- params[HOST]=cygwin
55+ params['HOST']=cygwin
56 rcfile=shorewallrc.cygwin
57 ;;
58 *)
59 if [ -f /etc/debian_version ]; then
60- params[HOST]=debian
61+ params['HOST']=debian
62 ls -l /sbin/init | fgrep -q systemd && rcfile=shorewallrc.debian.systemd || rcfile=shorewallrc.debian.sysvinit
63 elif [ -f /etc/altlinux-release ] ; then
64- params[HOST]=alt
65+ params['HOST']=alt
66 elif [ -f /etc/redhat-release ]; then
67- params[HOST]=redhat
68+ params['HOST']=redhat
69 rcfile=shorewallrc.redhat
70 elif [ -f /etc/slackware-version ] ; then
71- params[HOST]=slackware
72+ params['HOST']=slackware
73 rcfile=shorewallrc.slackware
74 elif [ -f /etc/SuSE-release ]; then
75- params[HOST]=suse
76+ params['HOST']=suse
77 rcfile=shorewallrc.suse
78 elif [ -f /etc/arch-release ] ; then
79- params[HOST]=archlinux
80+ params['HOST']=archlinux
81 rcfile=shorewallrc.archlinux
82 elif [ -f /etc/openwrt_release ]; then
83- params[HOST]=openwrt
84+ params['HOST']=openwrt
85 rcfile=shorewallrc.openwrt
86 else
87- params[HOST]=linux
88+ params['HOST']=linux
89 rcfile=shorewallrc.default
90 fi
91 ;;
92 esac
93- vendor=${params[HOST]}
94+ vendor=${params['HOST']}
95 else
96 if [ $vendor = linux ]; then
97 rcfile=shorewallrc.default;
98@@ -172,10 +172,10 @@ else
99 echo "ERROR: $vendor is not a recognized host type" >&2
100 exit 1
101 elif [ $vendor = default ]; then
102- params[HOST]=linux
103+ params['HOST']=linux
104 vendor=linux
105 elif [[ $vendor == debian.* ]]; then
106- params[HOST]=debian
107+ params['HOST']=debian
108 vendor=debian
109 fi
110 fi
111@@ -183,7 +183,7 @@ fi
112 if [ $vendor = linux ]; then
113 echo "INFO: Creating a generic Linux installation - " `date`;
114 else
115- echo "INFO: Creating a ${params[HOST]}-specific installation - " `date`;
116+ echo "INFO: Creating a ${params['HOST']}-specific installation - " `date`;
117 fi
118
119 echo
120@@ -204,19 +204,19 @@ if [ $# -gt 0 ]; then
121 echo '#' >> shorewallrc
122 fi
123
124-if [ -n "${options[VARLIB]}" ]; then
125- if [ -z "${options[VARDIR]}" ]; then
126- options[VARDIR]='${VARLIB}/${PRODUCT}'
127+if [ -n "${options['VARLIB']}" ]; then
128+ if [ -z "${options['VARDIR']}" ]; then
129+ options['VARDIR']='${VARLIB}/${PRODUCT}'
130 fi
131-elif [ -n "${options[VARDIR]}" ]; then
132- if [ -z "{$options[VARLIB]}" ]; then
133- options[VARLIB]=${options[VARDIR]}
134- options[VARDIR]='${VARLIB}/${PRODUCT}'
135+elif [ -n "${options['VARDIR']}" ]; then
136+ if [ -z "{$options['VARLIB']}" ]; then
137+ options['VARLIB']=${options['VARDIR']}
138+ options['VARDIR']='${VARLIB}/${PRODUCT}'
139 fi
140 fi
141
142-if [ -z "${options[SERVICEDIR]}" ]; then
143- options[SERVICEDIR]="${options[SYSTEMD]}"
144+if [ -z "${options['SERVICEDIR']}" ]; then
145+ options['SERVICEDIR']="${options['SYSTEMD']}"
146 fi
147
148 for on in \