aboutsummaryrefslogtreecommitdiffstats
path: root/security/pssh
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2007-07-07 04:30:24 +0800
committerbrooks <brooks@FreeBSD.org>2007-07-07 04:30:24 +0800
commit1add4b987f8d4054522ddc48031428c8b31bb41b (patch)
treefcc472aabfb77da1ae188fdda2fbce5e05a27474 /security/pssh
parented3c68885c60b29827c654092bfd3452fa04d603 (diff)
downloadfreebsd-ports-graphics-1add4b987f8d4054522ddc48031428c8b31bb41b.tar.gz
freebsd-ports-graphics-1add4b987f8d4054522ddc48031428c8b31bb41b.tar.zst
freebsd-ports-graphics-1add4b987f8d4054522ddc48031428c8b31bb41b.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.
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 d7c2fb597d2..e3a4d8daf00 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 00000000000..a209aa6fba0
--- /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 00000000000..8a6ea33f70f
--- /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 00000000000..758d1e4eaa5
--- /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 00000000000..b53f4eba0cd
--- /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 00000000000..a05010b2ca8
--- /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 00000000000..bdca6d2497d
--- /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 00000000000..a8d90a7dded
--- /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: