Skip to contentSkip to conversation

core/pkg-generic: sanitise FOO_OVERRIDE_SRCDIR

PATCH New Yann E. MORIN 2 participants 2 messages Jun 28, 2015 – Jul 4, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 core/pkg-generic: sanitise FOO_OVERRIDE_SRCDIR

In case FOO_OVERRIDE_SRCDIR has trailing spaces, like so:
FOO_OVERRIDE_SRCDIR = /path/to/sources\x20

we would end up with a rsync command like so:
rsync -au /path/to/sources / /path/to/build/foo

which would effectively rsync the whole vfs, eventually filling the whole disk... :-(

So, just qstrip the variable before use.

---
 package/pkg-generic.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/pkg-generic.mk +1 -1
index d5b29f0..9fe01b8 100644
@@ -102,7 +102,7 @@ $(BUILD_DIR)/%/.stamp_rsynced:
 	@$(call MESSAGE,"Syncing from source dir $(SRCDIR)")
 	@test -d $(SRCDIR) || (echo "ERROR: $(SRCDIR) does not exist" ; exit 1)
 	$(foreach hook,$($(PKG)_PRE_RSYNC_HOOKS),$(call $(hook))$(sep))
-	rsync -au $(RSYNC_VCS_EXCLUSIONS) $(SRCDIR)/ $(@D)
+	rsync -au $(RSYNC_VCS_EXCLUSIONS) $(call qstrip,$(SRCDIR))/ $(@D)
 	$(foreach hook,$($(PKG)_POST_RSYNC_HOOKS),$(call $(hook))$(sep))
 	$(Q)touch $@
 
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 core/pkg-generic: sanitise FOO_OVERRIDE_SRCDIR

Dear Yann E. MORIN,

Quoted 9 lines · Yann E. MORIN

In case FOO_OVERRIDE_SRCDIR has trailing spaces, like so:
FOO_OVERRIDE_SRCDIR = /path/to/sources\x20

we would end up with a rsync command like so:
rsync -au /path/to/sources / /path/to/build/foo

which would effectively rsync the whole vfs, eventually filling the whole disk... :-(

Quoted 7 lines

So, just qstrip the variable before use.

---
 package/pkg-generic.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com