Skip to contentSkip to conversation

package/unscd: new package

PATCH Superseded Doug Kehn 3 participants 8 messages Oct 9, 2015 – Oct 13, 2015

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Doug Kehn

author
#0 lore raw

PATCH v3 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]>

---
Changes v2 -> v3
- Remove trailing '/' from UNSCD_SITE.
- Whitespace cleanup.
Changes v1 -> v2
- Incorporate feedback/suggestions by Yann (from nss-pam-ldapd patch).

---
 package/Config.in           |  1 +
 package/unscd/Config.in     |  8 +++++++
 package/unscd/S46unscd      | 24 ++++++++++++++++++++
 package/unscd/unscd.hash    |  3 +++
 package/unscd/unscd.mk      | 55 +++++++++++++++++++++++++++++++++++++++++++++
 package/unscd/unscd.service | 11 +++++++++
 6 files changed, 102 insertions(+)
 create mode 100644 package/unscd/Config.in
 create mode 100644 package/unscd/S46unscd
 create mode 100644 package/unscd/unscd.hash
 create mode 100644 package/unscd/unscd.mk
 create mode 100644 package/unscd/unscd.service
package/Config.in +1 -0
index 3794f44..a4b3b1b 100644
@@ -1520,6 +1520,7 @@ if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 	source "package/sysvinit/Config.in"
 	source "package/tar/Config.in"
 endif
+	source "package/unscd/Config.in"
 	source "package/util-linux/Config.in"
 endmenu
 
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..387ab32
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+NAME="nscd"
+DAEMON="/usr/sbin/${NAME}"
+
+case "$1" in
+start)
+        echo -n "Starting ${NAME}: "
+        start-stop-daemon -S -x ${DAEMON}
+        [ $? -eq 0 ] && echo "OK" || echo "FAIL"
+        ;;
+stop)
+        echo -n "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/unscd.hash new file +3 -0
new file mode 100644
index 0000000..f65ebda
@@ -0,0 +1,3 @@
+# From http://snapshot.debian.org/archive/debian/20150519T094547Z/pool/main/u/unscd/unscd_0.51-1.dsc
+sha256	0dbf717726e1c29af8f4ef7d2d2695e5eedb342320a730a56ae0d56fe32891f8	unscd_0.51.orig.tar.gz
+sha256	8ae16a826afd464639f6c6372fabafee5b93aea9645b3fbf23970296d4961f27	unscd_0.51-1.debian.tar.gz
package/unscd/unscd.mk new file +55 -0

55 lines not on this page · raw message

package/unscd/unscd.service new file +11 -0
new file mode 100644
index 0000000..58dd7eb
@@ -0,0 +1,11 @@
+[Unit]
+Description=Micro Name Service Caching Daemon.
+After=syslog.target network.target
+
+[Service]
+Type=forking
+PIDFile=/var/run/nscd/nscd.pid
+ExecStart=/usr/sbin/nscd
+
+[Install]
+WantedBy=multi-user.target
Signature · 1 line
2.6.1
#1 lore raw

PATCH v3 1/1 package/unscd: new package

Doug, All,

[CCing Maxime, as he knows systemd better than I do]

On 2015-10-09 09:10 -0500, Doug Kehn spake thusly:

Quoted 10 lines

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 4 lines

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

Cc Yann E. MORIN <[email protected]>

[--SNIP--]

Quoted 6 lines
package/unscd/S46unscd new file +0 -0
new file mode 100644
index 0000000..387ab32

package/unscd/S46unscd line 8

Quoted 8 lines
package/unscd/S46unscd new file +8 -0
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+NAME="nscd"
+DAEMON="/usr/sbin/${NAME}"
+
+case "$1" in
+start)
+        echo -n "Starting ${NAME}: "

We have recently readicated use of 'echo -n' and all other non-POSIX use of echo. Please, use printf instead.

[--SNIP--]

Quoted 11 lines
package/unscd/unscd.mk new file +5 -0
new file mode 100644
index 0000000..e8cccd3
@@ -0,0 +1,55 @@
+################################################################################
+#
+# unscd
+#
+################################################################################

package/unscd/unscd.mk line 15

Quoted 10 lines
package/unscd/unscd.mk new file +10 -0
+
+UNSCD_VERSION = 0.51
+UNSCD_SOURCE = unscd_$(UNSCD_VERSION).orig.tar.gz
+UNSCD_SITE = http://snapshot.debian.org/archive/debian/20150519T094547Z/pool/main/u/unscd
+UNSCD_EXTRA_DOWNLOADS = unscd_$(UNSCD_VERSION)-1.debian.tar.gz
+UNSCD_LICENSE = GPLv2
+UNSCD_LICENSE_FILES = debian/copyright
+
+define UNSCD_EXTRACT_DEBIAN
+	gzip -d -c $(BR2_DL_DIR)/$(UNSCD_EXTRA_DOWNLOADS) | tar -C $(@D) -xf -

Please use suitable-extractor, like so:

    $(call suitable-extractor,$(UNSCD_EXTRA_DOWNLOADS)) $(DL_DIR)/$(UNSCD_EXTRA_DOWNLOADS) \
    |$(TAR) xf -C $(@D) -

package/unscd/unscd.mk line 22

Quoted 7 lines
package/unscd/unscd.mk new file +7 -0
+endef
+
+UNSCD_POST_EXTRACT_HOOKS += UNSCD_EXTRACT_DEBIAN
+
+define UNSCD_APPLY_DEBIAN_PATCHES
+	for f in `grep -Ev "^#" $(@D)/debian/patches/series 2> /dev/null`; do \
+		cat "$(@D)/debian/patches/$${f}" | patch -g0 -p1 -E -d "$(@D)" -t -N; \

Please use apply-patches, like so:

    $(APPLY_PATCHES) $(@D) $(@D)/debian
Quoted 9 lines
package/unscd/unscd.mk new file +9 -0
+	done
+endef
+
+UNSCD_POST_PATCH_HOOKS += UNSCD_APPLY_DEBIAN_PATCHES
+
+define UNSCD_BUILD_CMDS
+	$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) \
+		$(@D)/nscd.c -o $(@D)/nscd
+endef

package/unscd/unscd.mk line 41

Quoted 10 lines
package/unscd/unscd.mk new file +10 -0
+
+define UNSCD_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 755 -D $(@D)/nscd $(TARGET_DIR)/usr/sbin/nscd
+	$(INSTALL) -m 600 -D $(@D)/debian/nscd.conf $(TARGET_DIR)/etc/nscd.conf
+endef
+
+define UNSCD_INSTALL_INIT_SYSTEMD
+	$(INSTALL) -m 755 -D package/unscd/unscd.service \
+		$(TARGET_DIR)/usr/lib/systemd/system/unscd.service
+	mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants

Not that it matters a lot, but I think using $(INSTALL) to create directories should be favoured, like so:

    $(INSTALL) -d $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants

package/unscd/unscd.mk line 44

Quoted 3 lines
package/unscd/unscd.mk new file +3 -0
+	ln -fs ../../../../usr/lib/systemd/system/unscd.service \
+		$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/unscd.service
+endef

[--SNIP--]

Quoted 7 lines
package/unscd/unscd.service new file +1 -0
new file mode 100644
index 0000000..58dd7eb
@@ -0,0 +1,11 @@
+[Unit]

package/unscd/unscd.service line 11

Quoted 10 lines
package/unscd/unscd.service new file +10 -0
+Description=Micro Name Service Caching Daemon.
+After=syslog.target network.target
+
+[Service]
+Type=forking
+PIDFile=/var/run/nscd/nscd.pid
+ExecStart=/usr/sbin/nscd
+
+[Install]
+WantedBy=multi-user.target

Maxime, what's your opinion on this systemd unit?

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH v3 1/1 package/unscd: new package

Hello Doug, Yann, all

Quoted 115 lines · Yann E. MORIN

Doug, All,

[CCing Maxime, as he knows systemd better than I do]

On 2015-10-09 09:10 -0500, Doug Kehn spake thusly:

Quoted 1 line

A daemon which handles passwd, group and host lookups for running

programs and

Quoted 1 line

caches the results for the next query. You only need this package if you

are

Quoted 3 lines

using slow Name Services like LDAP, NIS or NIS+.

This particular NSCD is a complete rewrite of the GNU glibc nscd which

is a

Quoted 2 lines

single threaded server process which offloads all NSS lookups to worker children; cache hits are handled by the parent, and only cache misses

start

Quoted 1 line

worker children, making the parent immune to resource leaks, hangs, and

crashes

Quoted 3 lines

in NSS libraries.

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

nscd.

Quoted 3 lines
Cc Yann E. MORIN <[email protected]>

[--SNIP--]

Quoted 6 lines
package/unscd/S46unscd new file +0 -0
new file mode 100644
index 0000000..387ab32

package/unscd/S46unscd line 8

Quoted 8 lines
package/unscd/S46unscd new file +8 -0
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+NAME="nscd"
+DAEMON="/usr/sbin/${NAME}"
+
+case "$1" in
+start)
+        echo -n "Starting ${NAME}: "

We have recently readicated use of 'echo -n' and all other non-POSIX use of echo. Please, use printf instead.

[--SNIP--]

package/unscd/unscd.mk

Quoted 7 lines
package/unscd/unscd.mk new file +0 -0
new file mode 100644
index 0000000..e8cccd3
@@ -0,0 +1,55 @@

+################################################################################

package/unscd/unscd.mk line 4

Quoted 4 lines
package/unscd/unscd.mk new file +3 -0
+#
+# unscd
+#

+################################################################################

package/unscd/unscd.mk

Quoted 4 lines
package/unscd/unscd.mk new file +4 -0
+
+UNSCD_VERSION = 0.51
+UNSCD_SOURCE = unscd_$(UNSCD_VERSION).orig.tar.gz
+UNSCD_SITE =

http://snapshot.debian.org/archive/debian/20150519T094547Z/pool/main/u/unscd

package/unscd/unscd.mk

Quoted 6 lines
package/unscd/unscd.mk new file +6 -0
+UNSCD_EXTRA_DOWNLOADS = unscd_$(UNSCD_VERSION)-1.debian.tar.gz
+UNSCD_LICENSE = GPLv2
+UNSCD_LICENSE_FILES = debian/copyright
+
+define UNSCD_EXTRACT_DEBIAN
+     gzip -d -c $(BR2_DL_DIR)/$(UNSCD_EXTRA_DOWNLOADS) | tar -C $(@D)

-xf -

Please use suitable-extractor, like so:

    $(call suitable-extractor,$(UNSCD_EXTRA_DOWNLOADS))
$(DL_DIR)/$(UNSCD_EXTRA_DOWNLOADS) \
    |$(TAR) xf -C $(@D) -

package/unscd/unscd.mk

Quoted 6 lines
package/unscd/unscd.mk new file +6 -0
+endef
+
+UNSCD_POST_EXTRACT_HOOKS += UNSCD_EXTRACT_DEBIAN
+
+define UNSCD_APPLY_DEBIAN_PATCHES
+     for f in `grep -Ev "^#" $(@D)/debian/patches/series 2> /dev/null`;

do \

package/unscd/unscd.mk line 20

Quoted 1 line
package/unscd/unscd.mk new file +1 -0
+             cat "$(@D)/debian/patches/$${f}" | patch -g0 -p1 -E -d

"$(@D)" -t -N; \

Please use apply-patches, like so:

    $(APPLY_PATCHES) $(@D) $(@D)/debian

package/unscd/unscd.mk

Quoted 13 lines
package/unscd/unscd.mk new file +13 -0
+     done
+endef
+
+UNSCD_POST_PATCH_HOOKS += UNSCD_APPLY_DEBIAN_PATCHES
+
+define UNSCD_BUILD_CMDS
+     $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) \
+             $(@D)/nscd.c -o $(@D)/nscd
+endef
+
+define UNSCD_INSTALL_TARGET_CMDS
+     $(INSTALL) -m 755 -D $(@D)/nscd $(TARGET_DIR)/usr/sbin/nscd
+     $(INSTALL) -m 600 -D $(@D)/debian/nscd.conf

$(TARGET_DIR)/etc/nscd.conf

package/unscd/unscd.mk line 41

Quoted 6 lines
package/unscd/unscd.mk new file +6 -0
+endef
+
+define UNSCD_INSTALL_INIT_SYSTEMD
+     $(INSTALL) -m 755 -D package/unscd/unscd.service \
+             $(TARGET_DIR)/usr/lib/systemd/system/unscd.service
+     mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants

Not that it matters a lot, but I think using $(INSTALL) to create directories should be favoured, like so:

Quoted 2 lines
    $(INSTALL) -d $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants

At the moment, I think all the packages that install systemd are using mkdir -p, so I would keep that so it's coherent, as said in another mail, a helper is needed to simplify theses few lines.

Quoted 17 lines

package/unscd/unscd.mk line 41

Quoted 3 lines
package/unscd/unscd.mk new file +2 -0
+     ln -fs ../../../../usr/lib/systemd/system/unscd.service \
+

$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/unscd.service

package/unscd/unscd.mk line 42

Quoted 1 line
package/unscd/unscd.mk new file +1 -0
+endef

[--SNIP--]

Quoted 11 lines
package/unscd/unscd.service new file +5 -0
new file mode 100644
index 0000000..58dd7eb
@@ -0,0 +1,11 @@
+[Unit]
+Description=Micro Name Service Caching Daemon.
+After=syslog.target network.target
+
+[Service]
Quoted 9 lines

package/unscd/unscd.service line 11

Quoted 6 lines
package/unscd/unscd.service new file +6 -0
+Type=forking
+PIDFile=/var/run/nscd/nscd.pid
+ExecStart=/usr/sbin/nscd
+
+[Install]
+WantedBy=multi-user.target

Maxime, what's your opinion on this systemd unit?

nscd is a part of glibc, and looking at the code of glibc 2.22, the startup script and systemd init file are included in the source. So I have a few questions:

Why is this not a part of the glibc package as an option ?

And I think, we should use the service and init scripts given by upstream, unless they cause real trouble with a BR rootfs. And since we handle many versions of glibc, maybe extract them from the latests versions and simply install them.
For the systemd part, there's much more than the initial service it seems, from the source I found:

nscd.service and nscd.tmpfiles which will create the /run/nscd directory with the correct ACL, which doesn't seem to be done by your init script but it's done by the shipped init script

Quoted 16 lines

Regards,
Yann E. MORIN.

--

.-----------------.--------------------.------------------.--------------------.

|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics'
conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___
     |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There
is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v
 conspiracy.  |
Quoted 2 lines

'------------------------------^-------^------------------^--------------------'

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20151012/6d974da7/attachment.html>

#3 lore raw

PATCH v3 1/1 package/unscd: new package

Hi Maxime, All,

Quoted 152 lines · Maxime Hadjinlian

Hello Doug, Yann, all

Quoted 115 lines · Yann E. MORIN

Doug, All,

[CCing Maxime, as he knows systemd better than I do]

On 2015-10-09 09:10 -0500, Doug Kehn spake thusly:

Quoted 1 line

A daemon which handles passwd, group and host lookups for running

programs and

Quoted 1 line

caches the results for the next query. You only need this package if you

are

Quoted 3 lines

using slow Name Services like LDAP, NIS or NIS+.

This particular NSCD is a complete rewrite of the GNU glibc nscd which

is a

Quoted 2 lines

single threaded server process which offloads all NSS lookups to worker children; cache hits are handled by the parent, and only cache misses

start

Quoted 1 line

worker children, making the parent immune to resource leaks, hangs, and

crashes

Quoted 3 lines

in NSS libraries.

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

nscd.

Quoted 3 lines
Cc Yann E. MORIN <[email protected]>

[--SNIP--]

Quoted 6 lines
package/unscd/S46unscd new file +0 -0
new file mode 100644
index 0000000..387ab32

package/unscd/S46unscd line 8

Quoted 8 lines
package/unscd/S46unscd new file +8 -0
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+NAME="nscd"
+DAEMON="/usr/sbin/${NAME}"
+
+case "$1" in
+start)
+        echo -n "Starting ${NAME}: "

We have recently readicated use of 'echo -n' and all other non-POSIX use of echo. Please, use printf instead.

[--SNIP--]

package/unscd/unscd.mk

Quoted 7 lines
package/unscd/unscd.mk new file +0 -0
new file mode 100644
index 0000000..e8cccd3
@@ -0,0 +1,55 @@

+################################################################################

package/unscd/unscd.mk line 4

Quoted 4 lines
package/unscd/unscd.mk new file +3 -0
+#
+# unscd
+#

+################################################################################

package/unscd/unscd.mk

Quoted 4 lines
package/unscd/unscd.mk new file +4 -0
+
+UNSCD_VERSION = 0.51
+UNSCD_SOURCE = unscd_$(UNSCD_VERSION).orig.tar.gz
+UNSCD_SITE =

http://snapshot.debian.org/archive/debian/20150519T094547Z/pool/main/u/unscd

package/unscd/unscd.mk

Quoted 6 lines
package/unscd/unscd.mk new file +6 -0
+UNSCD_EXTRA_DOWNLOADS = unscd_$(UNSCD_VERSION)-1.debian.tar.gz
+UNSCD_LICENSE = GPLv2
+UNSCD_LICENSE_FILES = debian/copyright
+
+define UNSCD_EXTRACT_DEBIAN
+     gzip -d -c $(BR2_DL_DIR)/$(UNSCD_EXTRA_DOWNLOADS) | tar -C $(@D)

-xf -

Please use suitable-extractor, like so:

    $(call suitable-extractor,$(UNSCD_EXTRA_DOWNLOADS))
$(DL_DIR)/$(UNSCD_EXTRA_DOWNLOADS) \
    |$(TAR) xf -C $(@D) -

package/unscd/unscd.mk

Quoted 6 lines
package/unscd/unscd.mk new file +6 -0
+endef
+
+UNSCD_POST_EXTRACT_HOOKS += UNSCD_EXTRACT_DEBIAN
+
+define UNSCD_APPLY_DEBIAN_PATCHES
+     for f in `grep -Ev "^#" $(@D)/debian/patches/series 2> /dev/null`;

do \

package/unscd/unscd.mk line 20

Quoted 1 line
package/unscd/unscd.mk new file +1 -0
+             cat "$(@D)/debian/patches/$${f}" | patch -g0 -p1 -E -d

"$(@D)" -t -N; \

Please use apply-patches, like so:

    $(APPLY_PATCHES) $(@D) $(@D)/debian

package/unscd/unscd.mk

Quoted 13 lines
package/unscd/unscd.mk new file +13 -0
+     done
+endef
+
+UNSCD_POST_PATCH_HOOKS += UNSCD_APPLY_DEBIAN_PATCHES
+
+define UNSCD_BUILD_CMDS
+     $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) \
+             $(@D)/nscd.c -o $(@D)/nscd
+endef
+
+define UNSCD_INSTALL_TARGET_CMDS
+     $(INSTALL) -m 755 -D $(@D)/nscd $(TARGET_DIR)/usr/sbin/nscd
+     $(INSTALL) -m 600 -D $(@D)/debian/nscd.conf

$(TARGET_DIR)/etc/nscd.conf

package/unscd/unscd.mk line 41

Quoted 6 lines
package/unscd/unscd.mk new file +6 -0
+endef
+
+define UNSCD_INSTALL_INIT_SYSTEMD
+     $(INSTALL) -m 755 -D package/unscd/unscd.service \
+             $(TARGET_DIR)/usr/lib/systemd/system/unscd.service
+     mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants

Not that it matters a lot, but I think using $(INSTALL) to create directories should be favoured, like so:

Quoted 2 lines
    $(INSTALL) -d $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants

At the moment, I think all the packages that install systemd are using mkdir -p, so I would keep that so it's coherent, as said in another mail, a helper is needed to simplify theses few lines.

Quoted 17 lines

package/unscd/unscd.mk line 41

Quoted 3 lines
package/unscd/unscd.mk new file +2 -0
+     ln -fs ../../../../usr/lib/systemd/system/unscd.service \
+

$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/unscd.service

package/unscd/unscd.mk line 42

Quoted 1 line
package/unscd/unscd.mk new file +1 -0
+endef

[--SNIP--]

Quoted 11 lines
package/unscd/unscd.service new file +5 -0
new file mode 100644
index 0000000..58dd7eb
@@ -0,0 +1,11 @@
+[Unit]
+Description=Micro Name Service Caching Daemon.
+After=syslog.target network.target
+
+[Service]
Quoted 9 lines

package/unscd/unscd.service line 11

Quoted 6 lines
package/unscd/unscd.service new file +6 -0
+Type=forking
+PIDFile=/var/run/nscd/nscd.pid
+ExecStart=/usr/sbin/nscd
+
+[Install]
+WantedBy=multi-user.target

Maxime, what's your opinion on this systemd unit?

Quoted 5 lines

nscd is a part of glibc, and looking at the code of glibc 2.22, the startup script and systemd init file are included in the source. So I have a few questions:

Why is this not a part of the glibc package as an option ?

... good point.

I see glibc nscd (I'm using glibc 2.21) is built but not installed. Is the suggestion to add a nscd configuration option to glibc for native nscd or unscd?

If unscd is selected, only glibc nscd support files will be installed.

Quoted 5 lines

And I think, we should use the service and init scripts given by upstream, unless they cause real trouble with a BR rootfs. And since we handle many versions of glibc, maybe extract them from the latests versions and simply install them.

I will test the glibc init script with unscd to see if there are any issues.

Would using the 'selected' glibc version, versus latest version, of the support files be okay here?

Quoted 6 lines

For the systemd part, there's much more than the initial service it seems, from the source I found:

nscd.service and nscd.tmpfiles which will create the /run/nscd directory with the correct ACL, which doesn't seem to be done by your init script but it's done by the shipped init script

I will see what I can do with respect to systemd support.

Regards,
...doug

#4 lore raw

PATCH v3 1/1 package/unscd: new package

Doug, MAxime, All,

On 2015-10-12 09:35 -0500, rdkehn at yahoo.com spake thusly:

Quoted 1 line · Maxime Hadjinlian

[--SNIP--]

Quoted 6 lines
Quoted 5 lines

nscd is a part of glibc, and looking at the code of glibc 2.22, the startup script and systemd init file are included in the source. So I have a few questions:

Why is this not a part of the glibc package as an option ?

Quoted 8 lines

... good point.

I see glibc nscd (I'm using glibc 2.21) is built but not installed. Is the suggestion to add a nscd configuration option to glibc for native nscd or unscd?

If unscd is selected, only glibc nscd support files will be installed.

I would well see something along the lines of:

- in toolchain/toolchain-common/in, add this:

config BR2_GLIBC_NSCD
bool "Install nscd"
depends on BR2_TOOLCHAIN_USES_GLIBC

- in package/unscd/Cofnig.in:

config BR2_PACKAGE_UNSCD
bool "unscd"
depends on BR2_TOOLCHAIN_USES_GLIBC
depends on !BR2_GLIBC_NSCD
help
unscd is a blabla replacement blabla...

http://example.net/home/of/unscd

comment "unscd needs an (e)glibc toolchain"
depends on !BR2_TOOLCHAIN_USES_GLIBC

Note that we do not make BR2_GLIBC_NSCD an option of the glibc package, because we also want to handle external toolchains. So it has to be a toolchain option, not a package option.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

PATCH v3 1/1 package/unscd: new package

In reply to Maxime Hadjinlian

Maxime, All,

On 2015-10-12 10:34 +0200, Maxime Hadjinlian spake thusly:

Quoted 13 lines
Quoted 11 lines · Yann E. MORIN

On 2015-10-09 09:10 -0500, Doug Kehn spake thusly:

Quoted 1 line

A daemon which handles passwd, group and host lookups for running

programs and

Quoted 1 line

caches the results for the next query. You only need this package if you

are

Quoted 3 lines

using slow Name Services like LDAP, NIS or NIS+.

This particular NSCD is a complete rewrite of the GNU glibc nscd which

is a

Quoted 2 lines

single threaded server process which offloads all NSS lookups to worker children; cache hits are handled by the parent, and only cache misses

Quoted 7 lines
Quoted 7 lines

start

Quoted 1 line

worker children, making the parent immune to resource leaks, hangs, and

crashes

Quoted 3 lines

in NSS libraries.

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

nscd.

[--SNIP--]

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
package/unscd/unscd.mk new file +4 -0
+define UNSCD_INSTALL_INIT_SYSTEMD
+     $(INSTALL) -m 755 -D package/unscd/unscd.service \
+             $(TARGET_DIR)/usr/lib/systemd/system/unscd.service
+     mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
Quoted 8 lines
Quoted 5 lines

Not that it matters a lot, but I think using $(INSTALL) to create directories should be favoured, like so:

    $(INSTALL) -d $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants

At the moment, I think all the packages that install systemd are using mkdir -p, so I would keep that so it's coherent, as said in another mail, a helper is needed to simplify theses few lines.

Valid point. Consistence trumps beauty. ;-)

Quoted 25 lines
Quoted 16 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+     ln -fs ../../../../usr/lib/systemd/system/unscd.service \
+

$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/unscd.service

Quoted 1 line

+endef

[--SNIP--]

Quoted 11 lines
package/unscd/unscd.service new file +5 -0
new file mode 100644
index 0000000..58dd7eb
@@ -0,0 +1,11 @@
+[Unit]
+Description=Micro Name Service Caching Daemon.
+After=syslog.target network.target
+
+[Service]
Quoted 9 lines

package/unscd/unscd.service line 11

Quoted 6 lines
package/unscd/unscd.service new file +6 -0
+Type=forking
+PIDFile=/var/run/nscd/nscd.pid
+ExecStart=/usr/sbin/nscd
+
+[Install]
+WantedBy=multi-user.target

Maxime, what's your opinion on this systemd unit?

Quoted 5 lines

nscd is a part of glibc, and looking at the code of glibc 2.22, the startup script and systemd init file are included in the source. So I have a few questions:

Why is this not a part of the glibc package as an option ?

From what I understood, this unscd is a complete *rewrite* of glibc's nscd.

Where unscd shines is that it can resolve queries in parallel as it spawns a thread for each query that it has not yet cached, whereas glibc's nscd is single-threaded, thus serialising uncached queries.

Thus, unscd should be overall "faster" at resolving queries than glibc's nscd would be.

So, no, unscd is not part of glibc. nscd is, and we could indeed add an option to install it, of course. But that does not prevent unscd to also be oferred as a replacement.

Quoted 2 lines

And I think, we should use the service and init scripts given by upstream, unless they cause real trouble with a BR rootfs.

I think you meant "we should *not* use the service and init scripts given by upstream", no?

Quoted 9 lines

And since we handle many
versions of glibc, maybe extract them from the latests versions and simply install them.
For the systemd part, there's much more than the initial service it seems, from the source I found:

nscd.service and nscd.tmpfiles which will create the /run/nscd directory with the correct ACL, which doesn't seem to be done by your init script but it's done by the shipped init script

So, if I udnerstand you correctly, the systemd units are fine, but the startup script is missign some pieces, right?

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#6 lore raw

PATCH v3 1/1 package/unscd: new package

Maxime, All,

On 2015-10-12 18:34 +0200, Yann E. MORIN spake thusly:

Quoted 2 lines

On 2015-10-12 10:34 +0200, Maxime Hadjinlian spake thusly:

Quoted 1 line

On Sat, Oct 10, 2015 at 4:50 PM, Yann E. MORIN <[email protected]>

[--SNIP--]

Quoted 5 lines
Quoted 2 lines

And I think, we should use the service and init scripts given by upstream, unless they cause real trouble with a BR rootfs.

I think you meant "we should *not* use the service and init scripts given by upstream", no?

Forget that comment. I misread "unless" as "because".

So, I agree with you.

Sorry for the noise...

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#7 lore raw

PATCH v3 1/1 package/unscd: new package

In reply to Yann E. MORIN
Quoted 14 lines · Yann E. MORIN

Maxime, All,

On 2015-10-12 10:34 +0200, Maxime Hadjinlian spake thusly:

Quoted 6 lines
Quoted 4 lines · Yann E. MORIN

On 2015-10-09 09:10 -0500, Doug Kehn spake thusly:

Quoted 1 line

A daemon which handles passwd, group and host lookups for running

programs and

Quoted 1 line

caches the results for the next query. You only need this package if

you

Quoted 4 lines
Quoted 4 lines

are

Quoted 3 lines

using slow Name Services like LDAP, NIS or NIS+.

This particular NSCD is a complete rewrite of the GNU glibc nscd

Quoted 13 lines

which

Quoted 2 lines
Quoted 2 lines

is a

Quoted 1 line

single threaded server process which offloads all NSS lookups to

worker

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

children; cache hits are handled by the parent, and only cache misses

start

Quoted 1 line

worker children, making the parent immune to resource leaks, hangs,

and

Quoted 5 lines
Quoted 5 lines

crashes

Quoted 3 lines

in NSS libraries.

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

nscd.

[--SNIP--]

Quoted 14 lines
Quoted 1 line

nscd is a part of glibc, and looking at the code of glibc 2.22, the

startup

Quoted 4 lines

script and systemd init file are included in the source. So I have a few questions:

Why is this not a part of the glibc package as an option ?

From what I understood, this unscd is a complete *rewrite* of glibc's nscd.

Where unscd shines is that it can resolve queries in parallel as it spawns a thread for each query that it has not yet cached, whereas glibc's nscd is single-threaded, thus serialising uncached queries.

Quoted 7 lines

Thus, unscd should be overall "faster" at resolving queries than glibc's nscd would be.

So, no, unscd is not part of glibc. nscd is, and we could indeed add an option to install it, of course. But that does not prevent unscd to also be oferred as a replacement.

Indeed, I misread the name of the package (and with it the intent of the patch), and so I agree with you, that was a bad idea.

Quoted 9 lines
Quoted 3 lines

nscd.service and nscd.tmpfiles which will create the /run/nscd directory with the correct ACL, which doesn't seem to be done by your init script

but

Quoted 1 line

it's done by the shipped init script

So, if I udnerstand you correctly, the systemd units are fine, but the startup script is missign some pieces, right?

No, both are missing pieces, that's why I think we should use upstream files since they should know what they are doing :).

Quoted 16 lines

Regards,
Yann E. MORIN.

--

.-----------------.--------------------.------------------.--------------------.

|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics'
conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___
     |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There
is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v
 conspiracy.  |
Quoted 2 lines

'------------------------------^-------^------------------^--------------------'

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20151013/50d5391a/attachment.html>