diff mbox series

build: remove more absolute paths from dependency tracking files

Message ID 0a68efee-9595-b272-fc8b-8ceb284d3163@suse.com (mailing list archive)
State New, archived
Headers show
Series build: remove more absolute paths from dependency tracking files | expand

Commit Message

Jan Beulich Feb. 19, 2021, 4:05 p.m. UTC
d6b12add90da ("DEPS handling: Remove absolute paths from references to
cwd") took care of massaging the dependencies of the output file, but
for our passing of -MP to the compiler to take effect the same needs to
be done on the "phony" rules that the compiler emits.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

Comments

Ian Jackson Feb. 19, 2021, 4:42 p.m. UTC | #1
Jan Beulich writes ("[PATCH] build: remove more absolute paths from dependency tracking files"):
> d6b12add90da ("DEPS handling: Remove absolute paths from references to
> cwd") took care of massaging the dependencies of the output file, but
> for our passing of -MP to the compiler to take effect the same needs to
> be done on the "phony" rules that the compiler emits.

Thanks.

I think this is a bugfix.  As discussed in d6b12add90da these absolute
paths can cause build races.  So:

Release-Acked-by: Ian Jackson <iwj@xenproject.org>

> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> --- a/Config.mk
> +++ b/Config.mk
> @@ -63,7 +63,7 @@ DEPS_INCLUDE = $(addsuffix .d2, $(basena
>  DEPS_RM = $(DEPS) $(DEPS_INCLUDE)
>  
>  %.d2: %.d
> -	sed "s! $$PWD/! !" $^ >$@.tmp && mv -f $@.tmp $@
> +	sed "s!\(^\| \)$$PWD/! !" $^ >$@.tmp && mv -f $@.tmp $@
>  
>  include $(XEN_ROOT)/config/$(XEN_OS).mk
>  include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk
Ian Jackson Feb. 19, 2021, 4:55 p.m. UTC | #2
Jan Beulich writes ("[PATCH] build: remove more absolute paths from dependency tracking files"):
> d6b12add90da ("DEPS handling: Remove absolute paths from references to
> cwd") took care of massaging the dependencies of the output file, but
> for our passing of -MP to the compiler to take effect the same needs to
> be done on the "phony" rules that the compiler emits.

Reviewed-by: Ian Jackson <iwj@xenproject.org>

> --- a/Config.mk
> +++ b/Config.mk
> @@ -63,7 +63,7 @@ DEPS_INCLUDE = $(addsuffix .d2, $(basena
>  DEPS_RM = $(DEPS) $(DEPS_INCLUDE)
>  
>  %.d2: %.d
> -	sed "s! $$PWD/! !" $^ >$@.tmp && mv -f $@.tmp $@
> +	sed "s!\(^\| \)$$PWD/! !" $^ >$@.tmp && mv -f $@.tmp $@

Urgh I hate having to remember the crazy \ rules for all these
different kinds of regexps.  I have to test it every time...

Thanks for fixing this, anyway.

Ian.
diff mbox series

Patch

--- a/Config.mk
+++ b/Config.mk
@@ -63,7 +63,7 @@  DEPS_INCLUDE = $(addsuffix .d2, $(basena
 DEPS_RM = $(DEPS) $(DEPS_INCLUDE)
 
 %.d2: %.d
-	sed "s! $$PWD/! !" $^ >$@.tmp && mv -f $@.tmp $@
+	sed "s!\(^\| \)$$PWD/! !" $^ >$@.tmp && mv -f $@.tmp $@
 
 include $(XEN_ROOT)/config/$(XEN_OS).mk
 include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk