Skip to contentSkip to conversation

package/pkg-generic.mk: add missing quotes

PATCH In review Simon Richter via buildroot 3 participants 7 messages Nov 20, 2024 – May 16, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/pkg-generic.mk: add missing quotes

This allows <PKG>_SOURCE to contain characters like &.

---
 package/pkg-generic.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/pkg-generic.mk +1 -1
index 9ec84d0f45..96cc5a1d25 100644
@@ -176,7 +176,7 @@ $(BUILD_DIR)/%/.stamp_downloaded:
 	$(call prepare-per-package-directory,$($(PKG)_FINAL_DOWNLOAD_DEPENDENCIES))
 	$(foreach hook,$($(PKG)_PRE_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
 # Only show the download message if it isn't already downloaded
-	$(Q)for p in $($(PKG)_ALL_DOWNLOADS); do \
+	$(Q)for p in "$($(PKG)_ALL_DOWNLOADS)"; do \
 		if test ! -e $($(PKG)_DL_DIR)/`basename $$p` ; then \
 			$(call MESSAGE,"Downloading") ; \
 			break ; \
Signature · 6 lines
2.47.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Simon Richter via buildroot

This allows <PKG>_SOURCE to contain characters like &.

It is a bad idea to have such name, but it makes sense.

LGTM

Quoted 24 lines
---
 package/pkg-generic.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/pkg-generic.mk +1 -1
index 9ec84d0f45..96cc5a1d25 100644
@@ -176,7 +176,7 @@ $(BUILD_DIR)/%/.stamp_downloaded:
 	$(call prepare-per-package-directory,$($(PKG)_FINAL_DOWNLOAD_DEPENDENCIES))
 	$(foreach hook,$($(PKG)_PRE_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
 # Only show the download message if it isn't already downloaded
-	$(Q)for p in $($(PKG)_ALL_DOWNLOADS); do \
+	$(Q)for p in "$($(PKG)_ALL_DOWNLOADS)"; do \
 		if test ! -e $($(PKG)_DL_DIR)/`basename $$p` ; then \
 			$(call MESSAGE,"Downloading") ; \
 			break ; \
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

#2 lore raw

Am 20.11.24 um 09:03 schrieb Vincent Jardin:

Quoted 5 lines · Simon Richter via buildroot
Quoted 3 lines

This allows <PKG>_SOURCE to contain characters like &.

It is a bad idea to have such name, but it makes sense.

I agree. I am trying to download a file from a private file share in Azure DevOps.

For authentication, I need to add some data to the URL, separated by '?' or '&':

    <PKG>_SOURCE = <FILE>?foo&bar&baz&blah

If there is a better way to solve this, I will be happy to implement it.

Regards,

Simon

Quoted 24 lines

LGTM

Quoted 20 lines
---
  package/pkg-generic.mk | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
package/pkg-generic.mk +1 -1
index 9ec84d0f45..96cc5a1d25 100644
@@ -176,7 +176,7 @@ $(BUILD_DIR)/%/.stamp_downloaded:
  	$(call prepare-per-package-directory,$($(PKG)_FINAL_DOWNLOAD_DEPENDENCIES))
  	$(foreach hook,$($(PKG)_PRE_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
  # Only show the download message if it isn't already downloaded
-	$(Q)for p in $($(PKG)_ALL_DOWNLOADS); do \
+	$(Q)for p in "$($(PKG)_ALL_DOWNLOADS)"; do \
  		if test ! -e $($(PKG)_DL_DIR)/`basename $$p` ; then \
  			$(call MESSAGE,"Downloading") ; \
  			break ; \
Signature · 1 line
2.47.0
Quoted 8 lines
Quoted 4 lines

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw
In reply to Simon Richter via buildroot

Simon, All,

On 2024-11-20 08:37 +0100, Simon Richter via buildroot spake thusly:

Quoted 12 lines

This allows <PKG>_SOURCE to contain characters like &.

---
 package/pkg-generic.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/pkg-generic.mk +0 -0
index 9ec84d0f45..96cc5a1d25 100644

package/pkg-generic.mk $(BUILD_DIR)/%/.stamp_downloaded: · line 179

Quoted 5 lines
package/pkg-generic.mk +1 -1
@@ -176,7 +176,7 @@ $(BUILD_DIR)/%/.stamp_downloaded:
 	$(call prepare-per-package-directory,$($(PKG)_FINAL_DOWNLOAD_DEPENDENCIES))
 	$(foreach hook,$($(PKG)_PRE_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
 # Only show the download message if it isn't already downloaded
-	$(Q)for p in $($(PKG)_ALL_DOWNLOADS); do \
+	$(Q)for p in "$($(PKG)_ALL_DOWNLOADS)"; do \

What this change is doing is basically make the for-loop useless.

$($(PKG)_ALL_DOWNLOADS) is a space-separated list, that may contain more than one item, so it must not be quoted.

See for example the cvs package:

    $ make defconfig
    $ make show-vars 2>&1 |jq .CVS_ALL_DOWNLOADS
    {
      "expanded": "http+http://snapshot.debian.org/archive/debian/20141023T043132Z/pool/main/c/cvs/cvs_1.12.13.orig.tar.gz http+http://snapshot.debian.org/archive/debian/20141023T043132Z/pool/main/c/cvs/cvs_1.12.13-12+squeeze1.diff.gz",
      "raw": "$(CVS_MAIN_DOWNLOAD) $(CVS_ADDITIONAL_DOWNLOADS)"
    }

So, this is not the proper solution to your issue.

Indeed, having & in a filename is really asking for trouble all along the way! :-/ As this is a downloaded file, have you tried URL-escaping the & with '%26' instead? If it works, that would give a one-off solution for your case, but maybe we need to handle that in a generic way (somehow)...

Regards,
Yann E. MORIN.

Quoted 10 lines
package/pkg-generic.mk +0 -0
 		if test ! -e $($(PKG)_DL_DIR)/`basename $$p` ; then \
 			$(call MESSAGE,"Downloading") ; \
 			break ; \
Signature · 6 lines
2.47.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 23 lines
                                        ____________
.-----------------.--------------------:       _    :------------------.
|  Yann E. MORIN  | Real-Time Embedded |    __/ )   | /"\ ASCII RIBBON |
|                 | Software  Designer |  _/ - /'   | \ / CAMPAIGN     |
| +33 638.411.245 '--------------------: (_    `--, |  X  AGAINST      |
| yann.morin (at) orange.com           |_="    ,--' | / \ HTML MAIL    |
'--------------------------------------:______/_____:------------------'

____________________________________________________________________________________________________________
Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#5 lore raw

Hi Yann, hi Vincent,

Am 20.11.24 um 09:38 schrieb [email protected]:

Quoted 27 lines

Simon, All,

On 2024-11-20 08:37 +0100, Simon Richter via buildroot spake thusly:

Quoted 12 lines

This allows <PKG>_SOURCE to contain characters like &.

---
  package/pkg-generic.mk | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
package/pkg-generic.mk +0 -0
index 9ec84d0f45..96cc5a1d25 100644

package/pkg-generic.mk $(BUILD_DIR)/%/.stamp_downloaded: · line 179

Quoted 5 lines
package/pkg-generic.mk +1 -1
@@ -176,7 +176,7 @@ $(BUILD_DIR)/%/.stamp_downloaded:
  	$(call prepare-per-package-directory,$($(PKG)_FINAL_DOWNLOAD_DEPENDENCIES))
  	$(foreach hook,$($(PKG)_PRE_DOWNLOAD_HOOKS),$(call $(hook))$(sep))
  # Only show the download message if it isn't already downloaded
-	$(Q)for p in $($(PKG)_ALL_DOWNLOADS); do \
+	$(Q)for p in "$($(PKG)_ALL_DOWNLOADS)"; do \

What this change is doing is basically make the for-loop useless.

$($(PKG)_ALL_DOWNLOADS) is a space-separated list, that may contain more than one item, so it must not be quoted.

See for example the cvs package:

Quoted 8 lines
     $ make defconfig
     $ make show-vars 2>&1 |jq .CVS_ALL_DOWNLOADS
     {
       "expanded": "http+http://snapshot.debian.org/archive/debian/20141023T043132Z/pool/main/c/cvs/cvs_1.12.13.orig.tar.gz http+http://snapshot.debian.org/archive/debian/20141023T043132Z/pool/main/c/cvs/cvs_1.12.13-12+squeeze1.diff.gz",
       "raw": "$(CVS_MAIN_DOWNLOAD) $(CVS_ADDITIONAL_DOWNLOADS)"
     }

So, this is not the proper solution to your issue.

Thanks for the explanation. You're right of course, we can't apply the patch like that, I should have seen that too.

Quoted 5 lines

Indeed, having & in a filename is really asking for trouble all along the way! :-/ As this is a downloaded file, have you tried URL-escaping the & with '%26' instead? If it works, that would give a one-off solution for your case, but maybe we need to handle that in a generic way (somehow)...

I tried to encode the URL (thanks @Vincent), but Azure doesn't like it:
400 The value for one of the HTTP headers is not in the correct format.

Our current solution is to abuse <PKG>_DL_OPTS as we don't need the variable (with our packages to be loaded via Azure). We have our own download script (a customized copy of support/download/wget):

    <while getopts>
    shift $((OPTIND-1))
    sas="$1”
    shift
    url=${url#*+*+} # remove the 'azcopy+' before 'https://...' _wget() {
        echo ${WGET} “${@}”
        eval ${WGET} “${@}”
    }
    _wget -O “‘${output}’” “‘${url}/${filename}${sas}’”

In my opinion this is more of a hack than a solution.

Do you have any ideas on how we could solve this properly (so that we can bring it upstream)?

Thanks and regards,
Simon

Quoted 13 lines

Regards,
Yann E. MORIN.

Quoted 10 lines
package/pkg-generic.mk +0 -0
  		if test ! -e $($(PKG)_DL_DIR)/`basename $$p` ; then \
  			$(call MESSAGE,"Downloading") ; \
  			break ; \
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

#6 lore raw

Hi Simon,

Raising this thread from the dead...

Quoted 4 lines · Simon Richter via buildroot

Hi Yann, hi Vincent,

Am 20.11.24 um 09:38 schrieb [email protected]:

Quoted 1 line

Simon, All,

[snip]

Quoted 7 lines
Quoted 5 lines

Indeed, having & in a filename is really asking for trouble all along the way! :-/ As this is a downloaded file, have you tried URL-escaping the & with '%26' instead? If it works, that would give a one-off solution for your case, but maybe we need to handle that in a generic way (somehow)...

I tried to encode the URL (thanks @Vincent), but Azure doesn't like it:
400 The value for one of the HTTP headers is not in the correct format.

Have you tried simply adding quotes in the .mk file? So

    <PKG>_SOURCE = '<FILE>?foo&bar&baz&blah'

Regards,
Arnout

Quoted 35 lines

Our current solution is to abuse <PKG>_DL_OPTS as we don't need the variable (with our packages to be loaded via Azure). We have our own download script (a customized copy of support/download/wget):

    <while getopts>
    shift $((OPTIND-1))
    sas="$1”
    shift
    url=${url#*+*+} # remove the 'azcopy+' before 'https://...' _wget() {
        echo ${WGET} “${@}”
        eval ${WGET} “${@}”
    }
    _wget -O “‘${output}’” “‘${url}/${filename}${sas}’”

In my opinion this is more of a hack than a solution.

Do you have any ideas on how we could solve this properly (so that we can bring it upstream)?

Thanks and regards,
Simon

Quoted 9 lines

Regards,
Yann E. MORIN.

Quoted 6 lines

          if test ! -e $($(PKG)_DL_DIR)/basename $$p ; then \
              $(call MESSAGE,"Downloading") ; \
              break ; \

Signature · 1 line
2.47.0
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot