diff options
author | Michael Haubenwallner <haubi@gentoo.org> | 2016-05-24 12:54:38 +0200 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2017-01-13 16:13:42 -0800 |
commit | 5a53e732efa0ee7e2a3f8afe90d729212ff187fb (patch) | |
tree | 46f1144756ade4be65d2a5e892c19a6bc96789f3 | |
parent | repoman: add HOMEPAGE.missingurischeme check (bug 533554) (diff) | |
download | portage-5a53e732efa0ee7e2a3f8afe90d729212ff187fb.tar.gz portage-5a53e732efa0ee7e2a3f8afe90d729212ff187fb.tar.bz2 portage-5a53e732efa0ee7e2a3f8afe90d729212ff187fb.zip |
__multijob_init: work around Cygwin FIFO shortcoming
Cygwin does not support multiple read-handles for one FIFO (yet).
As we really need just one readonly- and one writeonly-handle, we can
reorder to open one single readwrite- and one writeonly-handle.
X-Gentoo-Bug: 583962
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=583962
-rw-r--r-- | bin/helper-functions.sh | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/bin/helper-functions.sh b/bin/helper-functions.sh index c096aedb6..9b6e201aa 100644 --- a/bin/helper-functions.sh +++ b/bin/helper-functions.sh @@ -20,12 +20,17 @@ makeopts_jobs() { __multijob_init() { # Setup a pipe for children to write their pids to when they finish. # We have to allocate two fd's because POSIX has undefined behavior - # when you open a FIFO for simultaneous read/write. #487056 + # when using one single fd for both read and write. #487056 + # However, opening an fd for read or write only will block until the + # opposite end is opened as well. Thus we open the first fd for both + # read and write to not block ourselve, but use it for reading only. + # The second fd really is opened for write only, as Cygwin supports + # just one single read fd per FIFO. #583962 local pipe=$(mktemp -t multijob.XXXXXX) rm -f "${pipe}" mkfifo -m 600 "${pipe}" - __redirect_alloc_fd mj_write_fd "${pipe}" __redirect_alloc_fd mj_read_fd "${pipe}" + __redirect_alloc_fd mj_write_fd "${pipe}" '>' rm -f "${pipe}" # See how many children we can fork based on the user's settings. |