Skip to contentSkip to conversation

package/unscd: new package

PATCH Superseded Doug Kehn 3 participants 5 messages Dec 1, 2015 – Dec 2, 2015

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Doug Kehn

author
#0 lore raw

PATCH v6 1/1 package/unscd: new package

A daemon which handles passwd, group and host lookups for running programs and caches the results for the next query. You only need this package if you are using slow Name Services like LDAP, NIS or NIS+.

This particular NSCD is a complete rewrite of the GNU glibc nscd which is a single threaded server process which offloads all NSS lookups to worker children; cache hits are handled by the parent, and only cache misses start worker children, making the parent immune to resource leaks, hangs, and crashes in NSS libraries.

It should mostly be a drop-in replacement for existing installs using nscd.

Cc Yann E. MORIN <[email protected]>
Cc Arnout Vandecappelle <[email protected]>
Cc Thomas Petazzoni <[email protected]>

---
Changes v5 -> v6
- Remove toolchain patch/BR2_GLIBC_NSCD (Thomas).
- Change source site from Debian to upstream (Thomas).
- Update to version 0.52 (Thomas).
Changes v4 -> v5
- Reincorporate $(APPLY_PATCHES) suggestion after update by Arnout.
Changes v3 -> v4
- Incorporate feedback/suggestions by Yann and Maxime.
Changes v2 -> v3
- Remove trailing '/' from UNSCD_SITE.
- Whitespace cleanup.
Changes v1 -> v2
- Incorporate feedback/suggestions by Yann (from nss-pam-ldapd patch).

---
 package/unscd/Config.in  |  8 ++++++
 package/unscd/S46unscd   | 24 ++++++++++++++++++
 package/unscd/nscd.conf  | 65 ++++++++++++++++++++++++++++++++++++++++++++++++
 package/unscd/unscd.hash |  2 ++
 package/unscd/unscd.mk   | 35 ++++++++++++++++++++++++++
 5 files changed, 134 insertions(+)
 create mode 100644 package/unscd/Config.in
 create mode 100644 package/unscd/S46unscd
 create mode 100644 package/unscd/nscd.conf
 create mode 100644 package/unscd/unscd.hash
 create mode 100644 package/unscd/unscd.mk
package/unscd/Config.in new file +8 -0
new file mode 100644
index 0000000..937aeb2
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_UNSCD
+	bool "unscd"
+	depends on BR2_TOOLCHAIN_USES_GLIBC
+	help
+	  Micro Name Service Caching Daemon
+
+comment "unscd needs an (e)glibc toolchain"
+	depends on !BR2_TOOLCHAIN_USES_GLIBC
package/unscd/S46unscd new file +24 -0
new file mode 100644
index 0000000..7d18f94
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+NAME="nscd"
+DAEMON="/usr/sbin/${NAME}"
+
+case "$1" in
+start)
+        printf "Starting ${NAME}: "
+        start-stop-daemon -S -x ${DAEMON}
+        [ $? -eq 0 ] && echo "OK" || echo "FAIL"
+        ;;
+stop)
+        printf "Stopping ${NAME}: "
+        start-stop-daemon -K -x ${DAEMON}
+        [ $? -eq 0 ] && echo "OK" || echo "FAIL"
+        ;;
+restart|reload)
+        $0 stop
+        $0 start
+        ;;
+*)
+        echo "Usage: $0 {start|stop|restart|reload}"
+        exit 1
+esac
package/unscd/nscd.conf new file +65 -0

65 lines not on this page · raw message

package/unscd/unscd.hash new file +2 -0
new file mode 100644
index 0000000..ab8ffdc
@@ -0,0 +1,2 @@
+# Locally computed:
+sha256	4c1f83dcd120469fceef749050cb29fa666fa4666bd308dfe92e933a4c200d55	nscd-0.52.c
package/unscd/unscd.mk new file +35 -0
new file mode 100644
index 0000000..87ba1bf
@@ -0,0 +1,35 @@
+################################################################################
+#
+# unscd
+#
+################################################################################
+
+UNSCD_VERSION = 0.52
+UNSCD_SOURCE = nscd-$(UNSCD_VERSION).c
+UNSCD_SITE = http://busybox.net/~vda/unscd
+UNSCD_LICENSE = GPLv2
+UNSCD_LICENSE_FILES = COPYING
+
+define UNSCD_EXTRACT_CMDS
+	cp $(DL_DIR)/$($(PKG)_SOURCE) $(@D)/nscd.c
+endef
+
+define UNSCD_BUILD_CMDS
+	$(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) nscd
+endef
+
+define UNSCD_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 755 -D $(@D)/nscd $(TARGET_DIR)/usr/sbin/nscd
+	$(INSTALL) -m 600 -D package/unscd/nscd.conf $(TARGET_DIR)/etc/nscd.conf
+endef
+
+define UNSCD_INSTALL_INIT_SYSV
+	$(INSTALL) -m 755 -D package/unscd/S46unscd \
+		$(TARGET_DIR)/etc/init.d/S46unscd
+endef
+
+define UNSCD_USERS
+	unscd -1 unscd -1 * - - - unscd user
+endef
+
+$(eval $(generic-package))
Signature · 1 line
2.6.2
#1 lore raw

PATCH v6 1/1 package/unscd: new package

Hi Doug,

Even though it's already v6 I still have some comments :-(

Quoted 4 lines · Doug Kehn

A daemon which handles passwd, group and host lookups for running programs and caches the results for the next query. You only need this package if you are using slow Name Services like LDAP, NIS or NIS+.

Quoted 8 lines

This particular NSCD is a complete rewrite of the GNU glibc nscd which is a single threaded server process which offloads all NSS lookups to worker children; cache hits are handled by the parent, and only cache misses start worker children, making the parent immune to resource leaks, hangs, and crashes in NSS libraries.

It should mostly be a drop-in replacement for existing installs using nscd.

This explanation is not really relevant for the commit log. Just keep the first
sentence. All this text should be present in the package help text, however.

It would be good however to explain in the commit log that glibc's nscd is not
installed by buildroot at the moment, and why it only works with glibc.

Quoted 19 lines
Cc Yann E. MORIN <[email protected]>
Cc Arnout Vandecappelle <[email protected]>
Cc Thomas Petazzoni <[email protected]>

---
Changes v5 -> v6
- Remove toolchain patch/BR2_GLIBC_NSCD (Thomas).
- Change source site from Debian to upstream (Thomas).
- Update to version 0.52 (Thomas).
Changes v4 -> v5
- Reincorporate $(APPLY_PATCHES) suggestion after update by Arnout.
Changes v3 -> v4
- Incorporate feedback/suggestions by Yann and Maxime.
Changes v2 -> v3
- Remove trailing '/' from UNSCD_SITE.
- Whitespace cleanup.
Changes v1 -> v2
- Incorporate feedback/suggestions by Yann (from nss-pam-ldapd patch).

Quoted 6 lines
---
 package/unscd/Config.in  |  8 ++++++
 package/unscd/S46unscd   | 24 ++++++++++++++++++
 package/unscd/nscd.conf  | 65 ++++++++++++++++++++++++++++++++++++++++++++++++
 package/unscd/unscd.hash |  2 ++
 package/unscd/unscd.mk   | 35 ++++++++++++++++++++++++++

You forgot to update package/Config.in.

Quoted 13 lines
 5 files changed, 134 insertions(+)
 create mode 100644 package/unscd/Config.in
 create mode 100644 package/unscd/S46unscd
 create mode 100644 package/unscd/nscd.conf
 create mode 100644 package/unscd/unscd.hash
 create mode 100644 package/unscd/unscd.mk
package/unscd/Config.in new file +0 -0
new file mode 100644
index 0000000..937aeb2

package/unscd/Config.in line 5

Quoted 5 lines
package/unscd/Config.in new file +5 -0
@@ -0,0 +1,8 @@
+config BR2_PACKAGE_UNSCD
+	bool "unscd"
+	depends on BR2_TOOLCHAIN_USES_GLIBC
+	help
+	  Micro Name Service Caching Daemon

So move the stuff that was in the commit log here. Don't forget to wrap it at
72 columns (where the tab+2spaces counts as 10 characters).

Also, please add an upstream URL where people can go for more info.

Quoted 3 lines
package/unscd/Config.in new file +3 -0
+
+comment "unscd needs an (e)glibc toolchain"
+	depends on !BR2_TOOLCHAIN_USES_GLIBC

[snip]

package/unscd/nscd.conf line 2

Quoted 8 lines
package/unscd/nscd.conf new file +2 -0
new file mode 100644
index 0000000..fe77d05
@@ -0,0 +1,65 @@
+# This file is currently taken verbatim from the version distributed
+# with GNU glibc's nscd with unused configurations removed

This comment should also be part of the commit message rather than being part
of this file.

Quoted 7 lines
package/unscd/nscd.conf new file +7 -0
+# 
+# /etc/nscd.conf
+#
+# An example Name Service Cache config file.  This file is needed by nscd.
+#
+# Legal entries are:
+#

package/unscd/nscd.conf line 19

Quoted 10 lines
package/unscd/nscd.conf new file +10 -0
+#	logfile			<file>
+#	debug-level		<level>
+#	threads			<initial #threads to use>
+#	max-threads		<maximum #threads to use>
+#	server-user             <user to run server as instead of root>
+#		server-user is ignored if nscd is started with -S parameters
+#       stat-user               (ignored; any user can stat)
+#	reload-count		(ignored; unscd should never crash)
+#	paranoia		(ignored)
+#	restart-interval	(ignored; unscd should never crash)

I thought you removed the unused entries? :-)

Quoted 61 lines
package/unscd/nscd.conf new file +46 -0
+#
+#       enable-cache		<service> <yes|no>
+#	positive-time-to-live	<service> <time in seconds>
+#	negative-time-to-live   <service> <time in seconds>
+#       suggested-size		<service> <prime number>
+#	check-files		<service> <yes|no>
+#	persistent		<service> (ignored)
+#	shared			<service> (ignored)
+#	auto-propagate		<service> (ignored)
+#
+# Currently supported cache names (services): passwd, group, hosts
+
+
+
+# logfile /var/log/nscd.log
+# threads 14
+# max-threads 32
+server-user unscd
+debug-level 0
+
+enable-cache            passwd  yes
+positive-time-to-live   passwd  600
+negative-time-to-live   passwd  20
+suggested-size          passwd  1001
+check-files             passwd  yes
+
+enable-cache            group   yes
+positive-time-to-live   group   3600
+negative-time-to-live   group   60
+suggested-size          group   1001
+check-files             group   yes
+
+# hosts caching is broken with gethostby* calls, hence is now disabled
+# by default. Specifically, the caching does not obey DNS TTLs, and
+# thus could lead to problems if the positive-time-to-live is
+# significantly larger than the actual TTL.
+#
+# You should really use a caching nameserver instead of nscd for this
+# sort of request. However, you can easily re-enable this by default.
+enable-cache            hosts   no
+positive-time-to-live   hosts   3600
+negative-time-to-live   hosts   20
+suggested-size	        hosts   1001
+check-files             hosts   yes
+
+# unscd does not support services caching
package/unscd/unscd.hash new file +2 -0
new file mode 100644
index 0000000..ab8ffdc
@@ -0,0 +1,2 @@
+# Locally computed:
+sha256	4c1f83dcd120469fceef749050cb29fa666fa4666bd308dfe92e933a4c200d55	nscd-0.52.c
package/unscd/unscd.mk new file +1 -0
new file mode 100644
index 0000000..87ba1bf
@@ -0,0 +1,35 @@
+################################################################################

package/unscd/unscd.mk line 11

Quoted 10 lines
package/unscd/unscd.mk new file +10 -0
+#
+# unscd
+#
+################################################################################
+
+UNSCD_VERSION = 0.52
+UNSCD_SOURCE = nscd-$(UNSCD_VERSION).c
+UNSCD_SITE = http://busybox.net/~vda/unscd
+UNSCD_LICENSE = GPLv2
+UNSCD_LICENSE_FILES = COPYING

There is just a single file, so COPYING doesn't exist. The only option we have
is nscd.c itself.

package/unscd/unscd.mk line 18

Quoted 7 lines
package/unscd/unscd.mk new file +7 -0
+
+define UNSCD_EXTRACT_CMDS
+	cp $(DL_DIR)/$($(PKG)_SOURCE) $(@D)/nscd.c
+endef
+
+define UNSCD_BUILD_CMDS
+	$(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) nscd

Although it works because of the default rules, it looks very strange to me to
call make when there is no Makefile. I would instead call the compiler directly:

	cd $(@D); \
	$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) -o nscd nscd.c

What do the others think?

Regards,
Arnout

Quoted 18 lines
package/unscd/unscd.mk new file +17 -0
+endef
+
+define UNSCD_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 755 -D $(@D)/nscd $(TARGET_DIR)/usr/sbin/nscd
+	$(INSTALL) -m 600 -D package/unscd/nscd.conf $(TARGET_DIR)/etc/nscd.conf
+endef
+
+define UNSCD_INSTALL_INIT_SYSV
+	$(INSTALL) -m 755 -D package/unscd/S46unscd \
+		$(TARGET_DIR)/etc/init.d/S46unscd
+endef
+
+define UNSCD_USERS
+	unscd -1 unscd -1 * - - - unscd user
+endef
+
+$(eval $(generic-package))
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#2 lore raw

PATCH v6 1/1 package/unscd: new package

Dear Arnout Vandecappelle,

Quoted 10 lines · Arnout Vandecappelle

package/unscd/unscd.mk line 18

Quoted 6 lines
package/unscd/unscd.mk new file +6 -0
+define UNSCD_EXTRACT_CMDS
+	cp $(DL_DIR)/$($(PKG)_SOURCE) $(@D)/nscd.c
+endef
+
+define UNSCD_BUILD_CMDS
+	$(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) nscd

Although it works because of the default rules, it looks very strange to me to
call make when there is no Makefile. I would instead call the compiler directly:

Quoted 4 lines
	cd $(@D); \
	$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) -o nscd nscd.c

What do the others think?

Fully agree with you.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

PATCH v6 1/1 package/unscd: new package

Hi Thomas and Arnout,

Quoted 14 lines · Thomas Petazzoni

Dear Arnout Vandecappelle,

Quoted 10 lines · Arnout Vandecappelle

package/unscd/unscd.mk line 18

Quoted 6 lines
package/unscd/unscd.mk new file +6 -0
+define UNSCD_EXTRACT_CMDS
+	cp $(DL_DIR)/$($(PKG)_SOURCE) $(@D)/nscd.c
+endef
+
+define UNSCD_BUILD_CMDS
+	$(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) nscd

Although it works because of the default rules, it looks very strange to me to
call make when there is no Makefile. I would instead call the compiler directly:

Quoted 6 lines
Quoted 4 lines
	cd $(@D); \
	$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) -o nscd nscd.c

What do the others think?

Fully agree with you.

I will change as suggested. For what it's worth, I was following the whetstone recipe (which is also a single source file).

Regards,
...doug

#4 lore raw

PATCH v6 1/1 package/unscd: new package

In reply to Arnout Vandecappelle

Hi Arnout, Thomas:

Quoted 15 lines · Arnout Vandecappelle

Hi Doug,

Even though it's already v6 I still have some comments :-(

Quoted 10 lines · Doug Kehn

A daemon which handles passwd, group and host lookups for running programs and caches the results for the next query. You only need this package if you are using slow Name Services like LDAP, NIS or NIS+.

This particular NSCD is a complete rewrite of the GNU glibc nscd which is a single threaded server process which offloads all NSS lookups to worker children; cache hits are handled by the parent, and only cache misses start worker children, making the parent immune to resource leaks, hangs, and crashes in NSS libraries.

Quoted 9 lines
Quoted 2 lines

It should mostly be a drop-in replacement for existing installs using nscd.

This explanation is not really relevant for the commit log. Just keep the first
sentence. All this text should be present in the package help text, however.

It would be good however to explain in the commit log that glibc's nscd is not
installed by buildroot at the moment, and why it only works with glibc.

I'm not sure if unscd, by itself, only works with glibc. Associated packages that benefit from unscd require glibc. My system is glibc based so I know this works. I'm not sure about other c-libs.

What is your suggestion here?

Regards,
...doug