Commit 56b62f3
committed
Fix nxf_date for uutils coreutils (Ubuntu 26.04+)
uutils coreutils ignores the %3N field-width modifier on `date` and strips
leading zeros from %N, so `date +%s%3N` returns a variable-length string
(11-19 digits) that no length branch in nxf_date matches. The function
falls through to `exit 1`, which is swallowed by the `local var=$(...)`
wrapper at the call site, leaving the caller with the literal error
string. The next arithmetic expression then triggers
"bash: line 178: Unexpected: unbound variable" under set -u and kills
the task.
Replace the length-dispatch implementation with a version that calls
`date +%s` and `date +%N` separately, re-pads %N to 9 digits to recover
any zeros uutils stripped, and computes milliseconds from the first
three nanosecond digits. Falls back to second precision when %N is
non-numeric (BSD/macOS), preserving existing behaviour on those
platforms.
Verified against both `ubuntu:latest` (uutils coreutils 0.8.0) and
`ubuntu:24.04` (GNU coreutils 9.4): both produce 13-digit values with
plausible non-negative wall-time deltas.
Fixes #7114
Signed-off-by: Rob Syme <rob.syme@gmail.com>1 parent f540396 commit 56b62f3
3 files changed
Lines changed: 26 additions & 21 deletions
File tree
- modules/nextflow/src
- main/resources/nextflow/executor
- test/resources/nextflow/executor
Lines changed: 10 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
Lines changed: 8 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
216 | 218 | | |
217 | 219 | | |
218 | 220 | | |
| |||
Lines changed: 8 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
0 commit comments