Summary: | dev-libs/openssl: openssl-1.0.2d-parallel.patch has race condition | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | ryan.barnett |
Component: | New packages | Assignee: | Gentoo's Team for Core System packages <base-system> |
Status: | RESOLVED INVALID | ||
Severity: | normal | ||
Priority: | Normal | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: | Patch to fix race condition |
Description
ryan.barnett
2015-11-19 19:28:25 UTC
The error originally see during a failure is either: ln: failed to create symbolic link 'libssl.so': File exists ln: creating symbolic link `libcrypto.so': File exists And to update patch originally attached is to remove the 'rm -f' before the symbolic links: diff --git a/dev-libs/openssl/files/openssl-1.0.2d-parallel-build.patch b/dev-libs/openssl/files/openssl-1.0.2d-parallel-build.patch index b7aa0ea..9b74380 100644 --- a/dev-libs/openssl/files/openssl-1.0.2d-parallel-build.patch +++ b/dev-libs/openssl/files/openssl-1.0.2d-parallel-build.patch @@ -118,14 +118,26 @@ https://rt.openssl.org/Ticket/Display.html?id=3738&user=guest&pass=guest LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \ $${SHAREDCMD} $${SHAREDFLAGS} \ -o $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX \ -@@ -122,6 +123,7 @@ +@@ -117,15 +117,15 @@ SYMLINK_SO= \ + prev=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \ + if [ -n "$$SHLIB_COMPAT" ]; then \ + for x in $$SHLIB_COMPAT; do \ +- ( $(SET_X); rm -f $$SHLIB$$x$$SHLIB_SUFFIX; \ +- ln -s $$prev $$SHLIB$$x$$SHLIB_SUFFIX ); \ ++ ( $(SET_X); \ ++ ln -sf $$prev $$SHLIB$$x$$SHLIB_SUFFIX ); \ + prev=$$SHLIB$$x$$SHLIB_SUFFIX; \ done; \ fi; \ if [ -n "$$SHLIB_SOVER" ]; then \ -+ [ -e "$$SHLIB$$SHLIB_SUFFIX" ] || \ - ( $(SET_X); rm -f $$SHLIB$$SHLIB_SUFFIX; \ - ln -s $$prev $$SHLIB$$SHLIB_SUFFIX ); \ + [ -e "$$SHLIB$$SHLIB_SUFFIX" ] || \ +- ( $(SET_X); rm -f $$SHLIB$$SHLIB_SUFFIX; \ +- ln -s $$prev $$SHLIB$$SHLIB_SUFFIX ); \ ++ ( $(SET_X); \ ++ ln -sf $$prev $$SHLIB$$SHLIB_SUFFIX ); \ fi; \ + fi + `ln -sf` is no more atomic than `rm; ln`. there is still a window where things can fail. you can easily check this: i=0; while [ $((i++)) -lt 500 ]; do ln -sf a b & :; done a good number of those will fail with: ln: failed to create symbolic link ‘b’: File exists the deps need to be fixed up You are indeed correct, thank you for pointing this out and giving this good example. So I guess my patch is invalid but the bug is still valid. seems to me the buildroot guys didn't pick up all the Gentoo patches. the 1.0.2d ebuild applies more than just openssl-1.0.2d-parallel.patch. in fact, the race you refer to is most likely fixed by openssl-1.0.2a-parallel-symlinking.patch. |