Commit fe462a2
committed
Align lib/alpine.func with the tools tree, and fix what the comparison found
alpine-parity.yml warns when a pull request changes a shared function on one
side only. It cannot say anything about drift that is already there, and
nobody had looked. Comparing all 22 shared functions turned up six real
divergences, two of them bugs that had nothing to do with Alpine being
different and everything to do with the copy never being reviewed against
the original.
github_api_call was broken twice over:
http_code=$(curl -fsSL -w "%{http_code}" ... || echo 000)
With -f, curl exits non-zero on an HTTP error while -w still prints the
status, so the `|| echo 000` appended to it. http_code came out as "404000",
which matches neither the 404 arm nor the 403 arm -- both were dead code.
Every failure fell through to the catch-all, meaning a 404 was retried three
times, roughly six seconds spent on a URL that was never going to exist, and
then reported as "failed with HTTP 404000".
The second one:
header="-H Authorization:Bearer\ ${GITHUB_TOKEN}" # ... used as $header
Expanded unquoted, that splits into three words: curl received a valueless
Authorization header (which it drops) and the token as a second URL to fetch.
Alpine never authenticated to the GitHub API, however valid the token was --
so it took the anonymous rate limit on every call.
Both are fixed and checked against a local server: 200 returns 0 with the
body written, 404 returns 22 immediately, 403 returns 22 after backoff, each
with its own message.
The rest were contract mismatches rather than broken behaviour:
- get_cached_version returned 0 with no cache file, where the tools tree
returns 1. `if get_cached_version app` was true on Alpine with empty output.
- download_file, extract_version_from_json and get_latest_github_release
returned 1 for everything. The tools tree distinguishes 22 (could not reach
it) from 250 (reached it, no version). Exit codes are what the error handler
and the telemetry read, so every Alpine failure was landing in the same
undifferentiated exit-1 bucket that already dominates the error stats.
- create_temp_dir was a bare mktemp -d with no cleanup, leaking one directory
per call; the tools tree registers them for removal on exit.
- get_os_info had no version_full, so asking for it fell through to the
default arm and returned the OS id instead of a version.
- get_system_arch ignored the dpkg|uname|both argument the other side takes.
Alpine has no dpkg so every mode resolves through uname, but it accepts the
argument now instead of silently dropping it.
Left alone deliberately: version_gt. The two implementations genuinely
disagree -- for "1.2.0-rc1" against "1.2.0" Alpine says false and the tools
tree says true -- and the tools tree is the one that is wrong, since a
release candidate ranks below its release. Its only caller is should_upgrade,
which has no callers at all. Fixing dead code properly means implementing
semver ordering that works under BusyBox, which does not belong in a change
that is already touching eight live functions.1 parent 7968172 commit fe462a2
1 file changed
Lines changed: 91 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
60 | 66 | | |
61 | 67 | | |
62 | 68 | | |
| |||
65 | 71 | | |
66 | 72 | | |
67 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
68 | 85 | | |
69 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
70 | 94 | | |
71 | 95 | | |
72 | 96 | | |
73 | 97 | | |
74 | 98 | | |
75 | 99 | | |
76 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
77 | 104 | | |
78 | 105 | | |
79 | 106 | | |
80 | 107 | | |
| 108 | + | |
81 | 109 | | |
82 | 110 | | |
83 | 111 | | |
| |||
97 | 125 | | |
98 | 126 | | |
99 | 127 | | |
100 | | - | |
101 | | - | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
102 | 131 | | |
103 | | - | |
| 132 | + | |
104 | 133 | | |
105 | 134 | | |
106 | 135 | | |
107 | | - | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
108 | 140 | | |
109 | 141 | | |
110 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
111 | 146 | | |
112 | 147 | | |
113 | 148 | | |
114 | 149 | | |
115 | 150 | | |
116 | | - | |
117 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
118 | 160 | | |
119 | | - | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
120 | 167 | | |
121 | 168 | | |
122 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
123 | 172 | | |
124 | 173 | | |
125 | | - | |
126 | | - | |
127 | | - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
128 | 182 | | |
129 | 183 | | |
130 | 184 | | |
131 | | - | |
| 185 | + | |
132 | 186 | | |
133 | | - | |
| 187 | + | |
134 | 188 | | |
135 | | - | |
| 189 | + | |
136 | 190 | | |
137 | 191 | | |
| 192 | + | |
138 | 193 | | |
139 | 194 | | |
140 | 195 | | |
141 | | - | |
| 196 | + | |
142 | 197 | | |
143 | 198 | | |
144 | 199 | | |
145 | 200 | | |
146 | | - | |
| 201 | + | |
147 | 202 | | |
148 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
149 | 207 | | |
150 | 208 | | |
151 | 209 | | |
152 | 210 | | |
153 | | - | |
154 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
155 | 216 | | |
| 217 | + | |
156 | 218 | | |
157 | | - | |
| 219 | + | |
158 | 220 | | |
159 | | - | |
| 221 | + | |
160 | 222 | | |
161 | 223 | | |
162 | | - | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
163 | 229 | | |
164 | 230 | | |
165 | 231 | | |
| |||
0 commit comments