0001-fix-avoid-race-condition-between-test-and-mkdir.patch 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. From 4dfca036c96071bd2a2c80ff84719c6d37858373 Mon Sep 17 00:00:00 2001
  2. From: Haseeb Ashraf <Haseeb_Ashraf@mentor.com>
  3. Date: Fri, 17 Apr 2020 14:36:50 +0500
  4. Subject: [PATCH 1/1] fix: avoid race condition between test and mkdir
  5. when building in parallel the race condition, when the directory
  6. is tested for existence and it is created, can break the build
  7. Signed-off-by: Haseeb Ashraf <Haseeb_Ashraf@mentor.com>
  8. ---
  9. Makefile.in | 6 +++---
  10. build-aux/rockspecs.mk | 2 +-
  11. local.mk | 2 +-
  12. 3 files changed, 5 insertions(+), 5 deletions(-)
  13. diff --git a/Makefile.in b/Makefile.in
  14. index 9b51ef3..4722525 100644
  15. --- a/Makefile.in
  16. +++ b/Makefile.in
  17. @@ -1637,7 +1637,7 @@ distclean-tags:
  18. distdir: $(DISTFILES)
  19. $(am__remove_distdir)
  20. - test -d "$(distdir)" || mkdir "$(distdir)"
  21. + $(MKDIR_P) "$(distdir)"
  22. @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
  23. topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
  24. list='$(DISTFILES)'; \
  25. @@ -1975,7 +1975,7 @@ clean-local:
  26. rm -f $(posix_submodules)
  27. $(allhtml): $(EXTRA_ext_posix_posix_la_SOURCES) $(ext_posix_posix_la_SOURCES)
  28. - test -d $(builddir)/doc || mkdir $(builddir)/doc
  29. + $(MKDIR_P) $(builddir)/doc
  30. @HAVE_LDOC_TRUE@ $(LDOC) -c build-aux/config.ld -d $(abs_srcdir)/doc .
  31. @HAVE_LDOC_FALSE@ $(MKDIR_P) doc
  32. @HAVE_LDOC_FALSE@ touch doc/index.html doc/ldoc.css
  33. @@ -1983,7 +1983,7 @@ $(allhtml): $(EXTRA_ext_posix_posix_la_SOURCES) $(ext_posix_posix_la_SOURCES)
  34. doc: $(allhtml)
  35. $(luarocks_config): Makefile.am
  36. - @test -d build-aux || mkdir build-aux
  37. + @$(MKDIR_P) build-aux
  38. $(AM_V_GEN){ \
  39. $(set_LUA_BINDIR); \
  40. echo 'rocks_trees = { "$(abs_srcdir)/luarocks" }'; \
  41. diff --git a/build-aux/rockspecs.mk b/build-aux/rockspecs.mk
  42. index ebd1dbf..c8fbdbc 100644
  43. --- a/build-aux/rockspecs.mk
  44. +++ b/build-aux/rockspecs.mk
  45. @@ -62,7 +62,7 @@ LUA_INCDIR = `cd $$LUA_BINDIR/../include && pwd`
  46. LUA_LIBDIR = `cd $$LUA_BINDIR/../lib && pwd`
  47. $(luarocks_config): Makefile.am
  48. - @test -d build-aux || mkdir build-aux
  49. + @$(MKDIR_P) build-aux
  50. $(AM_V_GEN){ \
  51. $(set_LUA_BINDIR); \
  52. echo 'rocks_trees = { "$(abs_srcdir)/luarocks" }'; \
  53. diff --git a/local.mk b/local.mk
  54. index d391ef7..80b22ce 100644
  55. --- a/local.mk
  56. +++ b/local.mk
  57. @@ -255,7 +255,7 @@ dist_examples_DATA += \
  58. allhtml = $(dist_doc_DATA) $(dist_examples_DATA) $(dist_modules_DATA) $(dist_classes_DATA)
  59. $(allhtml): $(EXTRA_ext_posix_posix_la_SOURCES) $(ext_posix_posix_la_SOURCES)
  60. - test -d $(builddir)/doc || mkdir $(builddir)/doc
  61. + $(MKDIR_P) $(builddir)/doc
  62. if HAVE_LDOC
  63. $(LDOC) -c build-aux/config.ld -d $(abs_srcdir)/doc .
  64. else
  65. --
  66. 2.17.1