[expect] Let user know when expample script needs telnet and it is missing

vcrhonek vcrhonek at fedoraproject.org
Wed Jul 27 14:25:03 UTC 2011


commit cb07de2c978fc28f82b636c055e7aa29c4393f24
Author: Vitezslav Crhonek <vcrhonek at redhat.com>
Date:   Wed Jul 27 16:24:43 2011 +0200

    Let user know when expample script needs telnet and it is missing

 expect-5.45-check-telnet.patch |   29 +++++++++++++++++++++++++++++
 expect.spec                    |    8 ++++++++
 2 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/expect-5.45-check-telnet.patch b/expect-5.45-check-telnet.patch
new file mode 100644
index 0000000..0b67dc6
--- /dev/null
+++ b/expect-5.45-check-telnet.patch
@@ -0,0 +1,29 @@
+diff -up expect5.45/example/passmass.orig expect5.45/example/passmass
+--- expect5.45/example/passmass.orig	2011-07-27 16:09:31.013843393 +0200
++++ expect5.45/example/passmass	2011-07-27 16:10:55.667843578 +0200
+@@ -107,6 +107,10 @@ for {set i 0} {$i<$argc} {incr i} {
+ 	set login "ssh"
+ 	continue
+     } "-telnet" {
++	if {[file executable /usr/bin/telnet] == 0} {
++		send_user "It seems that telnet is not installed. Please install telnet in order to use the script with this option.\n"
++		exit 1
++	}
+ 	set login "telnet"
+ 	continue
+     } "-program" {
+diff -up expect5.45/example/weather.orig expect5.45/example/weather
+--- expect5.45/example/weather.orig	2011-07-27 15:49:57.878843862 +0200
++++ expect5.45/example/weather	2011-07-27 16:08:48.067843491 +0200
+@@ -33,6 +33,11 @@ set timeout 60
+ 
+ set env(TERM) vt100	;# actual value doesn't matter, just has to be set
+ 
++if {[file executable /usr/bin/telnet] == 0} {
++	send_user "It seems that telnet is not installed. Please install telnet in order to use this script.\n"
++	exit 1
++}
++
+ spawn telnet rainmaker.wunderground.com 3000
+ while {1} {
+ 	expect timeout {
diff --git a/expect.spec b/expect.spec
index 924cd8b..c651518 100644
--- a/expect.spec
+++ b/expect.spec
@@ -22,6 +22,9 @@ Patch1: expect-5.43.0-pkgpath.patch
 Patch100: expect-5.32.2-random.patch
 # Patch101: fixes bz674184 - mkpasswd fails randomly
 Patch101: expect-5.45-mkpasswd-dash.patch
+# Patch102: fixes bz703702 - let user know that telnet is needed for
+# running some examples
+Patch102: expect-5.45-check-telnet.patch
 
 %description
 Expect is a tcl application for automating and testing
@@ -68,6 +71,7 @@ of expectk.
 # examples fixes
 %patch100 -p1 -b .random
 %patch101 -p1 -b .mkpasswd-dash
+%patch102 -p1 -b .check-telnet
 # -pkgpath.patch touch configure.in
 aclocal
 autoconf
@@ -151,6 +155,10 @@ rm -rf "$RPM_BUILD_ROOT"
 %{_mandir}/man1/tknewsbiff.1*
 
 %changelog
+* Wed Jul 27 2011 Vitezslav Crhonek <vcrhonek at redhat.com> - 5.45-4
+- Let user know when expample script needs telnet and it is missing
+  Resolves: #703702
+
 * Wed Mar 16 2011 Vitezslav Crhonek <vcrhonek at redhat.com> - 5.45-3
 - Fix mkpasswd fails randomly
   Resolves: #674184


More information about the scm-commits mailing list