lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20190622065520.10105-1-yamada.masahiro@socionext.com>
Date:   Sat, 22 Jun 2019 15:55:20 +0900
From:   Masahiro Yamada <yamada.masahiro@...ionext.com>
To:     linux-kbuild@...r.kernel.org
Cc:     Masahiro Yamada <yamada.masahiro@...ionext.com>,
        Michal Marek <michal.lkml@...kovi.net>,
        linux-kernel@...r.kernel.org
Subject: [PATCH] kbuild: fix 'No such file or directory' warning for headers_install

Since commit d5470d14431e ("kbuild: re-implement Makefile.headersinst
without recursion"), headers_install emits an ugly warning.

$ make headers_install
  [ snip ]
  UPD     include/generated/uapi/linux/version.h
find: ‘./include/uapi/Kbuild’: No such file or directory
  HDRINST usr/include/video/uvesafb.h
    ...

This happens for GNU Make <= 4.2.1

When I wrote that commit, I missed this warning because I was using the
state-of-the-art Make version compiled from the git tree.

$(wildcard $(src)/*/) is intended to match to only existing directories
since it has a trailing slash, but actually matches to regular files too.
(include/uapi/Kbuild in this case)

This is a bug of GNU Make, and was fixed by:

| commit b7acb10e86dc8f5fdf2a2bbd87e1059c315e31d6
| Author: spagoveanu@...il.com <spagoveanu@...il.com>
| Date:   Wed Jun 20 02:03:48 2018 +0300
|
|    * src/dir.c: Preserve glob d_type field

We need to cater to old Make versions. Add '$(filter %/,...) to filter
out the regular files.

Fixes: d5470d14431e ("kbuild: re-implement Makefile.headersinst without recursion")
Signed-off-by: Masahiro Yamada <yamada.masahiro@...ionext.com>
---

 scripts/Makefile.headersinst | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
index d2b572a7a628..ddc764838df2 100644
--- a/scripts/Makefile.headersinst
+++ b/scripts/Makefile.headersinst
@@ -20,8 +20,10 @@ dst := usr/include
 
 -include $(src)/Kbuild
 
-src-subdirs := $(patsubst $(src)/%/,%,$(wildcard $(src)/*/))
-gen-subdirs := $(patsubst $(gen)/%/,%,$(wildcard $(gen)/*/))
+# $(filter %/, ...) is needed to workaround the bug for GNU Make <= 4.2.1
+# $(wildcard $(src)/*/) contains not only directories but also regular files.
+src-subdirs := $(patsubst $(src)/%/,%,$(filter %/, $(wildcard $(src)/*/)))
+gen-subdirs := $(patsubst $(gen)/%/,%,$(filter %/, $(wildcard $(gen)/*/)))
 all-subdirs := $(sort $(src-subdirs) $(gen-subdirs))
 
 src-headers := $(if $(src-subdirs), $(shell cd $(src) && find $(src-subdirs) -name '*.h'))
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ