Commit a928d28
committed
t/lib-httpd: document writing concurrency-safe CGI helpers
The apply-one-time-script.sh and http-429.sh fixes addressed the same
underlying problem: a CGI helper assumed it had exclusive access to a
file when Apache can run it for several requests at once. Document the
atomic idioms that avoid this next to where lib-httpd.sh installs the
CGI scripts, so the guidance is visible to anyone adding another one.
The note covers the anti-pattern (a "test -f" check then a separate
action) and the two safe operations these helpers use: "mkdir" to elect
the first request (http-429.sh) and "rm" without "-f" to consume a
one-shot marker (apply-one-time-script.sh).
Signed-off-by: Michael Montalbo <mmontalbo@gmail.com>1 parent 3c9ff51 commit a928d28
1 file changed
Lines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
162 | 175 | | |
163 | 176 | | |
164 | 177 | | |
| |||
0 commit comments