Makefile: Dereference symlinks on install
PATCH 1/1 Makefile: Dereference symlinks on install
Adds the -L flag (follow symlinks) to the cp commands used to install libsbi.a and include/sbi/*.
This should make no difference in regular compilation. However, it does make a difference when compiling with bazel. Namely, bazel's sandboxing will turn all the source files into symlinks. After installation with cp the destination files will be symlinks pointing to the sandbox symlinks. As the sandbox files are removed when compilation ends, the just-copied symlinks become dangling symlinks.
The resulting include files will be
unusable due to the dangling symlink issues. Adding -L when copying ensures that the files obtained by executing the install targets are always dereferenced to files, rather than symlinks, eliminating this issue.
--- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Makefile +4 -4
@@ -401,10 +401,10 @@ merge_deps = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ cat $(2) > $(1) copy_file = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ echo " COPY $(subst $(build_dir)/,,$(1))"; \ - cp -f $(2) $(1) + cp -L -f $(2) $(1) inst_file = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ echo " INSTALL $(subst $(install_root_dir)/,,$(1))"; \ - cp -f $(2) $(1) + cp -L -f $(2) $(1) inst_file_list = $(CMD_PREFIX)if [ ! -z "$(4)" ]; then \ mkdir -p $(1)/$(3); \ for file in $(4) ; do \
@@ -413,12 +413,12 @@ inst_file_list = $(CMD_PREFIX)if [ ! -z "$(4)" ]; then \ dest_dir=`dirname $$dest_file`; \ echo " INSTALL "$(3)"/"`echo $$rel_file`; \ mkdir -p $$dest_dir; \ - cp -f $$file $$dest_file; \ + cp -L -f $$file $$dest_file; \ done \ fi inst_header_dir = $(CMD_PREFIX)mkdir -p $(1); \ echo " INSTALL $(subst $(install_root_dir)/,,$(1))"; \ - cp -rf $(2) $(1) + cp -L -rf $(2) $(1) compile_cpp_dep = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ echo " CPP-DEP $(subst $(build_dir)/,,$(1))"; \ printf %s `dirname $(1)`/ > $(1) && \
Signature · 1 line
2.40.1.521.gf1e218fcd8-goog
PATCH 1/1 Makefile: Dereference symlinks on install
? 2023-05-15???? 20:52 +0000?Filip Filmar???
Quoted 11 lines
Adds the
-Lflag (follow symlinks) to thecpcommands used to installlibsbi.aandinclude/sbi/*.This should make no difference in regular compilation. However, it does make a difference when compiling with bazel.? Namely, bazel's sandboxing will turn all the source files into symlinks. After installation with
cpthe destination files will be symlinks pointing to the sandbox symlinks. As the sandbox files are removed when compilation ends, the just-copied symlinks become dangling symlinks.
Quoted 5 lines
The resulting include files will be
unusable due to the dangling symlink issues. Adding-Lwhen copying ensures that the files obtained by executing theinstalltargets are always dereferenced to files, rather than symlinks, eliminating this issue.
s-o-b is missing. Otherwise, look good to me.
Quoted 40 lines
---
?Makefile | 8 ++++----
?1 file changed, 4 insertions(+), 4 deletions(-)Makefile +3
-3@@ -401,10 +401,10 @@ merge_deps = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ ???????????? cat $(2) > $(1) ?copy_file =? $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ ???????????? echo " COPY????? $(subst $(build_dir)/,,$(1))"; \ -??????????? cp -f $(2) $(1) +??????????? cp -L -f $(2) $(1) ?inst_file =? $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ ???????????? echo " INSTALL?? $(subst $(install_root_dir)/,,$(1))"; \ -??????????? cp -f $(2) $(1) +??????????? cp -L -f $(2) $(1) ?inst_file_list = $(CMD_PREFIX)if [ ! -z "$(4)" ]; then \ ???????????? mkdir -p $(1)/$(3); \ ???????????? for file in $(4) ; do \@@ -413,12 +413,12 @@ inst_file_list = $(CMD_PREFIX)if [ ! -z "$(4)" ]; then \ ???????????? dest_dir=`dirname $$dest_file`; \ ???????????? echo " INSTALL?? "$(3)"/"`echo $$rel_file`; \ ???????????? mkdir -p $$dest_dir; \ -??????????? cp -f $$file $$dest_file; \ +??????????? cp -L -f $$file $$dest_file; \ ???????????? done \???????????? fi
?inst_header_dir =? $(CMD_PREFIX)mkdir -p $(1); \
???????????? echo " INSTALL?? $(subst $(install_root_dir)/,,$(1))"; \
-??????????? cp -rf $(2) $(1)
+??????????? cp -L -rf $(2) $(1)
?compile_cpp_dep = $(CMD_PREFIX)mkdir -pdirname $(1); \
???????????? echo " CPP-DEP?? $(subst $(build_dir)/,,$(1))"; \
???????????? printf %sdirname $(1)/? > $(1) && \Signature · 1 line
2.40.1.521.gf1e218fcd8-goog
PATCH 1/1 Makefile: Dereference symlinks on install
Adds the -L flag (follow symlinks) to the cp commands used to install libsbi.a and include/sbi/*.
This should make no difference in regular compilation. However, it does make a difference when compiling with bazel. Namely, bazel's sandboxing will turn all the source files into symlinks. After installation with cp the destination files will be symlinks pointing to the sandbox symlinks. As the sandbox files are removed when compilation ends, the just-copied symlinks become dangling symlinks.
The resulting include files will be
unusable due to the dangling symlink issues. Adding -L when copying ensures that the files obtained by executing the install targets are always dereferenced to files, rather than symlinks, eliminating this issue.
--- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Makefile +4 -4
@@ -401,10 +401,10 @@ merge_deps = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ cat $(2) > $(1) copy_file = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ echo " COPY $(subst $(build_dir)/,,$(1))"; \ - cp -f $(2) $(1) + cp -L -f $(2) $(1) inst_file = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ echo " INSTALL $(subst $(install_root_dir)/,,$(1))"; \ - cp -f $(2) $(1) + cp -L -f $(2) $(1) inst_file_list = $(CMD_PREFIX)if [ ! -z "$(4)" ]; then \ mkdir -p $(1)/$(3); \ for file in $(4) ; do \
@@ -413,12 +413,12 @@ inst_file_list = $(CMD_PREFIX)if [ ! -z "$(4)" ]; then \ dest_dir=`dirname $$dest_file`; \ echo " INSTALL "$(3)"/"`echo $$rel_file`; \ mkdir -p $$dest_dir; \ - cp -f $$file $$dest_file; \ + cp -L -f $$file $$dest_file; \ done \ fi inst_header_dir = $(CMD_PREFIX)mkdir -p $(1); \ echo " INSTALL $(subst $(install_root_dir)/,,$(1))"; \ - cp -rf $(2) $(1) + cp -L -rf $(2) $(1) compile_cpp_dep = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ echo " CPP-DEP $(subst $(build_dir)/,,$(1))"; \ printf %s `dirname $(1)`/ > $(1) && \
Signature · 1 line
2.40.1.606.ga4b1b128d6-goog
PATCH 1/1 Makefile: Dereference symlinks on install
? 2023-05-15???? 23:17 +0000?Filip Filmar???
Quoted 11 lines
Adds the
-Lflag (follow symlinks) to thecpcommands used to installlibsbi.aandinclude/sbi/*.This should make no difference in regular compilation. However, it does make a difference when compiling with bazel.? Namely, bazel's sandboxing will turn all the source files into symlinks. After installation with
cpthe destination files will be symlinks pointing to the sandbox symlinks. As the sandbox files are removed when compilation ends, the just-copied symlinks become dangling symlinks.
Quoted 7 lines
The resulting include files will be
unusable due to the dangling symlink issues. Adding-Lwhen copying ensures that the files obtained by executing theinstalltargets are always dereferenced to files, rather than symlinks, eliminating this issue.Signed-off-by Filip Filmar <[email protected]>
Missing my tag.
Regards,
Xiang W
Quoted 40 lines
---
?Makefile | 8 ++++----
?1 file changed, 4 insertions(+), 4 deletions(-)Makefile +3
-3@@ -401,10 +401,10 @@ merge_deps = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ ???????????? cat $(2) > $(1) ?copy_file =? $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ ???????????? echo " COPY????? $(subst $(build_dir)/,,$(1))"; \ -??????????? cp -f $(2) $(1) +??????????? cp -L -f $(2) $(1) ?inst_file =? $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ ???????????? echo " INSTALL?? $(subst $(install_root_dir)/,,$(1))"; \ -??????????? cp -f $(2) $(1) +??????????? cp -L -f $(2) $(1) ?inst_file_list = $(CMD_PREFIX)if [ ! -z "$(4)" ]; then \ ???????????? mkdir -p $(1)/$(3); \ ???????????? for file in $(4) ; do \@@ -413,12 +413,12 @@ inst_file_list = $(CMD_PREFIX)if [ ! -z "$(4)" ]; then \ ???????????? dest_dir=`dirname $$dest_file`; \ ???????????? echo " INSTALL?? "$(3)"/"`echo $$rel_file`; \ ???????????? mkdir -p $$dest_dir; \ -??????????? cp -f $$file $$dest_file; \ +??????????? cp -L -f $$file $$dest_file; \ ???????????? done \???????????? fi
?inst_header_dir =? $(CMD_PREFIX)mkdir -p $(1); \
???????????? echo " INSTALL?? $(subst $(install_root_dir)/,,$(1))"; \
-??????????? cp -rf $(2) $(1)
+??????????? cp -L -rf $(2) $(1)
?compile_cpp_dep = $(CMD_PREFIX)mkdir -pdirname $(1); \
???????????? echo " CPP-DEP?? $(subst $(build_dir)/,,$(1))"; \
???????????? printf %sdirname $(1)/? > $(1) && \Signature · 1 line
2.40.1.606.ga4b1b128d6-goog
A message that is not in the archive (sent off-list or not yet received): CAGEh6bgZLfNcPW91SG5OgNawRE1MhHv7z64UwhvOMxj+1nahHA@mail.gmail.com
PATCH 1/1 Makefile: Dereference symlinks on install
? 2023-05-15???? 17:33 -0700?Filip Filmar???
Quoted 7 lines · On Mon, May 15, 2023 at 4:38?PM Xiang W <[email protected]> wrote:
Quoted 3 lines
Quoted 1 line
Signed-off-by Filip Filmar <[email protected]>Missing my tag.
I don't follow. What do you want me to change?
Missing "Reviewed-by: Xiang W <[email protected]>". Sending a new patch should change the subject [PATCH v[n]].
Regards,
Xiang W
Quoted 2 lines
F?
PATCH 1/1 Makefile: Dereference symlinks on install
Will do.
Quoted 17 lines · On Mon, May 15, 2023 at 6:24?PM Xiang W <[email protected]> wrote:
? 2023-05-15???? 17:33 -0700?Filip Filmar???
Quoted 7 lines · On Mon, May 15, 2023 at 4:38?PM Xiang W <[email protected]> wrote:
Quoted 3 lines
Quoted 1 line
Signed-off-by Filip Filmar <[email protected]>Missing my tag.
I don't follow. What do you want me to change?
Missing "Reviewed-by: Xiang W <[email protected]>". Sending a new patch should change the subject [PATCH v[n]].
Regards,
Xiang WQuoted 2 lines
F
PATCH 1/1 ] Makefile: Dereference symlinks on install
In reply to Xiang WAdds the -L flag (follow symlinks) to the cp commands used to install libsbi.a and include/sbi/*.
This should make no difference in regular compilation. However, it does make a difference when compiling with bazel. Namely, bazel's sandboxing will turn all the source files into symlinks. After installation with cp the destination files will be symlinks pointing to the sandbox symlinks. As the sandbox files are removed when compilation ends, the just-copied symlinks become dangling symlinks.
The resulting include files will be
unusable due to the dangling symlink issues. Adding -L when copying ensures that the files obtained by executing the install targets are always dereferenced to files, rather than symlinks, eliminating this issue.
--- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Makefile +4 -4
@@ -401,10 +401,10 @@ merge_deps = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ cat $(2) > $(1) copy_file = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ echo " COPY $(subst $(build_dir)/,,$(1))"; \ - cp -f $(2) $(1) + cp -L -f $(2) $(1) inst_file = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ echo " INSTALL $(subst $(install_root_dir)/,,$(1))"; \ - cp -f $(2) $(1) + cp -L -f $(2) $(1) inst_file_list = $(CMD_PREFIX)if [ ! -z "$(4)" ]; then \ mkdir -p $(1)/$(3); \ for file in $(4) ; do \
@@ -413,12 +413,12 @@ inst_file_list = $(CMD_PREFIX)if [ ! -z "$(4)" ]; then \ dest_dir=`dirname $$dest_file`; \ echo " INSTALL "$(3)"/"`echo $$rel_file`; \ mkdir -p $$dest_dir; \ - cp -f $$file $$dest_file; \ + cp -L -f $$file $$dest_file; \ done \ fi inst_header_dir = $(CMD_PREFIX)mkdir -p $(1); \ echo " INSTALL $(subst $(install_root_dir)/,,$(1))"; \ - cp -rf $(2) $(1) + cp -L -rf $(2) $(1) compile_cpp_dep = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ echo " CPP-DEP $(subst $(build_dir)/,,$(1))"; \ printf %s `dirname $(1)`/ > $(1) && \
Signature · 1 line
2.40.1.606.ga4b1b128d6-goog
PATCH 1/1 ] Makefile: Dereference symlinks on install
? 2023-05-16???? 01:42 +0000?Filip Filmar???
Quoted 11 lines
Adds the
-Lflag (follow symlinks) to thecpcommands used to installlibsbi.aandinclude/sbi/*.This should make no difference in regular compilation. However, it does make a difference when compiling with bazel.? Namely, bazel's sandboxing will turn all the source files into symlinks. After installation with
cpthe destination files will be symlinks pointing to the sandbox symlinks. As the sandbox files are removed when compilation ends, the just-copied symlinks become dangling symlinks.
Quoted 8 lines
The resulting include files will be
unusable due to the dangling symlink issues. Adding-Lwhen copying ensures that the files obtained by executing theinstalltargets are always dereferenced to files, rather than symlinks, eliminating this issue.Signed-off-by Filip Filmar <[email protected]>Reviewed-by Xiang W <[email protected]>
Sorry, I probably didn't express myself clearly enough. What I wanted to say was:
[PATCH] Makefile: Dereference symlinks on install [PATCH v2] Makefile: Dereference symlinks on install [PATCH v3] Makefile: Dereference symlinks on install
...
Regards,
Xiang W
Quoted 36 lines
---
?Makefile | 8 ++++----
?1 file changed, 4 insertions(+), 4 deletions(-)Makefile +3
-3@@ -401,10 +401,10 @@ merge_deps = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ ???????????? cat $(2) > $(1) ?copy_file =? $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ ???????????? echo " COPY????? $(subst $(build_dir)/,,$(1))"; \ -??????????? cp -f $(2) $(1) +??????????? cp -L -f $(2) $(1) ?inst_file =? $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ ???????????? echo " INSTALL?? $(subst $(install_root_dir)/,,$(1))"; \ -??????????? cp -f $(2) $(1) +??????????? cp -L -f $(2) $(1) ?inst_file_list = $(CMD_PREFIX)if [ ! -z "$(4)" ]; then \ ???????????? mkdir -p $(1)/$(3); \ ???????????? for file in $(4) ; do \@@ -413,12 +413,12 @@ inst_file_list = $(CMD_PREFIX)if [ ! -z "$(4)" ]; then \ ???????????? dest_dir=`dirname $$dest_file`; \ ???????????? echo " INSTALL?? "$(3)"/"`echo $$rel_file`; \ ???????????? mkdir -p $$dest_dir; \ -??????????? cp -f $$file $$dest_file; \ +??????????? cp -L -f $$file $$dest_file; \ ???????????? done \???????????? fi
?inst_header_dir =? $(CMD_PREFIX)mkdir -p $(1); \
???????????? echo " INSTALL?? $(subst $(install_root_dir)/,,$(1))"; \
-??????????? cp -rf $(2) $(1)
+??????????? cp -L -rf $(2) $(1)
?compile_cpp_dep = $(CMD_PREFIX)mkdir -pdirname $(1); \
???????????? echo " CPP-DEP?? $(subst $(build_dir)/,,$(1))"; \
???????????? printf %sdirname $(1)/? > $(1) && \
Anup Patel
AppliedPATCH 1/1 ] Makefile: Dereference symlinks on install
Quoted 21 lines · On Tue, May 16, 2023 at 8:04?AM Xiang W <[email protected]> wrote:
? 2023-05-16???? 01:42 +0000?Filip Filmar???
Quoted 19 lines
Adds the
-Lflag (follow symlinks) to thecpcommands used to installlibsbi.aandinclude/sbi/*.This should make no difference in regular compilation. However, it does make a difference when compiling with bazel. Namely, bazel's sandboxing will turn all the source files into symlinks. After installation with
cpthe destination files will be symlinks pointing to the sandbox symlinks. As the sandbox files are removed when compilation ends, the just-copied symlinks become dangling symlinks.The resulting include files will be
unusable due to the dangling symlink issues. Adding-Lwhen copying ensures that the files obtained by executing theinstalltargets are always dereferenced to files, rather than symlinks, eliminating this issue.Signed-off-by Filip Filmar <[email protected]>Reviewed-by Xiang W <[email protected]>
Somehow, this patch did not land in my inbox.
This looks good to me.
Applied this patch to the riscv/opensbi repo.
Thanks,
Anup
Quoted 50 lines
Sorry, I probably didn't express myself clearly enough. What I wanted to say was:
[PATCH]Makefile: Dereference symlinks on install [PATCH v2]Makefile: Dereference symlinks on install [PATCH v3]Makefile: Dereference symlinks on install
...Regards,
Xiang WQuoted 26 lines
--- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)Makefile +2
-3@@ -401,10 +401,10 @@ merge_deps = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ cat $(2) > $(1) copy_file = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ echo " COPY $(subst $(build_dir)/,,$(1))"; \ - cp -f $(2) $(1) + cp -L -f $(2) $(1) inst_file = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ echo " INSTALL $(subst $(install_root_dir)/,,$(1))"; \ - cp -f $(2) $(1) + cp -L -f $(2) $(1) inst_file_list = $(CMD_PREFIX)if [ ! -z "$(4)" ]; then \ mkdir -p $(1)/$(3); \ for file in $(4) ; do \@@ -413,12 +413,12 @@ inst_file_list = $(CMD_PREFIX)if [ ! -z "$(4)" ]; then \ dest_dir=`dirname $$dest_file`; \ echo " INSTALL "$(3)"/"`echo $$rel_file`; \ mkdir -p $$dest_dir; \ - cp -f $$file $$dest_file; \Makefile inst_file_list = $(CMD_PREFIX)if [ ! -z "$(4)" ]; then \ · line 424
Quoted 10 lines
Makefile +2
-1+ cp -L -f $$file $$dest_file; \ done \ fi inst_header_dir = $(CMD_PREFIX)mkdir -p $(1); \ echo " INSTALL $(subst $(install_root_dir)/,,$(1))"; \ - cp -rf $(2) $(1) + cp -L -rf $(2) $(1) compile_cpp_dep = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ echo " CPP-DEP $(subst $(build_dir)/,,$(1))"; \ printf %s `dirname $(1)`/ > $(1) && \--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi
PATCH v4 1/1 Makefile: Dereference symlinks on install
In reply to Xiang WAdds the -L flag (follow symlinks) to the cp commands used to install libsbi.a and include/sbi/*.
This should make no difference in regular compilation. However, it does make a difference when compiling with bazel. Namely, bazel's sandboxing will turn all the source files into symlinks. After installation with cp the destination files will be symlinks pointing to the sandbox symlinks. As the sandbox files are removed when compilation ends, the just-copied symlinks become dangling symlinks.
The resulting include files will be
unusable due to the dangling symlink issues. Adding -L when copying ensures that the files obtained by executing the install targets are always dereferenced to files, rather than symlinks, eliminating this issue.
--- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Makefile +4 -4
@@ -401,10 +401,10 @@ merge_deps = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ cat $(2) > $(1) copy_file = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ echo " COPY $(subst $(build_dir)/,,$(1))"; \ - cp -f $(2) $(1) + cp -L -f $(2) $(1) inst_file = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ echo " INSTALL $(subst $(install_root_dir)/,,$(1))"; \ - cp -f $(2) $(1) + cp -L -f $(2) $(1) inst_file_list = $(CMD_PREFIX)if [ ! -z "$(4)" ]; then \ mkdir -p $(1)/$(3); \ for file in $(4) ; do \
@@ -413,12 +413,12 @@ inst_file_list = $(CMD_PREFIX)if [ ! -z "$(4)" ]; then \ dest_dir=`dirname $$dest_file`; \ echo " INSTALL "$(3)"/"`echo $$rel_file`; \ mkdir -p $$dest_dir; \ - cp -f $$file $$dest_file; \ + cp -L -f $$file $$dest_file; \ done \ fi inst_header_dir = $(CMD_PREFIX)mkdir -p $(1); \ echo " INSTALL $(subst $(install_root_dir)/,,$(1))"; \ - cp -rf $(2) $(1) + cp -L -rf $(2) $(1) compile_cpp_dep = $(CMD_PREFIX)mkdir -p `dirname $(1)`; \ echo " CPP-DEP $(subst $(build_dir)/,,$(1))"; \ printf %s `dirname $(1)`/ > $(1) && \
Signature · 1 line
2.40.1.606.ga4b1b128d6-goog