[csw-devel] SF.net SVN: gar:[7539] csw/mgar/pkg/sudosh2/trunk

skayser at users.sourceforge.net skayser at users.sourceforge.net
Wed Dec 2 16:55:17 CET 2009


Revision: 7539
          http://gar.svn.sourceforge.net/gar/?rev=7539&view=rev
Author:   skayser
Date:     2009-12-02 15:55:09 +0000 (Wed, 02 Dec 2009)

Log Message:
-----------
sudosh2: modify /etc/shells on installation/removal, included file handle leak patch

Modified Paths:
--------------
    csw/mgar/pkg/sudosh2/trunk/Makefile
    csw/mgar/pkg/sudosh2/trunk/checksums
    csw/mgar/pkg/sudosh2/trunk/files/changelog.CSW

Added Paths:
-----------
    csw/mgar/pkg/sudosh2/trunk/files/004-replay-close-fds.patch
    csw/mgar/pkg/sudosh2/trunk/files/CSWsudosh2.postinstall
    csw/mgar/pkg/sudosh2/trunk/files/CSWsudosh2.postremove

Modified: csw/mgar/pkg/sudosh2/trunk/Makefile
===================================================================
--- csw/mgar/pkg/sudosh2/trunk/Makefile	2009-12-02 15:43:37 UTC (rev 7538)
+++ csw/mgar/pkg/sudosh2/trunk/Makefile	2009-12-02 15:55:09 UTC (rev 7539)
@@ -1,7 +1,6 @@
 # TODO/Issues
 # - Submit 001- (DESTDIR) and 002- (man page) patches upstream
 # - clearenvironment is not documented in sudosh.conf(5), others?
-# - add /opt/csw/bin/sudosh to /etc/shells in postinstall
 GARNAME = sudosh2
 GARVERSION = 1.0.2
 CATEGORIES = apps
@@ -21,9 +20,11 @@
   Sudosh2 is a fork of sudosh (by Douglas Hanks).
 endef
 
-MASTER_SITES = $(SF_MIRRORS)
-DISTFILES  = $(GARNAME)-$(GARVERSION).tgz
 SPKG_SOURCEURL = http://sudosh2.sf.net
+MASTER_SITES   = $(SF_MIRRORS)
+DISTFILES      = $(GARNAME)-$(GARVERSION).tgz
+DISTFILES     += CSWsudosh2.postinstall
+DISTFILES     += CSWsudosh2.postremove
 
 sysconfdir = /etc/opt/csw
 localstatedir = /var/opt/csw
@@ -56,6 +57,9 @@
 PATCHFILES += 002-strip-man-page-blank.patch
 # The binary is called sudosh (not sudosh2 - only leave sudosh2 in the title)
 PATCHFILES += 003-adjust-sudosh-man-binary-name.patch
+# sudosh-replay leaks FDs on listing sessions
+# http://sourceforge.net/tracker/?func=detail&aid=2040342&group_id=213047&atid=1024149
+PATCHFILES += 004-replay-close-fds.patch
 
 include gar/category.mk
 

Modified: csw/mgar/pkg/sudosh2/trunk/checksums
===================================================================
--- csw/mgar/pkg/sudosh2/trunk/checksums	2009-12-02 15:43:37 UTC (rev 7538)
+++ csw/mgar/pkg/sudosh2/trunk/checksums	2009-12-02 15:55:09 UTC (rev 7539)
@@ -1,4 +1,7 @@
-652d339ec04952f3d114b9aea838afc5  download/001-installsudosh.conf-destdir.patch
-9752d641a2233caf7789711ecbcd890e  download/002-strip-man-page-blank.patch
-882f7d2ddb59330350dd2d82184aff50  download/003-adjust-sudosh-man-binary-name.patch
-4c837f7739d9db780ad324ed8482e8a7  download/sudosh2-1.0.2.tgz
+652d339ec04952f3d114b9aea838afc5  001-installsudosh.conf-destdir.patch
+9752d641a2233caf7789711ecbcd890e  002-strip-man-page-blank.patch
+882f7d2ddb59330350dd2d82184aff50  003-adjust-sudosh-man-binary-name.patch
+41edfc118e6aaf191e647decee641bee  004-replay-close-fds.patch
+0b8a0b464681f636262f716d096420f6  CSWsudosh2.postinstall
+e324c66237a431004242d274fa2ad1f4  CSWsudosh2.postremove
+4c837f7739d9db780ad324ed8482e8a7  sudosh2-1.0.2.tgz

Added: csw/mgar/pkg/sudosh2/trunk/files/004-replay-close-fds.patch
===================================================================
--- csw/mgar/pkg/sudosh2/trunk/files/004-replay-close-fds.patch	                        (rev 0)
+++ csw/mgar/pkg/sudosh2/trunk/files/004-replay-close-fds.patch	2009-12-02 15:55:09 UTC (rev 7539)
@@ -0,0 +1,36 @@
+diff -uNr sudosh2-1.0.2/src/replay.c sudosh2-1.0.3/src/replay.c
+--- sudosh2-1.0.2/src/replay.c	2008-01-30 16:56:15.000000000 -0600
++++ sudosh2-1.0.3/src/replay.c	2008-04-02 10:50:38.000000000 -0500
+@@ -345,8 +345,7 @@
+ 	    fprintf(stderr,
+ 		    "[warning]: session %s is missing input information.\n",
+ 		    scan->id);
+-	else
+-	    close(scan->input.fd);
++        close(scan->input.fd);
+ 
+ 	if ((scan->script.fd = open(scan->script.str, O_RDONLY)) == -1) {
+ 	    LL();
+@@ -355,6 +354,7 @@
+ 		    scan->id);
+ 	    continue;
+ 	}
++	close(scan->script.fd);
+ 
+ 	if(!strcmp(scan->type, "interactive"))
+ 		fprintf(stdout, "%-19s %-8s %-12s %-12s %s\n", scan->date,
+@@ -469,6 +469,8 @@
+ 	fflush(stdout);
+ 	memset(read_buffer, '\0', BUFSIZ);
+     }
++    close(s_script.fd);
++    fclose(s_time.f);
+     fprintf(stderr, "[info]: EOF\n");
+     fflush(stderr);
+ }
+@@ -655,4 +657,5 @@
+     }
+ 
+     s->secs = (long) t_time;
++    fclose(s_time.f);
+ }

Added: csw/mgar/pkg/sudosh2/trunk/files/CSWsudosh2.postinstall
===================================================================
--- csw/mgar/pkg/sudosh2/trunk/files/CSWsudosh2.postinstall	                        (rev 0)
+++ csw/mgar/pkg/sudosh2/trunk/files/CSWsudosh2.postinstall	2009-12-02 15:55:09 UTC (rev 7539)
@@ -0,0 +1,52 @@
+#!/bin/sh
+PATH=/usr/bin
+export PATH
+
+SHELLS=/etc/shells
+SUDOSH=/opt/csw/bin/sudosh
+
+if [ -z "${PKG_INSTALL_ROOT}" -o "${PKG_INSTALL_ROOT}" = "/" ]
+then
+	RSHELLS=${SHELLS}
+	RSUDOSH=${SUDOSH}
+else
+	RSHELLS=${PKG_INSTALL_ROOT}${SHELLS}
+	RSUDOSH=${SUDOSH}
+fi
+
+if [ -f "${RSHELLS}" ]; then
+	echo "${RSHELLS} already exists."
+else
+	cat > ${RSHELLS} <<EOF
+# This file created by CSWsudosh2
+/bin/bash
+/bin/csh
+/bin/jsh
+/bin/ksh
+/bin/pfcsh
+/bin/pfksh
+/bin/pfsh
+/bin/sh
+/bin/tcsh
+/bin/zsh
+/sbin/jsh
+/sbin/sh
+/usr/bin/bash
+/usr/bin/csh
+/usr/bin/jsh
+/usr/bin/ksh
+/usr/bin/pfcsh
+/usr/bin/pfksh
+/usr/bin/pfsh
+/usr/bin/sh
+/usr/bin/tcsh
+/usr/bin/zsh
+EOF
+fi
+
+if /usr/bin/grep "^${RSUDOSH}" ${RSHELLS} > /dev/null 2>&1; then
+	echo "${RSHELLS} UNCHANGED because entry ${RSUDOSH} already exists."
+else
+	echo "${RSUDOSH}  # Added by CSWsudosh2" >> ${RSHELLS}
+	echo "ADDED ${RSUDOSH} to ${RSHELLS}."
+fi

Added: csw/mgar/pkg/sudosh2/trunk/files/CSWsudosh2.postremove
===================================================================
--- csw/mgar/pkg/sudosh2/trunk/files/CSWsudosh2.postremove	                        (rev 0)
+++ csw/mgar/pkg/sudosh2/trunk/files/CSWsudosh2.postremove	2009-12-02 15:55:09 UTC (rev 7539)
@@ -0,0 +1,22 @@
+#!/bin/sh
+PATH=/usr/bin
+export PATH
+
+SHELLS=/etc/shells
+SUDOSH=/opt/csw/bin/sudosh
+
+if [ -z "${PKG_INSTALL_ROOT}" -o "${PKG_INSTALL_ROOT}" = "/" ]
+then
+	RSHELLS=${SHELLS}
+	RSUDOSH=${SUDOSH}
+else
+	RSHELLS=${PKG_INSTALL_ROOT}${SHELLS}
+	RSUDOSH=${SUDOSH}
+fi
+
+if /usr/bin/grep "^${RSUDOSH}" ${RSHELLS} > /dev/null 2>&1; then
+	/usr/bin/perl -i -pwe '$_ = "" if m%^'${RSUDOSH}'%' ${RSHELLS}
+	echo "REMOVED ${RSUDOSH} from ${RSHELLS}."
+else
+	echo "${RSHELLS} UNCHANGED because it did not contain entry ${RSUDOSH}."
+fi

Modified: csw/mgar/pkg/sudosh2/trunk/files/changelog.CSW
===================================================================
--- csw/mgar/pkg/sudosh2/trunk/files/changelog.CSW	2009-12-02 15:43:37 UTC (rev 7538)
+++ csw/mgar/pkg/sudosh2/trunk/files/changelog.CSW	2009-12-02 15:55:09 UTC (rev 7539)
@@ -1,3 +1,11 @@
+sudosh2 (1.0.2,REV=2009.12.02)
+
+  * Applied file handle leak patch so that sudosh-replay doesn't run out of
+    file handles when listing sessions (#2040342 @ SF).
+  * Added postinstall/postremove scripts to include sudosh in /etc/shells
+
+ -- Sebastian Kayser <skayser at opencsw.org>  Wed,  2 Dec 2009 16:35:14 +0100
+
 sudosh2 (1.0.2,REV=2009.09.17)
 
   * Initial release.


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list