devtool: Fix the wrong variable in srcuri_entry
devtool crashes when running "update-recipe" and append changes on the recipe. It seems like the wrong variable name cause this problem.
The following changes since commit a776dd26677452154384aca7469c396f1978b1c0:
linux-yocto/6.1: update genericx86* machines to v6.1.30 (2023-06-09 13:55:38 +0100)
are available in the Git repository at:
https://git.yoctoproject.org/poky-contrib chiachiwu/setuid-before-git-op
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=chiachiwu/setuid-before-git-op
Charlie Wu (1):
devtool: Fix the wrong variable in srcuri_entry
scripts/lib/devtool/standard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.41.0.162.gfafddb0af9-goog
PATCH 1/1 devtool: Fix the wrong variable in srcuri_entry
devtool crashes when running "update-recipe" and append changes on the recipe. "$ devtool update-recipe -a <layer> <recipe>"
Traceback (most recent call last):
...
File "/ovss/ovss_quanta/poky/scripts/lib/devtool/standard.py", line 1636, in srcuri_entry
return 'file://%s%s' % (basepath, paramstr)
^^^^^^^^NameError: cannot access free variable 'basepath' where it is not associated with a value in enclosing scope
The input variable 'fname' should have the same meaning as the variable 'basepath'. Modify the 'fname' to 'basepath' and solve the issue.
--- scripts/lib/devtool/standard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/lib/devtool/standard.py +1 -1
@@ -1629,7 +1629,7 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil else: patchdir_params = {'patchdir': relpatchdir} - def srcuri_entry(fname): + def srcuri_entry(basepath): if patchdir_params: paramstr = ';' + ';'.join('%s=%s' % (k,v) for k,v in patchdir_params.items()) else:
Signature · 1 line
2.41.0.162.gfafddb0af9-goog
Thank you, the correct mailing list for this submission is openembedded-core.
Alex
Quoted 43 lines · Charlie Wu via lists.yoctoproject.org
devtool crashes when running "update-recipe" and append changes on the recipe. "$ devtool update-recipe -a <layer> <recipe>"
Traceback (most recent call last):
...
File "/ovss/ovss_quanta/poky/scripts/lib/devtool/standard.py", line 1636, insrcuri_entryreturn 'file://%s%s' % (basepath, paramstr) ^^^^^^^^NameError: cannot access free variable 'basepath' where it is not associated with a value in enclosing scope
The input variable 'fname' should have the same meaning as the variable 'basepath'. Modify the 'fname' to 'basepath' and solve the issue.
Signed-off-by Charlie Wu <[email protected]>--- scripts/lib/devtool/standard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/lib/devtool/standard.py +1
-2@@ -1629,7 +1629,7 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil else: patchdir_params = {'patchdir': relpatchdir} - def srcuri_entry(fname): + def srcuri_entry(basepath): if patchdir_params: paramstr = ';' + ';'.join('%s=%s' % (k,v) for k,v in patchdir_params.items()) else: --2.41.0.162.gfafddb0af9-goog
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13083): https://lists.yoctoproject.org/g/poky/message/13083
Mute This Topic: https://lists.yoctoproject.org/mt/99504639/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/poky/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 22 lines · Charlie Wu via lists.yoctoproject.org
devtool crashes when running "update-recipe" and append changes on the recipe. "$ devtool update-recipe -a <layer> <recipe>"
Traceback (most recent call last):
...
File "/ovss/ovss_quanta/poky/scripts/lib/devtool/standard.py", line 1636, insrcuri_entryreturn 'file://%s%s' % (basepath, paramstr) ^^^^^^^^NameError: cannot access free variable 'basepath' where it is not associated with a value in enclosing scope
The input variable 'fname' should have the same meaning as the variable 'basepath'. Modify the 'fname' to 'basepath' and solve the issue.
Signed-off-by Charlie Wu <[email protected]>--- scripts/lib/devtool/standard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/lib/devtool/standard.py +0
-0
scripts/lib/devtool/standard.py def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil · line 1635
Quoted 8 lines
scripts/lib/devtool/standard.py +1
-1@@ -1629,7 +1629,7 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil else: patchdir_params = {'patchdir': relpatchdir} - def srcuri_entry(fname): + def srcuri_entry(basepath): if patchdir_params: paramstr = ';' + ';'.join('%s=%s' % (k,v) for k,v in patchdir_params.items()) else:
Thanks for the patch. As Alex mentions, this needs to go to the OE-Core mailing list. I also wondered if we're missing a test case since the selftests should catch issues like this?
Could you see if there is something we should add to "oe-selftest -r devtool" to catch this issue?
Thanks,
Richard
Hi Richard,
I set up the environment to run "oe-selftest -r devtool" and all test cases are passed.
I revisited our use case and checked the code again, I think this might be related to kmeta
<https://docs.yoctoproject.org/4.0.10/kernel-dev/advanced.html?highlight=kmeta#recipe-space-metadata>
.
Since kmeta is using the folder name, thus the function "_remove_file_entries" will not remove the .scc and .cfg files here
<https://github.com/openembedded/openembedded-core/blob/master/scripts/lib/devtool/standard.py#L1685>
and
put them into the "remaining" list.
And we call the problematic function "srcuri_entry" when the "remaining" list is not empty.
I think we do not have recipes using kmeta inside openembedded-core, which makes it hard to add another unit test for this.
Or we have other ways to make the "remaining" list not empty, but I do not know how.
I will check the guide
<https://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded> and change to upload the patch to openembedded-core these days.
Thanks,
Charlie
Quoted 51 lines · Richard Purdie
Quoted 1 line · Charlie Wu via lists.yoctoproject.org
devtool crashes when running "update-recipe" and append changes on the
recipe.
Quoted 4 lines
"$ devtool update-recipe -a <layer> <recipe>"
Traceback (most recent call last):
...
File "/ovss/ovss_quanta/poky/scripts/lib/devtool/standard.py", line1636, in
srcuri_entryQuoted 3 lines
return 'file://%s%s' % (basepath, paramstr) ^^^^^^^^NameError: cannot access free variable 'basepath' where it is not
associated with a value in enclosing scope
Quoted 2 lines
The input variable 'fname' should have the same meaning as the variable
'basepath'.
Review
Quoted 8 lines
Modify the 'fname' to 'basepath' and solve the issue.
Signed-off-by Charlie Wu <[email protected]>--- scripts/lib/devtool/standard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/scripts/lib/devtool/standard.pyscripts/lib/devtool/standard.py def _update_recipe_patch(recipename, workspace,
Quoted 4 lines
index
852672810a..86ca77f718100644scripts/lib/devtool/standard.py +0
-0@@ -1629,7 +1629,7 @@ def _update_recipe_patch(recipename, workspace,srctree, rd, appendlayerdir, wil
scripts/lib/devtool/standard.py def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil
Quoted 7 lines
scripts/lib/devtool/standard.py +1
-1else: patchdir_params = {'patchdir': relpatchdir} - def srcuri_entry(fname): + def srcuri_entry(basepath): if patchdir_params: paramstr = ';' + ';'.join('%s=%s' % (k,v) for k,v in
patchdir_params.items())scripts/lib/devtool/standard.py def _update_recipe_patch(recipename, workspace, · line 1635
Quoted 1 line
scripts/lib/devtool/standard.py +0
-0else:Thanks for the patch. As Alex mentions, this needs to go to the OE-Core mailing list. I also wondered if we're missing a test case since the selftests should catch issues like this?
Could you see if there is something we should add to "oe-selftest -r devtool" to catch this issue?
Thanks,
Richard