aboutsummaryrefslogtreecommitdiff
path: root/security/pssh
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2007-07-06 20:30:24 +0000
committerBrooks Davis <brooks@FreeBSD.org>2007-07-06 20:30:24 +0000
commita4694ad9134d41527fe7e1bd16a28f0e0c097b56 (patch)
tree5c867017fa9bafd1af805e6f9129d018739630ce /security/pssh
parent6686ae02cc504d727dcaebf12fcea1dfcc84de48 (diff)
downloadports-a4694ad9134d41527fe7e1bd16a28f0e0c097b56.tar.gz
ports-a4694ad9134d41527fe7e1bd16a28f0e0c097b56.zip
Fix a couple bugs and remove the IGNORE variable:
- select can be interrupted and return EINTR so we need to loop around it while it does so rather than treating it as a fatal error. - all process creations are matched with a wait() so having a SIGCHLD handler that performs a wait(-1) is pointless and racy. We tend to loose the race over half the time and as a result were reporting successful processes as failed. Add a couple features: - Skip commented lines in the host specification. - Allow '-' as an alias for stdin in the host file specification.
Notes
Notes: svn path=/head/; revision=195101
Diffstat (limited to 'security/pssh')
-rw-r--r--security/pssh/Makefile3
-rw-r--r--security/pssh/files/patch-bin_pnuke19
-rw-r--r--security/pssh/files/patch-bin_prsync18
-rw-r--r--security/pssh/files/patch-bin_pscp18
-rw-r--r--security/pssh/files/patch-bin_pslurp18
-rw-r--r--security/pssh/files/patch-bin_pssh19
-rw-r--r--security/pssh/files/patch-psshlib_basethread.py28
-rw-r--r--security/pssh/files/patch-psshlib_psshutil.py43
8 files changed, 164 insertions, 2 deletions
diff --git a/security/pssh/Makefile b/security/pssh/Makefile
index d7c2fb597d2b..e3a4d8daf00c 100644
--- a/security/pssh/Makefile
+++ b/security/pssh/Makefile
@@ -7,6 +7,7 @@
PORTNAME= pssh
PORTVERSION= 1.3.1
+PORTREVISION= 1
CATEGORIES= security net sysutils
MASTER_SITES= http://www.theether.org/pssh/ \
${MASTER_SITE_LOCAL}
@@ -19,8 +20,6 @@ BUILD_DEPENDS= easy_install:${PORTSDIR}/devel/py-setuptools
RUN_DEPENDS= easy_install:${PORTSDIR}/devel/py-setuptools \
rsync:${PORTSDIR}/net/rsync
-IGNORE= most connections fail with bogus error
-
USE_PYTHON= YES
USE_PYDISTUTILS=yes
diff --git a/security/pssh/files/patch-bin_pnuke b/security/pssh/files/patch-bin_pnuke
new file mode 100644
index 000000000000..a209aa6fba0a
--- /dev/null
+++ b/security/pssh/files/patch-bin_pnuke
@@ -0,0 +1,19 @@
+
+$FreeBSD$
+
+--- bin/pnuke.orig
++++ bin/pnuke
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/local/bin/python
+ # -*- Mode: python -*-
+ #
+ # Usage: pnuke [OPTIONS] -h hosts.txt pattern
+@@ -123,7 +123,6 @@
+ cmdline = " ".join(args)
+ hosts, ports, users = psshutil.read_hosts(flags["hosts"])
+ psshutil.patch_users(hosts, ports, users, flags["user"])
+- signal.signal(signal.SIGCHLD, psshutil.reaper)
+ os.setpgid(0, 0)
+ do_pnuke(hosts, ports, users, pattern, flags)
+
diff --git a/security/pssh/files/patch-bin_prsync b/security/pssh/files/patch-bin_prsync
new file mode 100644
index 000000000000..8a6ea33f70fc
--- /dev/null
+++ b/security/pssh/files/patch-bin_prsync
@@ -0,0 +1,18 @@
+
+$FreeBSD$
+
+--- bin/prsync.orig
++++ bin/prsync
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/local/bin/python
+ # -*- Mode: python -*-
+ #
+ # Usage: prsync [OPTIONS] -h hosts.txt local remote
+@@ -141,6 +141,5 @@
+ sys.exit(3)
+ hosts, ports, users = psshutil.read_hosts(flags["hosts"])
+ psshutil.patch_users(hosts, ports, users, flags["user"])
+- signal.signal(signal.SIGCHLD, psshutil.reaper)
+ os.setpgid(0, 0)
+ do_prsync(hosts, ports, users, local, remote, flags)
diff --git a/security/pssh/files/patch-bin_pscp b/security/pssh/files/patch-bin_pscp
new file mode 100644
index 000000000000..758d1e4eaa58
--- /dev/null
+++ b/security/pssh/files/patch-bin_pscp
@@ -0,0 +1,18 @@
+
+$FreeBSD$
+
+--- bin/pscp.orig
++++ bin/pscp
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/local/bin/python
+ # -*- Mode: python -*-
+ #
+ # Usage: pscp [OPTIONS] -h hosts.txt local remote
+@@ -132,6 +132,5 @@
+ sys.exit(3)
+ hosts, ports, users = psshutil.read_hosts(flags["hosts"])
+ psshutil.patch_users(hosts, ports, users, flags["user"])
+- signal.signal(signal.SIGCHLD, psshutil.reaper)
+ os.setpgid(0, 0)
+ do_pscp(hosts, ports, users, local, remote, flags)
diff --git a/security/pssh/files/patch-bin_pslurp b/security/pssh/files/patch-bin_pslurp
new file mode 100644
index 000000000000..b53f4eba0cd5
--- /dev/null
+++ b/security/pssh/files/patch-bin_pslurp
@@ -0,0 +1,18 @@
+
+$FreeBSD$
+
+--- bin/pslurp.orig
++++ bin/pslurp
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/local/bin/python
+ # -*- Mode: python -*-
+ #
+ # Usage: pslurp [OPTIONS] -h hosts.txt -o outdir remote local
+@@ -145,6 +145,5 @@
+ sys.exit(3)
+ hosts, ports, users = psshutil.read_hosts(flags["hosts"])
+ psshutil.patch_users(hosts, ports, users, flags["user"])
+- signal.signal(signal.SIGCHLD, psshutil.reaper)
+ os.setpgid(0, 0)
+ do_pslurp(hosts, ports, users, remote, local, flags)
diff --git a/security/pssh/files/patch-bin_pssh b/security/pssh/files/patch-bin_pssh
new file mode 100644
index 000000000000..a05010b2ca86
--- /dev/null
+++ b/security/pssh/files/patch-bin_pssh
@@ -0,0 +1,19 @@
+
+$FreeBSD$
+
+--- bin/pssh.orig
++++ bin/pssh
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/local/bin/python
+ # -*- Mode: python -*-
+ #
+ # Usage: pssh [OPTIONS] -h hosts.txt prog [arg0] [arg1] ..
+@@ -141,7 +141,6 @@
+ cmdline = " ".join(args)
+ hosts, ports, users = psshutil.read_hosts(flags["hosts"])
+ psshutil.patch_users(hosts, ports, users, flags["user"])
+- signal.signal(signal.SIGCHLD, psshutil.reaper)
+ os.setpgid(0, 0)
+ do_pssh(hosts, ports, users, cmdline, flags)
+
diff --git a/security/pssh/files/patch-psshlib_basethread.py b/security/pssh/files/patch-psshlib_basethread.py
new file mode 100644
index 000000000000..bdca6d2497d7
--- /dev/null
+++ b/security/pssh/files/patch-psshlib_basethread.py
@@ -0,0 +1,28 @@
+
+$FreeBSD$
+
+--- psshlib/basethread.py.orig
++++ psshlib/basethread.py
+@@ -1,4 +1,4 @@
+-import color, cStringIO, fcntl, os, select, signal, sys, threading, time, Queue
++import color, cStringIO, errno, fcntl, os, select, signal, sys, threading, time, Queue
+ from subprocess import Popen, PIPE
+
+ class BaseThread(threading.Thread):
+@@ -35,7 +35,15 @@
+ timeout = self.flags["timeout"] - (time.time() - start)
+ if timeout <= 0:
+ raise Exception("Timeout")
+- r, w, e = select.select([ cstdout, cstderr ], [], [], timeout)
++ while True:
++ try:
++ r, w, e = select.select([ cstdout, cstderr ], [], [], timeout)
++ break
++ except select.error, v:
++ if v[0] == errno.EINTR:
++ continue
++ else:
++ raise
+ try:
+ for f in r:
+ chunk = f.read()
diff --git a/security/pssh/files/patch-psshlib_psshutil.py b/security/pssh/files/patch-psshlib_psshutil.py
new file mode 100644
index 000000000000..a8d90a7dded8
--- /dev/null
+++ b/security/pssh/files/patch-psshlib_psshutil.py
@@ -0,0 +1,43 @@
+
+$FreeBSD$
+
+--- psshlib/psshutil.py.orig
++++ psshlib/psshutil.py
+@@ -1,22 +1,18 @@
+ import os, signal, sys
+
+-def reaper(signo, frame):
+- while 1:
+- try:
+- pid, status = os.waitpid(-1, os.WNOHANG)
+- except:
+- break
+- if not pid:
+- break
+-
+ def read_hosts(pathname):
+ """
+ Read hostfile with lines of the form: host[:port] [login]. Return
+ three arrays: hosts, ports, and users. These can be used directly
+ for all ssh-based commands (e.g., ssh, scp, rsync -e ssh, etc.)
++ Empty lines and lines where the first non-blank character is a
++ '#' character are ignored.
+ """
+ import re
+- f = open(pathname)
++ if pathname == "-":
++ f = open("/dev/stdin")
++ else:
++ f = open(pathname)
+ lines = f.readlines()
+ lines = map(lambda x: x.strip(), lines)
+ addrs = []
+@@ -24,7 +20,7 @@
+ ports = []
+ users = []
+ for line in lines:
+- if re.match("^\s+$", line) or len(line) == 0:
++ if re.match("^\s*(#|$)", line):
+ continue
+ fields = re.split("\s", line)
+ if len(fields) == 1: