Bug 146624 - net-nds/portmap needs RDEPEND debianutils
Bug#: 146624 Product:  Gentoo Linux Version: unspecified Platform: All
OS/Version: Other Status: RESOLVED Severity: minor Priority: P2
Resolution: FIXED Assigned To: net-fs@gentoo.org Reported By: stefan@the2masters.de
Component: Ebuilds
URL: 
Summary: net-nds/portmap needs RDEPEND debianutils
Keywords:  
Status Whiteboard: 
Opened: 2006-09-06 17:50 0000
Description:   Opened: 2006-09-06 17:50 0000
/etc/init.d/portmap uses the tool mktemp in restart(). mktemp is provided by
sys-apps/debianutils, but debianutils isn't in the RDEPDENDS of portmap
(debianutils is part of system, maybe it's not needed?). I don't know how
important the mktemp-stuff in /etc/init.d/portmap is, maybe it can be omitted?

debianutils provides useless things for a embedded system, I searched for
occurrences on the whole system, so that I can eventually unmerge it.

------- Comment #1 From Jakub Moc (RETIRED) 2006-09-07 00:21:37 0000 -------
Well, as said, sys-apps/debianutils is already part of system... There's
sys-apps/mktemp but it depends on debianutils (unstable version) so it won't
help you much w/ cleaning up your system. :P

------- Comment #2 From Stefan Hellermann 2006-09-07 04:20:00 0000 -------
But is the mktemp even needed? It saves the portmapper's table, but when you
restart portmap, every user of portmap is stopped and restarted again (unless
you're running proprietary software without init.d scripts). So I would say
it's not needed to save and restore the table state, or it could be done
optionally with a conf.d/portmap variable?

Here's my solution doing it optional:

# diff -u init.d/portmap.old init.d/portmap
--- init.d/portmap.old  2006-09-07 13:07:06.000000000 +0200
+++ init.d/portmap      2006-09-07 13:13:16.000000000 +0200
@@ -27,19 +27,21 @@
 }

 restart() {
-       # Dump the portmapper's table before stopping
-       ebegin "Saving portmap table"
-       local tmpfile=`mktemp /tmp/pmap_table.XXXXXX`
-       [ -n "$tmpfile" ] && pmap_dump >$tmpfile
-       eend $? "Error saving portmap table."
+       if [[ ${SAVE_ON_RESTART} == "yes" ]] ; then
+               # Dump the portmapper's table before stopping
+               ebegin "Saving portmap table"
+               local tmpfile=`mktemp /tmp/pmap_table.XXXXXX`
+               [ -n "$tmpfile" ] && pmap_dump >$tmpfile
+               eend $? "Error saving portmap table."
+       fi

        # Stop and restart portmapper
        svc_stop
        sleep 1
        svc_start

-       # Reload the portmapper's table
-       if [ -n "$tmpfile" ]; then
+       if [[ ${SAVE_ON_RESTART} == "yes" && -n "$tmpfile" ]] ; then
+               # Reload the portmapper's table
                ebegin "Reloading portmap table"
                pmap_set <$tmpfile
                eend $? "Error reloading portmap table."

# diff -u conf.d/portmap.old conf.d/portmap
--- conf.d/portmap.old  2006-09-07 13:07:54.000000000 +0200
+++ conf.d/portmap      2006-09-07 13:09:35.000000000 +0200
@@ -4,3 +4,6 @@

 # Listen on localhost only by default
 #PORTMAP_OPTS="-l"
+
+# Save the portmapper's table during restarts?
+SAVE_ON_RESTART="no"

------- Comment #3 From SpanKY 2006-09-09 01:28:01 0000 -------
fixed by not using mktemp nor any tempfile ;)

------- Comment #4 From Stefan Hellermann 2006-09-09 05:34:02 0000 -------
Haven't thought about such a simple solution! Thanks a lot!