Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] Add BR2_TOOLCHAIN_HAS_FTS config option
@ 2017-07-06 15:23 Adam Duskett
  2017-07-06 15:23 ` [Buildroot] [PATCH 2/2] selinux packages: change glibc check to fts check Adam Duskett
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Adam Duskett @ 2017-07-06 15:23 UTC (permalink / raw)
  To: buildroot

Currently there are a few packages in buildroot that are set to not
be selectable unless the user wishes to use glibc specifically because
the package uses fts.h.

uClibc actually does have a fts implimentation, and it's selectable in
uclib-menuconfig.  However; this has two issues with it:

1) Most users wouldn't know that there is even a uClibc-menuconfig
2) Even if the user does select fts support in uClibc-menuconfig, the
   packages that would now compile and work would still not be selectable
   because they explicitly require BR2_TOOLCHAIN_USES_GLIBC.

This patch does the following:

- Create a BR2_TOOLCHAIN_HAS_FTS configuration option in uclibc/Config.in
  and automatically set the kconfig during the configure stage.
- when glibc is selected, BR2_TOOLCHAIN_HAS_FTS is now selected.

This will allow for packages that require glibc only because of fts.h to now
depend on BR2_TOOLCHAIN_HAS_FTS instead of BR2_TOOLCHAIN_USES_GLIBC.

Signed-off-by: Adam Duskett <aduskett@codeblue.com>
---
 package/glibc/Config.in  |  1 +
 package/uclibc/Config.in |  8 ++++++++
 package/uclibc/uclibc.mk | 10 ++++++++++
 3 files changed, 19 insertions(+)

diff --git a/package/glibc/Config.in b/package/glibc/Config.in
index 57a2e83..a20244f 100644
--- a/package/glibc/Config.in
+++ b/package/glibc/Config.in
@@ -5,5 +5,6 @@ config BR2_PACKAGE_GLIBC
 	default y
 	select BR2_PACKAGE_LINUX_HEADERS
 	select BR2_TOOLCHAIN_HAS_SSP
+	select BR2_TOOLCHAIN_HAS_FTS
 
 endif
diff --git a/package/uclibc/Config.in b/package/uclibc/Config.in
index b0b0b01..21a7ff0 100644
--- a/package/uclibc/Config.in
+++ b/package/uclibc/Config.in
@@ -79,6 +79,12 @@ config BR2_TOOLCHAIN_BUILDROOT_USE_SSP
 	  See http://www.linuxfromscratch.org/hints/downloads/files/ssp.txt
 	  for details.
 
+config BR2_TOOLCHAIN_HAS_FTS
+	bool "Support the fts interface."
+	help
+	  The fts functions are provided for traversing UNIX file
+	  hierarchies. This adds around 7.5k to the build.
+
 config BR2_UCLIBC_INSTALL_UTILS
 	bool "Compile and install uClibc utilities"
 	default y
diff --git a/package/uclibc/uclibc.mk b/package/uclibc/uclibc.mk
index f22d078..c7e5bc9 100644
--- a/package/uclibc/uclibc.mk
+++ b/package/uclibc/uclibc.mk
@@ -356,6 +356,15 @@ endef
 endif
 
 #
+# fts
+#
+ifeq ($(BR2_TOOLCHAIN_HAS_FTS),y)
+UCLIBC_FTS_CONFIG = $(call KCONFIG_ENABLE_OPT,UCLIBC_HAS_FTS,$(@D)/.config)
+else
+UCLIBC_FTS_CONFIG = $(call KCONFIG_DISABLE_OPT,UCLIBC_HAS_FTS,$(@D)/.config)
+endif
+
+#
 # wchar
 #
 
@@ -419,6 +428,7 @@ define UCLIBC_KCONFIG_FIXUP_CMDS
 	$(UCLIBC_LOCALE_CONFIG)
 	$(UCLIBC_WCHAR_CONFIG)
 	$(UCLIBC_SHARED_LIBS_CONFIG)
+	$(UCLIBC_FTS_CONFIG)
 endef
 
 define UCLIBC_BUILD_CMDS
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 2/2] selinux packages: change glibc check to fts check
  2017-07-06 15:23 [Buildroot] [PATCH 1/1] Add BR2_TOOLCHAIN_HAS_FTS config option Adam Duskett
@ 2017-07-06 15:23 ` Adam Duskett
  2017-07-06 15:37 ` [Buildroot] [PATCH 1/1] Add BR2_TOOLCHAIN_HAS_FTS config option Thomas Petazzoni
  2017-07-06 17:18 ` Waldemar Brodkorb
  2 siblings, 0 replies; 5+ messages in thread
From: Adam Duskett @ 2017-07-06 15:23 UTC (permalink / raw)
  To: buildroot

As per the previous patch, now that fts support can be checked,
the selinux libraries and packages can check if the toolchain has
fts support instead of explicitly requiring glibc.

Signed-off-by: Adam Duskett <aduskett@codeblue.com>
---
 package/checkpolicy/Config.in     |  6 +++---
 package/libselinux/Config.in      |  8 ++++----
 package/libsemanage/Config.in     |  8 ++++----
 package/policycoreutils/Config.in | 12 ++++++------
 package/refpolicy/Config.in       |  6 +++---
 package/setools/Config.in         |  6 +++---
 6 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/package/checkpolicy/Config.in b/package/checkpolicy/Config.in
index 97ad0b7..416cbd1 100644
--- a/package/checkpolicy/Config.in
+++ b/package/checkpolicy/Config.in
@@ -2,7 +2,7 @@ config BR2_PACKAGE_CHECKPOLICY
 	bool "checkpolicy"
 	depends on BR2_TOOLCHAIN_HAS_THREADS # libselinux
 	depends on !BR2_STATIC_LIBS # libselinux
-	depends on BR2_TOOLCHAIN_USES_GLIBC # libselinux
+	depends on BR2_TOOLCHAIN_HAS_FTS # libselinux
 	depends on !BR2_arc # libselinux
 	select BR2_PACKAGE_LIBSELINUX
 	select BR2_PACKAGE_FLEX
@@ -15,7 +15,7 @@ config BR2_PACKAGE_CHECKPOLICY
 
 	  http://selinuxproject.org/page/Main_Page
 
-comment "checkpolicy needs a glibc toolchain w/ threads, dynamic library"
+comment "checkpolicy needs a toolchain w/ threads, dynamic library, fts"
 	depends on !BR2_arc
 	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS || \
-		!BR2_TOOLCHAIN_USES_GLIBC
+		!BR2_TOOLCHAIN_HAS_FTS
diff --git a/package/libselinux/Config.in b/package/libselinux/Config.in
index 6be816d..6b0d1fe 100644
--- a/package/libselinux/Config.in
+++ b/package/libselinux/Config.in
@@ -2,8 +2,8 @@ config BR2_PACKAGE_LIBSELINUX
 	bool "libselinux"
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on !BR2_STATIC_LIBS
-	# Uses <fts.h>, not available in musl or uClibc
-	depends on BR2_TOOLCHAIN_USES_GLIBC
+	# Uses <fts.h>, not available in musl
+	depends on BR2_TOOLCHAIN_HAS_FTS
 	# Toolchain issue: "fixup not contained within frag"
 	depends on !BR2_arc
 	select BR2_PACKAGE_LIBSEPOL
@@ -19,7 +19,7 @@ config BR2_PACKAGE_LIBSELINUX
 
 	  http://selinuxproject.org/page/Main_Page
 
-comment "libselinux needs a glibc toolchain w/ threads, dynamic library"
+comment "libselinux needs a toolchain w/ threads, dynamic library, fts"
 	depends on !BR2_arc
 	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS || \
-		!BR2_TOOLCHAIN_USES_GLIBC
+		!BR2_TOOLCHAIN_HAS_FTS
diff --git a/package/libsemanage/Config.in b/package/libsemanage/Config.in
index 7ee9c38..93a399e 100644
--- a/package/libsemanage/Config.in
+++ b/package/libsemanage/Config.in
@@ -3,10 +3,10 @@ config BR2_PACKAGE_LIBSEMANAGE
 	depends on BR2_PACKAGE_AUDIT_ARCH_SUPPORTS
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	depends on !BR2_STATIC_LIBS
-	# - libselinux needs fts.h (not available in uClibc/musl)
+	# - libselinux needs fts.h (not available in musl)
 	# - libsemanage itself needs getpwent_r() not available in musl
 	# - audit is not available on musl
-	depends on BR2_TOOLCHAIN_USES_GLIBC
+	depends on BR2_TOOLCHAIN_HAS_FTS
 	depends on !BR2_arc
 	select BR2_PACKAGE_AUDIT
 	select BR2_PACKAGE_LIBSELINUX
@@ -23,8 +23,8 @@ config BR2_PACKAGE_LIBSEMANAGE
 
 	  http://selinuxproject.org/page/Main_Page
 
-comment "libsemanage needs a glibc toolchain w/ threads, dynamic library"
+comment "libsemanage needs a toolchain w/ threads, dynamic library, fts"
 	depends on !BR2_arc
 	depends on BR2_PACKAGE_AUDIT_ARCH_SUPPORTS
 	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS || \
-		!BR2_TOOLCHAIN_USES_GLIBC
+		!BR2_TOOLCHAIN_HAS_FTS
diff --git a/package/policycoreutils/Config.in b/package/policycoreutils/Config.in
index 6b58d6e..8fa891f 100644
--- a/package/policycoreutils/Config.in
+++ b/package/policycoreutils/Config.in
@@ -1,7 +1,7 @@
-comment "policycoreutils needs a glibc toolchain w/ threads, dynamic library"
+comment "policycoreutils needs a toolchain w/ threads, dynamic library, fts"
 	depends on !BR2_arc
 	depends on BR2_PACKAGE_AUDIT_ARCH_SUPPORTS
-	depends on !BR2_TOOLCHAIN_USES_GLIBC || \
+	depends on !BR2_TOOLCHAIN_HAS_FTS || \
 		!BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
 
 config BR2_PACKAGE_POLICYCOREUTILS
@@ -10,7 +10,7 @@ config BR2_PACKAGE_POLICYCOREUTILS
 	depends on BR2_TOOLCHAIN_HAS_THREADS # libsemanage
 	depends on !BR2_STATIC_LIBS #libsemanage
 	depends on !BR2_arc # libsemanage
-	depends on BR2_TOOLCHAIN_USES_GLIBC # libsemanage
+	depends on BR2_TOOLCHAIN_HAS_FTS # libsemanage
 	select BR2_PACKAGE_LIBSEMANAGE
 	select BR2_PACKAGE_LIBCAP_NG
 	help
@@ -51,7 +51,7 @@ config BR2_PACKAGE_POLICYCOREUTILS_AUDIT2ALLOW
 	depends on BR2_USE_MMU # python3, sepolgen
 	depends on BR2_TOOLCHAIN_HAS_THREADS # python3, sepolgen, checkpolicy
 	depends on !BR2_STATIC_LIBS # python3, sepolgen
-	depends on BR2_TOOLCHAIN_USES_GLIBC # checkpolicy
+	depends on BR2_TOOLCHAIN_HAS_FTS # checkpolicy
 	depends on !BR2_arc # checkpolicy
 	select BR2_PACKAGE_SEPOLGEN
 	select BR2_PACKAGE_CHECKPOLICY
@@ -59,11 +59,11 @@ config BR2_PACKAGE_POLICYCOREUTILS_AUDIT2ALLOW
 	help
 	  Enable audit2allow to be built
 
-comment "audit2allow needs a glibc toolchain w/ wchar, threads, dynamic library"
+comment "audit2allow needs a toolchain w/ wchar, threads, dynamic library, fts"
 	depends on BR2_USE_MMU
 	depends on !BR2_arc
 	depends on !BR2_USE_WCHAR || !BR2_TOOLCHAIN_HAS_THREADS || \
-		BR2_STATIC_LIBS
+		BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_FTS
 
 config BR2_PACKAGE_POLICYCOREUTILS_RESTORECOND
 	bool "restorecond"
diff --git a/package/refpolicy/Config.in b/package/refpolicy/Config.in
index 954dc3a..de26a5b 100644
--- a/package/refpolicy/Config.in
+++ b/package/refpolicy/Config.in
@@ -1,7 +1,7 @@
 config BR2_PACKAGE_REFPOLICY
 	bool "refpolicy"
 	depends on BR2_TOOLCHAIN_HAS_THREADS # policycoreutils
-	depends on BR2_TOOLCHAIN_USES_GLIBC # policycoreutils
+	depends on BR2_TOOLCHAIN_HAS_FTS # policycoreutils
 	depends on BR2_PACKAGE_AUDIT_ARCH_SUPPORTS # policycoreutils
 	depends on !BR2_STATIC_LIBS # policycoreutils
 	depends on !BR2_arc # policycoreutils
@@ -28,11 +28,11 @@ config BR2_PACKAGE_REFPOLICY
 
 	  https://github.com/TresysTechnology/refpolicy
 
-comment "refpolicy needs a glibc toolchain w/ threads, dynamic library"
+comment "refpolicy needs a toolchain w/ threads, dynamic library, fts"
 	depends on !BR2_arc
 	depends on BR2_PACKAGE_AUDIT_ARCH_SUPPORTS
 	depends on BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HAS_THREADS || \
-		!BR2_TOOLCHAIN_USES_GLIBC
+		!BR2_TOOLCHAIN_HAS_FTS
 
 if BR2_PACKAGE_REFPOLICY
 
diff --git a/package/setools/Config.in b/package/setools/Config.in
index d7b119f..fd26173 100644
--- a/package/setools/Config.in
+++ b/package/setools/Config.in
@@ -4,7 +4,7 @@ config BR2_PACKAGE_SETOOLS
 	depends on !BR2_STATIC_LIBS
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_USE_WCHAR
-	depends on BR2_TOOLCHAIN_USES_GLIBC # libselinux
+	depends on BR2_TOOLCHAIN_HAS_FTS # libselinux
 	# bfin: infamous _ symbol prefix issue
 	# nios2: triggers some toolchain issue "No symbol version
 	# section for versioned symbol"
@@ -29,8 +29,8 @@ config BR2_PACKAGE_SETOOLS
 
 	  https://github.com/TresysTechnology/setools3/wiki
 
-comment "setools needs a glibc toolchain w/ threads, C++, wchar, dynamic library"
+comment "setools needs a toolchain w/ threads, C++, wchar, dynamic library, fts"
 	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS \
 		|| !BR2_USE_WCHAR || !BR2_INSTALL_LIBSTDCPP \
-		|| !BR2_TOOLCHAIN_USES_GLIBC
+		|| !BR2_TOOLCHAIN_HAS_FTS
 	depends on !BR2_nios2 && !BR2_bfin && !BR2_arc
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 1/1] Add BR2_TOOLCHAIN_HAS_FTS config option
  2017-07-06 15:23 [Buildroot] [PATCH 1/1] Add BR2_TOOLCHAIN_HAS_FTS config option Adam Duskett
  2017-07-06 15:23 ` [Buildroot] [PATCH 2/2] selinux packages: change glibc check to fts check Adam Duskett
@ 2017-07-06 15:37 ` Thomas Petazzoni
  2017-07-06 15:47   ` Adam Duskett
  2017-07-06 17:18 ` Waldemar Brodkorb
  2 siblings, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2017-07-06 15:37 UTC (permalink / raw)
  To: buildroot

Hello,

On Thu,  6 Jul 2017 11:23:45 -0400, Adam Duskett wrote:
> Currently there are a few packages in buildroot that are set to not
> be selectable unless the user wishes to use glibc specifically because
> the package uses fts.h.
> 
> uClibc actually does have a fts implimentation, and it's selectable in
> uclib-menuconfig.  However; this has two issues with it:
> 
> 1) Most users wouldn't know that there is even a uClibc-menuconfig
> 2) Even if the user does select fts support in uClibc-menuconfig, the
>    packages that would now compile and work would still not be selectable
>    because they explicitly require BR2_TOOLCHAIN_USES_GLIBC.
> 
> This patch does the following:
> 
> - Create a BR2_TOOLCHAIN_HAS_FTS configuration option in uclibc/Config.in
>   and automatically set the kconfig during the configure stage.
> - when glibc is selected, BR2_TOOLCHAIN_HAS_FTS is now selected.
> 
> This will allow for packages that require glibc only because of fts.h to now
> depend on BR2_TOOLCHAIN_HAS_FTS instead of BR2_TOOLCHAIN_USES_GLIBC.
> 
> Signed-off-by: Adam Duskett <aduskett@codeblue.com>

What is the size impact of enabling FTS by default in uClibc-ng ?

Adding such an option is more complicated. Here you're doing it for the
internal toolchain backend. But then the external toolchain backend
would need the same option, and check whether the toolchain really has
FTS support, etc. It's not that simple to add new options for uClibc,
so we try to avoid doing that.

What about instead migrating the SELinux stuff away from the BSD-style
fts() interface to the POSIX compliant nftw() interface ?

It would IMO make a lot more sense.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 1/1] Add BR2_TOOLCHAIN_HAS_FTS config option
  2017-07-06 15:37 ` [Buildroot] [PATCH 1/1] Add BR2_TOOLCHAIN_HAS_FTS config option Thomas Petazzoni
@ 2017-07-06 15:47   ` Adam Duskett
  0 siblings, 0 replies; 5+ messages in thread
From: Adam Duskett @ 2017-07-06 15:47 UTC (permalink / raw)
  To: buildroot

Hello;

On Thu, Jul 6, 2017 at 11:37 AM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Hello,
>
> On Thu,  6 Jul 2017 11:23:45 -0400, Adam Duskett wrote:
>> Currently there are a few packages in buildroot that are set to not
>> be selectable unless the user wishes to use glibc specifically because
>> the package uses fts.h.
>>
>> uClibc actually does have a fts implimentation, and it's selectable in
>> uclib-menuconfig.  However; this has two issues with it:
>>
>> 1) Most users wouldn't know that there is even a uClibc-menuconfig
>> 2) Even if the user does select fts support in uClibc-menuconfig, the
>>    packages that would now compile and work would still not be selectable
>>    because they explicitly require BR2_TOOLCHAIN_USES_GLIBC.
>>
>> This patch does the following:
>>
>> - Create a BR2_TOOLCHAIN_HAS_FTS configuration option in uclibc/Config.in
>>   and automatically set the kconfig during the configure stage.
>> - when glibc is selected, BR2_TOOLCHAIN_HAS_FTS is now selected.
>>
>> This will allow for packages that require glibc only because of fts.h to now
>> depend on BR2_TOOLCHAIN_HAS_FTS instead of BR2_TOOLCHAIN_USES_GLIBC.
>>
>> Signed-off-by: Adam Duskett <aduskett@codeblue.com>
>
> What is the size impact of enabling FTS by default in uClibc-ng ?
>
Around 7.5Kb.  This might not be a bad way to go.

> Adding such an option is more complicated. Here you're doing it for the
> internal toolchain backend. But then the external toolchain backend
> would need the same option, and check whether the toolchain really has
> FTS support, etc. It's not that simple to add new options for uClibc,
> so we try to avoid doing that.
>
> What about instead migrating the SELinux stuff away from the BSD-style
> fts() interface to the POSIX compliant nftw() interface ?
>
> It would IMO make a lot more sense.
>
I read your post on the mailing list, and I took a look at the libselinux code.
It would not be trivial. Over 150 references, several functions would have to
be completely rewritten, etc etc.

It seems like the SELinux developers are against doing it themselves, and I
don't have the time to learn how to port fts reliant code to nftw, nor test it,
and then submit an upstream patch. I would love to, but time is not on my
side these days.

> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com

Thanks!
Adam

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 1/1] Add BR2_TOOLCHAIN_HAS_FTS config option
  2017-07-06 15:23 [Buildroot] [PATCH 1/1] Add BR2_TOOLCHAIN_HAS_FTS config option Adam Duskett
  2017-07-06 15:23 ` [Buildroot] [PATCH 2/2] selinux packages: change glibc check to fts check Adam Duskett
  2017-07-06 15:37 ` [Buildroot] [PATCH 1/1] Add BR2_TOOLCHAIN_HAS_FTS config option Thomas Petazzoni
@ 2017-07-06 17:18 ` Waldemar Brodkorb
  2 siblings, 0 replies; 5+ messages in thread
From: Waldemar Brodkorb @ 2017-07-06 17:18 UTC (permalink / raw)
  To: buildroot

Hi,
Adam Duskett wrote,

> Currently there are a few packages in buildroot that are set to not
> be selectable unless the user wishes to use glibc specifically because
> the package uses fts.h.
> 
> uClibc actually does have a fts implimentation, and it's selectable in
> uclib-menuconfig.  However; this has two issues with it:

Can we just enable fts by default?
That was something I was going to suggest anyway :=)
People requiring a really small uClibc-ng system, will use a custom
uClibc-ng config.

We shouldn't add a new option, we already removed most of them.

best regards
 Waldemar

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-07-06 17:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-06 15:23 [Buildroot] [PATCH 1/1] Add BR2_TOOLCHAIN_HAS_FTS config option Adam Duskett
2017-07-06 15:23 ` [Buildroot] [PATCH 2/2] selinux packages: change glibc check to fts check Adam Duskett
2017-07-06 15:37 ` [Buildroot] [PATCH 1/1] Add BR2_TOOLCHAIN_HAS_FTS config option Thomas Petazzoni
2017-07-06 15:47   ` Adam Duskett
2017-07-06 17:18 ` Waldemar Brodkorb

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox