History

kbuild: add comment about why cmd_shipped uses 'cat'

cmd_shipped uses 'cat' instead of 'cp' for copying a file. The reason is explained in the commit [1], but it was in the pre-git era. $ touch a $ chmod -w a $ cp a b $ cp a b cp: cannot create regular file 'b': Permission denied Add comments so that you can see the reason without looking into the history. [1]: https://git.kernel.org/pub/scm/linux/kernel/git/history/history.git/commit/?id=a70dba8086160449cc94c5bdaff78419b6b8e3c8

Masahiro Yamada committed 5 years ago

Commit 3787b7d1 parent c5849b71 file · +3 −0Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/Makefile.lib+3−0
@@ -252,6 +252,9 @@ quiet_cmd_copy = COPY $@ · 251 unmodified lines
252252
253253 # Shipped files
254254 # ===========================================================================
255+# 'cp' preserves permissions. If you use it to copy a file in read-only srctree,
256+# the copy would be read-only as well, leading to an error when executing the
257+# rule next time. Use 'cat' instead in order to generate a writable file.
255258
256259 quiet_cmd_shipped = SHIPPED $@
257260 cmd_shipped = cat $< > $@