diff mbox

fix: spaces in srctree and objtree paths no longer break builds.

Message ID CAK2BWArN+HmtQMYJ8R_sBMQsahrR8TYeTTsyLUU9AvvFJFD=dQ@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sunil Beta Baskar Dec. 23, 2012, 3:29 p.m. UTC
Signed-off-by: Sunil Beta <betasam@gmail.com>
---
 Makefile |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Sam Ravnborg Dec. 23, 2012, 6:44 p.m. UTC | #1
On Sun, Dec 23, 2012 at 08:59:20PM +0530, Sunil Beta Baskar wrote:
> Signed-off-by: Sunil Beta <betasam@gmail.com>
> ---
>  Makefile |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index 07bc925..c2ae267 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -149,8 +149,13 @@ else
>  _all: modules
>  endif
> 
> -srctree        := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR))
> +srctree            := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR))
>  objtree        := $(CURDIR)
> +
> +# FIX! spaces in path can break build
> +srctree         := $(shell echo $(srctree) | sed "s/ /\\\ /g" )
> +objtree         := $(shell echo $(objtree) | sed "s/ /\\\ /g" )
> +
>  src        := $(srctree)
>  obj        := $(objtree)

I applied your patch manually (the patch is broken).
My build failed like this:
  SYSHDR  arch/x86/syscalls/../include/generated/uapi/asm/unistd_32.h
/bin/sh: /home/sam/kernel/my\ space.git/arch/x86/syscalls/syscallhdr.sh: No such file or directory
make[1]: *** [arch/x86/syscalls/../include/generated/uapi/asm/unistd_32.h] Error 127

This it in other words not enough.

	Sam
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michal Marek Jan. 12, 2013, 2:59 p.m. UTC | #2
On 23.12.2012 19:44, Sam Ravnborg wrote:
> On Sun, Dec 23, 2012 at 08:59:20PM +0530, Sunil Beta Baskar wrote:
>> Signed-off-by: Sunil Beta <betasam@gmail.com>
>> ---
>>  Makefile |    7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/Makefile b/Makefile
>> index 07bc925..c2ae267 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -149,8 +149,13 @@ else
>>  _all: modules
>>  endif
>>
>> -srctree        := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR))
>> +srctree            := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR))
>>  objtree        := $(CURDIR)
>> +
>> +# FIX! spaces in path can break build
>> +srctree         := $(shell echo $(srctree) | sed "s/ /\\\ /g" )
>> +objtree         := $(shell echo $(objtree) | sed "s/ /\\\ /g" )
>> +
>>  src        := $(srctree)
>>  obj        := $(objtree)
> 
> I applied your patch manually (the patch is broken).
> My build failed like this:
>   SYSHDR  arch/x86/syscalls/../include/generated/uapi/asm/unistd_32.h
> /bin/sh: /home/sam/kernel/my\ space.git/arch/x86/syscalls/syscallhdr.sh: No such file or directory
> make[1]: *** [arch/x86/syscalls/../include/generated/uapi/asm/unistd_32.h] Error 127
> 
> This it in other words not enough.

There will always be too many or too few backslashes. So just check for
bad characters early and fail if there are any.

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 07bc925..c2ae267 100644
--- a/Makefile
+++ b/Makefile
@@ -149,8 +149,13 @@  else
 _all: modules
 endif

-srctree        := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR))
+srctree            := $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR))
 objtree        := $(CURDIR)
+
+# FIX! spaces in path can break build
+srctree         := $(shell echo $(srctree) | sed "s/ /\\\ /g" )
+objtree         := $(shell echo $(objtree) | sed "s/ /\\\ /g" )
+
 src        := $(srctree)
 obj        := $(objtree)