Skip to contentSkip to conversation

firmware/shim: fix Xen tree setup

RFC PATCH In review Jan Beulich 3 participants 7 messages Jan 31, 2018 – Feb 6, 2018

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 firmware/shim: fix Xen tree setup

There are multiple issues here, and I'm happy to split the patch up if that's what it takes:
- "set -e" on a separate Makefile line is meaningless. Glue together all the lines that this is supposed to cover.
- I have no idea what *.d1 is supposed to refer to - we only have .*.d and .*.d2 files (not also the leading dot).
- I have also no idea what *.1 is meant to cover. Instead also exclude preprocessed and non-source assembly files.
- Excluding symlinks in the source tree is a problem for me: Short of out-of-tree builds, in order to easily build test multiple configurations, I'm setting up my build trees as trees of symlinks into the source tree. Hence the original logic would find only the few generated files under config/. I do realize though that find's -xtype primary is a non-standard extension (explicitly having "! type -l" seems pointless though, at least for standard conforming find, as "-type f" is supposed to only find non-symlinked files).

Irrespective of the changes I'm still observing "mkdir -p" to report a missing operand, as config/ has no subdirs. Oddly enough this doesn't cause the whole command (and hence the build to fail), despite the "set -e" now covering the entire set of commands - perhaps a quirk of the relatively old bash I've seen this with (a few simple experiments suggest that commands inside () producing a non-success status would exit the inner shell, but not the outer one).

tools/firmware/xen-dir/Makefile +5 -5
@@ -16,18 +16,18 @@ DEP_FILES=$(foreach i, $(LINK_FILES), $(
 
 linkfarm.stamp: $(DEP_DIRS) $(DEP_FILES) FORCE
 	mkdir -p $(D)
-	set -e
 	rm -f linkfarm.stamp.tmp
+	set -e; \
 	$(foreach d, $(LINK_DIRS), \
 		 (mkdir -p $(D)/$(d); \
 		  cd $(D)/$(d); \
 		  find $(XEN_ROOT)/$(d)/ -type d |\
-			sed 's,^$(XEN_ROOT)/$(d)/,,g' | xargs mkdir -p);)
+			sed 's,^$(XEN_ROOT)/$(d)/,,g' | xargs mkdir -p);) \
 	$(foreach d, $(LINK_DIRS), \
 		(cd $(XEN_ROOT); \
-		 find $(d) ! -type l -type f \
-		 $(addprefix ! -path , '*.[oda1]' '*.d[12]')) \
-		 >> linkfarm.stamp.tmp ; )
+		 find $(d) -xtype f \
+		 $(addprefix ! -path , '*.[isoa]' '.*.d' '.*.d2')) \
+		 >> linkfarm.stamp.tmp;) \
 	$(foreach f, $(LINK_FILES), \
 		echo $(f) >> linkfarm.stamp.tmp ;)
 	cmp -s linkfarm.stamp.tmp linkfarm.stamp && \

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#1 lore raw
Quoted 38 lines · Jan Beulich

There are multiple issues here, and I'm happy to split the patch up if that's what it takes:
- "set -e" on a separate Makefile line is meaningless. Glue together all the lines that this is supposed to cover.
- I have no idea what *.d1 is supposed to refer to - we only have .*.d and .*.d2 files (not also the leading dot).
- I have also no idea what *.1 is meant to cover. Instead also exclude preprocessed and non-source assembly files.
- Excluding symlinks in the source tree is a problem for me: Short of out-of-tree builds, in order to easily build test multiple configurations, I'm setting up my build trees as trees of symlinks into the source tree. Hence the original logic would find only the few generated files under config/. I do realize though that find's -xtype primary is a non-standard extension (explicitly having "! type -l" seems pointless though, at least for standard conforming find, as "-type f" is supposed to only find non-symlinked files).

Irrespective of the changes I'm still observing "mkdir -p" to report a missing operand, as config/ has no subdirs. Oddly enough this doesn't cause the whole command (and hence the build to fail), despite the "set -e" now covering the entire set of commands - perhaps a quirk of the relatively old bash I've seen this with (a few simple experiments suggest that commands inside () producing a non-success status would exit the inner shell, but not the outer one).

tools/firmware/xen-dir/Makefile +1 -1
@@ -16,18 +16,18 @@ DEP_FILES=$(foreach i, $(LINK_FILES), $(
 
 linkfarm.stamp: $(DEP_DIRS) $(DEP_FILES) FORCE
 	mkdir -p $(D)
-	set -e
 	rm -f linkfarm.stamp.tmp
+	set -e; \
 	$(foreach d, $(LINK_DIRS), \
 		 (mkdir -p $(D)/$(d); \

tools/firmware/xen-dir/Makefile DEP_FILES=$(foreach i, $(LINK_FILES), $( · line 28

Quoted 10 lines
tools/firmware/xen-dir/Makefile +2 -4
 		  cd $(D)/$(d); \
 		  find $(XEN_ROOT)/$(d)/ -type d |\
-			sed 's,^$(XEN_ROOT)/$(d)/,,g' | xargs mkdir -p);)
+			sed 's,^$(XEN_ROOT)/$(d)/,,g' | xargs mkdir -p);) \
 	$(foreach d, $(LINK_DIRS), \
 		(cd $(XEN_ROOT); \
-		 find $(d) ! -type l -type f \
-		 $(addprefix ! -path , '*.[oda1]' '*.d[12]')) \
-		 >> linkfarm.stamp.tmp ; )
+		 find $(d) -xtype f \

No xtype please. Does it work with something like:

find -H $(d) -type f

?

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
Quoted 26 lines
Quoted 1 line
Quoted 1 line · On 01.02.18 at 11:01, <[email protected]> wrote:
Quoted 11 lines · Jan Beulich
tools/firmware/xen-dir/Makefile +1 -1
@@ -16,18 +16,18 @@ DEP_FILES=$(foreach i, $(LINK_FILES), $(
 
 linkfarm.stamp: $(DEP_DIRS) $(DEP_FILES) FORCE
 	mkdir -p $(D)
-	set -e
 	rm -f linkfarm.stamp.tmp
+	set -e; \
 	$(foreach d, $(LINK_DIRS), \
 		 (mkdir -p $(D)/$(d); \

tools/firmware/xen-dir/Makefile DEP_FILES=$(foreach i, $(LINK_FILES), $( · line 28

Quoted 10 lines
tools/firmware/xen-dir/Makefile +2 -4
 		  cd $(D)/$(d); \
 		  find $(XEN_ROOT)/$(d)/ -type d |\
-			sed 's,^$(XEN_ROOT)/$(d)/,,g' | xargs mkdir -p);)
+			sed 's,^$(XEN_ROOT)/$(d)/,,g' | xargs mkdir -p);) \
 	$(foreach d, $(LINK_DIRS), \
 		(cd $(XEN_ROOT); \
-		 find $(d) ! -type l -type f \
-		 $(addprefix ! -path , '*.[oda1]' '*.d[12]')) \
-		 >> linkfarm.stamp.tmp ; )
+		 find $(d) -xtype f \

No xtype please. Does it work with something like:

Quoted 1 line

find -H $(d) -type f

Ah, yes, didn't think of that one. But perhaps -L rather than -H?

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
Quoted 26 lines · Jan Beulich
Quoted 26 lines
Quoted 1 line
Quoted 1 line · On 01.02.18 at 11:01, <[email protected]> wrote:
Quoted 11 lines · Jan Beulich
tools/firmware/xen-dir/Makefile +1 -1
@@ -16,18 +16,18 @@ DEP_FILES=$(foreach i, $(LINK_FILES), $(
 
 linkfarm.stamp: $(DEP_DIRS) $(DEP_FILES) FORCE
 	mkdir -p $(D)
-	set -e
 	rm -f linkfarm.stamp.tmp
+	set -e; \
 	$(foreach d, $(LINK_DIRS), \
 		 (mkdir -p $(D)/$(d); \

tools/firmware/xen-dir/Makefile DEP_FILES=$(foreach i, $(LINK_FILES), $( · line 28

Quoted 10 lines
tools/firmware/xen-dir/Makefile +2 -4
 		  cd $(D)/$(d); \
 		  find $(XEN_ROOT)/$(d)/ -type d |\
-			sed 's,^$(XEN_ROOT)/$(d)/,,g' | xargs mkdir -p);)
+			sed 's,^$(XEN_ROOT)/$(d)/,,g' | xargs mkdir -p);) \
 	$(foreach d, $(LINK_DIRS), \
 		(cd $(XEN_ROOT); \
-		 find $(d) ! -type l -type f \
-		 $(addprefix ! -path , '*.[oda1]' '*.d[12]')) \
-		 >> linkfarm.stamp.tmp ; )
+		 find $(d) -xtype f \

No xtype please. Does it work with something like:

Quoted 3 lines
Quoted 1 line

find -H $(d) -type f

Ah, yes, didn't think of that one. But perhaps -L rather than -H?

Uh, yes, sorry, definitely meant -L.

I guess -H will never be needed, since that would only be helpful when $(d) is a symbolic link.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw
In reply to Jan Beulich
Quoted 6 lines · Jan Beulich

There are multiple issues here, and I'm happy to split the patch up if that's what it takes:
- "set -e" on a separate Makefile line is meaningless. Glue together all the lines that this is supposed to cover.
- I have no idea what *.d1 is supposed to refer to - we only have .*.d and .*.d2 files (not also the leading dot).

These two are genuine bugs, thanks for taking the time to look into them.

Quoted 2 lines

- I have also no idea what *.1 is meant to cover. Instead also exclude preprocessed and non-source assembly files.

A copy-n-paste from the mini-os link farm rune. Feel free to remove it.

Quoted 9 lines

- Excluding symlinks in the source tree is a problem for me: Short of out-of-tree builds, in order to easily build test multiple configurations, I'm setting up my build trees as trees of symlinks into the source tree. Hence the original logic would find only the few generated files under config/. I do realize though that find's -xtype primary is a non-standard extension (explicitly having "! type -l" seems pointless though, at least for standard conforming find, as "-type f" is supposed to only find non-symlinked files).

At the time I thought whatever symlinks we have in tree should be created by xen's build system itself hence there was no need to copy them around, and it would have to avoid latent problem like linking to wrong files etc.

I think you have valid usecase for symlinks, so I'm fine with the change you make.

Quoted 8 lines

Irrespective of the changes I'm still observing "mkdir -p" to report a missing operand, as config/ has no subdirs. Oddly enough this doesn't cause the whole command (and hence the build to fail), despite the "set -e" now covering the entire set of commands - perhaps a quirk of the relatively old bash I've seen this with (a few simple experiments suggest that commands inside () producing a non-success status would exit the inner shell, but not the outer one).

I did see error when I wrote this bit hence I specifically hacked the rune to preserve "." in the output. We can add that back if necessary.

I suppose you will send out a new version at some point?

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#5 lore raw
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 06.02.18 at 13:36, <[email protected]> wrote:
Quoted 9 lines · Jan Beulich

- Excluding symlinks in the source tree is a problem for me: Short of out-of-tree builds, in order to easily build test multiple configurations, I'm setting up my build trees as trees of symlinks into the source tree. Hence the original logic would find only the few generated files under config/. I do realize though that find's -xtype primary is a non-standard extension (explicitly having "! type -l" seems pointless though, at least for standard conforming find, as "-type f" is supposed to only find non-symlinked files).

Quoted 7 lines

At the time I thought whatever symlinks we have in tree should be created by xen's build system itself hence there was no need to copy them around, and it would have to avoid latent problem like linking to wrong files etc.

I think you have valid usecase for symlinks, so I'm fine with the change you make.

The only symlinks I'm aware of are the ones putting some files from common/efi/ into arch/*/efi/. These are relative ones, so I was considering whether perhaps we should skip those but treat absolute ones like ordinary files. Do you have any opinion in that direction?

Quoted 10 lines
Quoted 7 lines

Irrespective of the changes I'm still observing "mkdir -p" to report a missing operand, as config/ has no subdirs. Oddly enough this doesn't cause the whole command (and hence the build to fail), despite the "set -e" now covering the entire set of commands - perhaps a quirk of the relatively old bash I've seen this with (a few simple experiments suggest that commands inside () producing a non-success status would exit the inner shell, but not the outer one).

I did see error when I wrote this bit hence I specifically hacked the rune to preserve "." in the output. We can add that back if necessary.

Why was it dropped?

Quoted 1 line

I suppose you will send out a new version at some point?

Sure - I only need to (a) be clear about what changes to make and
(b) find the time. Hopefully things will be easier once the Spectre v2 backports are all done.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#6 lore raw
Quoted 17 lines · Jan Beulich
Quoted 17 lines
Quoted 1 line
Quoted 1 line · On 06.02.18 at 13:36, <[email protected]> wrote:
Quoted 9 lines · Jan Beulich

- Excluding symlinks in the source tree is a problem for me: Short of out-of-tree builds, in order to easily build test multiple configurations, I'm setting up my build trees as trees of symlinks into the source tree. Hence the original logic would find only the few generated files under config/. I do realize though that find's -xtype primary is a non-standard extension (explicitly having "! type -l" seems pointless though, at least for standard conforming find, as "-type f" is supposed to only find non-symlinked files).

At the time I thought whatever symlinks we have in tree should be created by xen's build system itself hence there was no need to copy them around, and it would have to avoid latent problem like linking to wrong files etc.

Quoted 7 lines
Quoted 2 lines

I think you have valid usecase for symlinks, so I'm fine with the change you make.

The only symlinks I'm aware of are the ones putting some files from common/efi/ into arch/*/efi/. These are relative ones, so I was considering whether perhaps we should skip those but treat absolute ones like ordinary files. Do you have any opinion in that direction?

No opinion.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines

Irrespective of the changes I'm still observing "mkdir -p" to report a missing operand, as config/ has no subdirs. Oddly enough this doesn't cause the whole command (and hence the build to fail), despite the "set -e" now covering the entire set of commands - perhaps a quirk of the relatively old bash I've seen this with (a few simple experiments suggest that commands inside () producing a non-success status would exit the inner shell, but not the outer one).

Quoted 4 lines
Quoted 2 lines

I did see error when I wrote this bit hence I specifically hacked the rune to preserve "." in the output. We can add that back if necessary.

Why was it dropped?

Because a few people touched this bit.

Quoted 7 lines
Quoted 2 lines

I suppose you will send out a new version at some point?

Sure - I only need to (a) be clear about what changes to make and
(b) find the time. Hopefully things will be easier once the Spectre v2 backports are all done.

OK. If you want me to help please let me know.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel