core/pkg-generic: sanitise FOO_OVERRIDE_SRCDIR
authorYann E. MORIN <yann.morin.1998@free.fr>
Sun, 28 Jun 2015 12:27:29 +0000 (14:27 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sat, 4 Jul 2015 13:30:25 +0000 (15:30 +0200)
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.

Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/pkg-generic.mk

index d5b29f08215e7d3b1debb84ac1e402e723abf521..9fe01b8d4d12899dcb15e8a6f921f8a0a6be7a18 100644 (file)
@@ -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 $@