coreutils-native race
hi all,
I just tracked down a problem in bitbake, oe-stable and parallel builds. My oe-stable is a few days old but I suppose this problem might not be version dependent so let's see if this is known and fixed already.
What happens (once in a while) is that some build process uses commands from coreutils-native while coreutils-native is being staged.
Let's say the command is 'rm' - so coreutils-native stages 'rm' while another build process trys to delete some file. This leads to "rm: text file busy" because rm is still open for writing.
Has anyone seen this? And is there a known fix or workaround?
Thanks
Uli
Signature · 12 lines
------- ROAD ...the handyPC Company - - - ) ) ) Uli Luckas Head of Software Development ROAD GmbH Bennigsenstr. 14 | 12159 Berlin | Germany fon: +49 (30) 230069 - 62 | fax: +49 (30) 230069 - 69 url: www.road.de Amtsgericht Charlottenburg: HRB 96688 B Managing director: Hans-Peter Constien
Quoted 7 lines · Uli Luckas
What happens (once in a while) is that some build process uses commands from coreutils-native while coreutils-native is being staged.
Let's say the command is 'rm' - so coreutils-native stages 'rm' while another build process trys to delete some file. This leads to "rm: text file busy" because rm is still open for writing.Has anyone seen this? And is there a known fix or workaround?
I guess the fix would be to make coreutils-native install its binaries atomically (i.e. install them to ${STAGING_BINDIR}/rm.new and then mv them into place) rather than installing them directly into their final location. Alternatively you could probably patch it to just not install things like rm at all: if your host system doesn't have a functioning "rm" then you're probably hosed anyway.
p.
Quoted 7 lines · Phil Blundell
Quoted 6 lines · Uli Luckas
What happens (once in a while) is that some build process uses commands from coreutils-native while coreutils-native is being staged. Let's say the command is 'rm' - so coreutils-native stages 'rm' while another build process trys to delete some file. This leads to "rm: text file busy" because rm is still open for writing.
Quoted 9 lines
Quoted 1 line
Has anyone seen this? And is there a known fix or workaround?
I guess the fix would be to make coreutils-native install its binaries atomically (i.e. install them to ${STAGING_BINDIR}/rm.new and then mv them into place) rather than installing them directly into their final location. Alternatively you could probably patch it to just not install things like rm at all: if your host system doesn't have a functioning "rm" then you're probably hosed anyway.
Hi Phil,
I went for your first sugestion. Attached is a patch that does atomic installation. The patch is against a snapshot of the stable branch but should not be to hard to forward port to other branches for people who have trees of these other branches available.
regards,
Uli
commit 59171bc7bc35eabab3bd35730f77d194aa802a53
Author: Uli Luckas <[email protected]> Date: Mon Aug 17 15:53:06 2009 +0200
- Fix "text file busy" build bug.
packages/coreutils/coreutils-native.inc new file +24 -0
@@ -0,0 +1,24 @@ +# binaries from coreutils-native are usually provided by the host os and already +# used by parallel build threads before coreutils-native is staged. +# +# The regular autotools_stage_dir installs non atomically and can cause parallel +# build threads to find busy binaries. +# +autotools_stage_dir() { + from="$1" + to="$2" + # This will remove empty directories so we can ignore them + rmdir "$from" 2> /dev/null || true + if [ -d "$from" ]; then + mkdir -p "$to" + (cd "$from"; find . -print ) | while read object; do + if [ -d "$from/$object" ]; then + mkdir -p "$to/$object" + else + tmpname="`mktemp "$to/$object".XXXXXXXX`" + cp -fpP "$from/$object" "$tmpname" + mv "$tmpname" "$to/$object" + fi + done + fi +}
packages/coreutils/coreutils-native_5.3.0.bb +1 -0
@@ -5,3 +5,4 @@ S = "${WORKDIR}/coreutils-${PV}" require coreutils_${PV}.bb inherit native +require coreutils-native.inc
packages/coreutils/coreutils-native_6.0.bb +1 -0
@@ -5,3 +5,4 @@ S = "${WORKDIR}/coreutils-${PV}" require coreutils_${PV}.bb inherit native +require coreutils-native.inc
Signature · 12 lines
------- ROAD ...the handyPC Company - - - ) ) ) Uli Luckas Head of Software Development ROAD GmbH Bennigsenstr. 14 | 12159 Berlin | Germany fon: +49 (30) 230069 - 62 | fax: +49 (30) 230069 - 69 url: www.road.de Amtsgericht Charlottenburg: HRB 96688 B Managing director: Hans-Peter Constien
Hello Uli,
Quoted 5 lines · Uli Luckas
build process trys to delete some file. This leads to "rm: text file busy" because rm is still open for writing.
Has anyone seen this? And is there a known fix or workaround?
Yes I have seen this (every 1 out of 50 builds or so). Thanks for diving into this one.
(Of course, only seen when building from scratch, which I now default to because of these kind of bugs.)
Cheers,
Signature · 1 line
Leon