Commit e3aec53
committed
tests: keep the diagram guard's scratch files in a private directory
check-diagram-data passed findings from two subshells back to itself
through /tmp/.kd.$$ and /tmp/.vs.$$ — predictable names in the shared
temporary directory, created by plain redirection and then read back.
Another user could pre-create either path as a symlink and have the
guard write through it, and control what it read afterwards; the
following `rm -f` unlinks the symlink and leaves the write in place.
Allocate one mktemp -d and put both files inside it: the directory is
private, so names derived within it need no guarantee of their own.
A trap removes the directory on EXIT, INT, TERM and HUP, so the files no
longer survive an early exit either, and the explicit rm calls are gone.
The comment now records why the files exist at all — a `while` loop on
the right of a pipe runs in a subshell, and cannot set `fail` in the
shell that reports it.1 parent 6e30a6b commit e3aec53
1 file changed
Lines changed: 18 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
48 | 62 | | |
49 | 63 | | |
50 | 64 | | |
| |||
133 | 147 | | |
134 | 148 | | |
135 | 149 | | |
136 | | - | |
| 150 | + | |
137 | 151 | | |
138 | 152 | | |
139 | 153 | | |
140 | 154 | | |
141 | 155 | | |
142 | | - | |
143 | | - | |
| 156 | + | |
144 | 157 | | |
145 | 158 | | |
146 | 159 | | |
147 | 160 | | |
148 | 161 | | |
149 | 162 | | |
150 | | - | |
| 163 | + | |
151 | 164 | | |
152 | 165 | | |
153 | 166 | | |
| |||
158 | 171 | | |
159 | 172 | | |
160 | 173 | | |
161 | | - | |
162 | | - | |
| 174 | + | |
163 | 175 | | |
164 | 176 | | |
165 | 177 | | |
| |||
0 commit comments