[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
avoid mktemp/mkstemp internally
From: |
Mike Frysinger |
Subject: |
avoid mktemp/mkstemp internally |
Date: |
Fri, 13 May 2016 14:40:07 -0400 |
i was pointed at a bug report for FreeBSD systems [1] where running lots
of processes in parallel would randomly fail with errors like:
cannot make pipe for process substitution: File exists
upstream FreeBSD addressed this by defining USE_MKTEMP [2] & USE_MKSTEMP
[3] when building bash. looking at the source in bash though, i can't
see why these aren't always defined. why does bash try to reimplement
both funcs ad-hoc instead of just using the stable/guaranteed system
versions ?
the bash versions seem like it's pretty trivial to collide: it mixes
current seconds count, current pid number, and a counter. when you
factor in modern tech like linux pid namespaces, it's trivial to get
a situation where the pid/time are the same values.
-mike
[1] https://bugs.gentoo.org/574426
[2] https://svnweb.freebsd.org/ports?view=revision&revision=391614
[3] https://svnweb.freebsd.org/ports?view=revision&revision=391692
signature.asc
Description: Digital signature
- avoid mktemp/mkstemp internally,
Mike Frysinger <=