Makefile: fix two bugs in list-defconfig wrt br2-externals (branch yem/list-defconfigs)
cover Makefile: fix two bugs in list-defconfig wrt br2-externals (branch yem/list-defconfigs)
Hello All!
This two-patch series fixes two bugs in list-defconfig related to br2-external trees:
- a long-standing bug when a br2-external tree contains single quotes
in the description;
- a cosmetic issue for br2-external trees without defconfig files.
The first is a blocker; the second is just cosmetics, but pretty annoying nonetheless.
Regards,
Yann E. MORIN.
----------------------------------------------------------------
Yann E. MORIN (2):
Makefile: fix list-defconfigs for br2-external with weird descriptions
Makefile: silence list-defconfigs for br2-external with no defconfig
Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 1/2 Makefile: fix list-defconfigs for br2-external with weird descriptions
When a br20-external tree description contains an odd number of single quotes, list-defconfigs will fail with a shell error message:
/bin/sh: -c: line 1: unexpected EOF while looking for matching `"' make[1]: *** [Makefile:1243: list-defconfigs] Error 2
Whoever wrote that code will have to write this sentence 100 times on the blackboard:
Never, ever pass user-provided data in a printf format.
(see commit 49117c102803 (core: support description for br2-external trees); dang, I knew it... And I should have known better when I wrote that code, damit...)
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -1223,7 +1223,7 @@ define list-defconfigs [ -f "$${defconfig}" ] || continue; \ if $${first}; then \ if [ "$(2)" ]; then \ - printf 'External configs in "$(call qstrip,$(2))":\n'; \ + printf 'External configs in "%s":\n' "$(call qstrip,$(2))"; \ else \ printf "Built-in configs:\n"; \ fi; \
Signature · 6 lines
2.47.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 1/2] Makefile: fix list-defconfigs for br2-external with weird descriptions
Quoted 9 lines · Yann E. MORIN via buildroot
When a br20-external tree description contains an odd number of single quotes, list-defconfigs will fail with a shell error message:
/bin/sh: -c: line 1: unexpected EOF while looking for matching `"' make[1]: *** [Makefile:1243: list-defconfigs] Error 2Whoever wrote that code will have to write this sentence 100 times on the blackboard:
Quoted 7 lines
Never, ever pass user-provided data in a printf format.
(see commit
49117c102803(core: support description for br2-external trees); dang, I knew it... And I should have known better when I wrote that code, damit...)Signed-off-by Yann E. MORIN <[email protected]>
Series applied to master, thanks.
(and have fun with your blackboard)
Best regards,
Julien.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 1/2] Makefile: fix list-defconfigs for br2-external with weird descriptions
In reply to Yann E. MORIN via buildrootIn reply of:
Quoted 9 lines
When a br20-external tree description contains an odd number of single quotes, list-defconfigs will fail with a shell error message:
/bin/sh: -c: line 1: unexpected EOF while looking for matching `"' make[1]: *** [Makefile:1243: list-defconfigs] Error 2Whoever wrote that code will have to write this sentence 100 times on the blackboard:
Quoted 7 lines
Never, ever pass user-provided data in a printf format.
(see commit
49117c102803(core: support description for br2-external trees); dang, I knew it... And I should have known better when I wrote that code, damit...)Signed-off-by Yann E. MORIN <[email protected]>
Applied to 2025.02.x & 2025.05.x. Thanks
Quoted 24 lines
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Makefile +1
-1@@ -1223,7 +1223,7 @@ define list-defconfigs [ -f "$${defconfig}" ] || continue; \ if $${first}; then \ if [ "$(2)" ]; then \ - printf 'External configs in "$(call qstrip,$(2))":\n'; \ + printf 'External configs in "%s":\n' "$(call qstrip,$(2))"; \ else \ printf "Built-in configs:\n"; \ fi; \Signature · 6 lines
2.47.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/2 Makefile: silence list-defconfigs for br2-external with no defconfig
In reply to Yann E. MORIN via buildrootWhen a br2-external tree has no defconfig, list-defconfig currently whines with an error from find:
find: ‘[...]/my-external/configs’: No such file or directory
Fix that by only running find if the directory exists.
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -1219,7 +1219,7 @@ help: # $(2): br2-external name, empty for bundled define list-defconfigs @first=true; \ - for defconfig in $$(find $(1)/configs -name '*_defconfig' |sort); do \ + for defconfig in $$([ -d $(1)/configs ] && find $(1)/configs -name '*_defconfig' |sort); do \ [ -f "$${defconfig}" ] || continue; \ if $${first}; then \ if [ "$(2)" ]; then \
Signature · 6 lines
2.47.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Thomas Perale via buildroot
AppliedRe: [Buildroot] [PATCH 2/2] Makefile: silence list-defconfigs for br2-external with no defconfig
In reply of:
Quoted 8 lines
When a br2-external tree has no defconfig, list-defconfig currently whines with an error from find:
find: ‘[...]/my-external/configs’: No such file or directory
Fix that by only running find if the directory exists.
Signed-off-by Yann E. MORIN <[email protected]>
Applied to 2025.02.x & 2025.05.x. Thanks
Quoted 24 lines
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Makefile +1
-1@@ -1219,7 +1219,7 @@ help: # $(2): br2-external name, empty for bundled define list-defconfigs @first=true; \ - for defconfig in $$(find $(1)/configs -name '*_defconfig' |sort); do \ + for defconfig in $$([ -d $(1)/configs ] && find $(1)/configs -name '*_defconfig' |sort); do \ [ -f "$${defconfig}" ] || continue; \ if $${first}; then \ if [ "$(2)" ]; then \Signature · 6 lines
2.47.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot