Bug 11593

Summary: bb.fetch2.get_srcrev ExpansionError with ;subdir=${S} SRC_URIs
Product: [Build System, Metadata & Runtime] BitBake Reporter: Mikko Ylinen <mikko.ylinen>
Component: bitbakeAssignee: Richard Purdie <richard.purdie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: freebendy, poky.bs.watcher, poky.watcher, randy.macleod
Version: unspecified   
Target Milestone: 4.99   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Mikko Ylinen 2017-05-31 05:45:26 UTC
When adding ${SRCPV} to PV with SRC_URIs that use "subdir=${S}", bitbake errors with ExpansionError:

bb.data_smart.ExpansionError: Failure expanding variable SRCPV, expression was ${@bb.fetch2.get_srcrev(d)} which triggered exception RuntimeError: maximum recursion depth exceeded
Comment 1 Richard Purdie 2017-06-09 16:58:10 UTC
Adding ;subdir=${S} to psplash_git.bb is enough to reproduce this. The issue is that:

SRC_URI = "${S}"
S = "${WORKDIR}"
WORKDIR = "xxx/${PV}"
PV = "${SRCPV}"
SRCPV = "${@bb.fetch2.get_srcrev(d)}"

and get_srcrev(d) will expand SRC_URI.

So the code is correct, recursion is occurring and there are circular references.
Comment 2 Ben Guan 2017-08-18 01:59:47 UTC
(In reply to comment #1)
> Adding ;subdir=${S} to psplash_git.bb is enough to reproduce this. The issue
> is that:
> 
> SRC_URI = "${S}"
> S = "${WORKDIR}"
> WORKDIR = "xxx/${PV}"
> PV = "${SRCPV}"
> SRCPV = "${@bb.fetch2.get_srcrev(d)}"
> 
> and get_srcrev(d) will expand SRC_URI.
> 
> So the code is correct, recursion is occurring and there are circular
> references.

It could be reproduced also when using "destsuffix".
Comment 3 Richard Purdie 2021-09-10 14:09:02 UTC
Patches sent to make recursion errors more understandable and detect the fetcher special case variable self references.