Message ID | 20220201134125.24853-1-Cedric_Hombourger@mentor.com |
---|---|
State | Superseded, archived |
Headers | show |
Series | dpkg-base: cope with race around check/creation of .git-downloads symlink | expand |
On 01.02.22 14:41, Cedric Hombourger wrote: > There is a race condition between the check for the .git-downloads symbolic > link existing and its creation. Ignore the FileExistsError exception when > hitting this race. > > Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com> > --- > meta/classes/dpkg-base.bbclass | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass > index 2add0b2..3aa52b1 100644 > --- a/meta/classes/dpkg-base.bbclass > +++ b/meta/classes/dpkg-base.bbclass > @@ -23,7 +23,10 @@ python do_adjust_git() { > git_dl = os.path.join(d.getVar("DL_DIR"), "git") > > if not os.path.exists(git_link) or os.path.realpath(git_link) != git_dl: > - os.symlink(git_dl, git_link) > + try: > + os.symlink(git_dl, git_link) > + except FileExistsError: > + pass > > for src_uri in (d.getVar("SRC_URI", True) or "").split(): > try: do_adjust_git is run under global ${DL_DIR}/git/isar.lock - how do you trigger this race then? Jan
On Wed, 2022-02-02 at 08:05 +0100, Jan Kiszka wrote: > On 01.02.22 14:41, Cedric Hombourger wrote: > > There is a race condition between the check for the .git-downloads > > symbolic > > link existing and its creation. Ignore the FileExistsError > > exception when > > hitting this race. > > > > Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com> > > --- > > meta/classes/dpkg-base.bbclass | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg- > > base.bbclass > > index 2add0b2..3aa52b1 100644 > > --- a/meta/classes/dpkg-base.bbclass > > +++ b/meta/classes/dpkg-base.bbclass > > @@ -23,7 +23,10 @@ python do_adjust_git() { > > git_dl = os.path.join(d.getVar("DL_DIR"), "git") > > > > if not os.path.exists(git_link) or os.path.realpath(git_link) > > != git_dl: > > - os.symlink(git_dl, git_link) > > + try: > > + os.symlink(git_dl, git_link) > > + except FileExistsError: > > + pass > > > > for src_uri in (d.getVar("SRC_URI", True) or "").split(): > > try: > > do_adjust_git is run under global ${DL_DIR}/git/isar.lock - how do > you > trigger this race then? good catch. I had not noticed this lock. I have been getting this exception while building on a machine with many CPUs (32 IIRC). I have no idea how this could happen with this lock held. Going to debug further. Thanks for the pointer > > Jan >
diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass index 2add0b2..3aa52b1 100644 --- a/meta/classes/dpkg-base.bbclass +++ b/meta/classes/dpkg-base.bbclass @@ -23,7 +23,10 @@ python do_adjust_git() { git_dl = os.path.join(d.getVar("DL_DIR"), "git") if not os.path.exists(git_link) or os.path.realpath(git_link) != git_dl: - os.symlink(git_dl, git_link) + try: + os.symlink(git_dl, git_link) + except FileExistsError: + pass for src_uri in (d.getVar("SRC_URI", True) or "").split(): try:
There is a race condition between the check for the .git-downloads symbolic link existing and its creation. Ignore the FileExistsError exception when hitting this race. Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com> --- meta/classes/dpkg-base.bbclass | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)