File: bug-247862-other-command-check.patch

package info (click to toggle)
wwwconfig-common 0.3.0
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 488 kB
  • sloc: sh: 952; makefile: 5
file content (115 lines) | stat: -rw-r--r-- 5,039 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
From: Jeremy Laine <jeremy.laine@m4x.org>
Date: Fri, 07 May 2004 17:21:59 +0200

Package: wwwconfig-common
Version: 0.0.34
Severity: normal
Tags: patch

The mysql-* scripts use the following test to determine if a mysql
client is present :

[...]
elif [ ! -x $(which mysql) ] ; then
    echo "No mysql client to execute, install the mysql client package
    and run 'dpkg-reconfigure -plow packagename'."
[...]

The problem is that "! -x" does not return true on an empty string!

A better test would be simply to test if the string returned by "which"
is empty like this:

[...]
elif [ -z $(which mysql] ; then
[...]

Attached is a patch that fixes this problem.

Regards,
Jeremy

diff -ur /usr/share/wwwconfig-common/mysql-createdb.sh ./mysql-createdb.sh
--- /usr/share/wwwconfig-common/mysql-createdb.sh	2004-02-16 14:35:15.000000000 +0100
+++ ./mysql-createdb.sh	2004-05-07 17:13:09.000000000 +0200
@@ -32,7 +32,7 @@
     error="No database server specified."
 elif [ -z "$dbadmin" ] ; then
     error="No database administrator specified."
-elif [ ! -x $(which mysql) ] ; then
+elif [ -z $(which mysql) ] ; then
     error="No mysql client to execute, install the mysql client package and
     run 'dpkg-reconfigure -plow packagename'."
 elif ! eval $mysqlcmd -f mysql -e "\"show tables;\"" >/dev/null 2>&1 ; then
diff -ur /usr/share/wwwconfig-common/mysql-createuser.sh ./mysql-createuser.sh
--- /usr/share/wwwconfig-common/mysql-createuser.sh	2004-02-16 14:35:15.000000000 +0100
+++ ./mysql-createuser.sh	2004-05-07 17:13:52.000000000 +0200
@@ -40,7 +40,7 @@
     error="No database server specified."
 elif [ -z "$dbadmin" ] ; then
     error="No database administrator specified."
-elif [ ! -x $(which mysql) ] ; then
+elif [ -z $(which mysql) ] ; then
     echo "No mysql client to execute, install the mysql client package and
     run 'dpkg-reconfigure -plow packagename'."
 elif ! eval $mysqlcmd -f mysql -e "\"show tables;\"" >/dev/null 2>&1 ; then
diff -ur /usr/share/wwwconfig-common/mysql-dropdb.sh ./mysql-dropdb.sh
--- /usr/share/wwwconfig-common/mysql-dropdb.sh	2004-02-16 14:35:15.000000000 +0100
+++ ./mysql-dropdb.sh	2004-05-07 17:13:24.000000000 +0200
@@ -30,7 +30,7 @@
     error="No database server specified."
 elif [ -z "$dbadmin" ] ; then
     error="No database administrator specified."
-elif [ ! -x $(which mysql) ] ; then
+elif [ -z $(which mysql) ] ; then
     error="No mysql client to execute, install the mysql client package and
     run 'dpkg-reconfigure -plow packagename'."
 elif ! eval $mysqlcmd -f mysql -e "\"show tables;\"" >/dev/null 2>&1 ; then
diff -ur /usr/share/wwwconfig-common/mysql-dropuser.sh ./mysql-dropuser.sh
--- /usr/share/wwwconfig-common/mysql-dropuser.sh	2004-02-16 14:35:15.000000000 +0100
+++ ./mysql-dropuser.sh	2004-05-07 17:14:16.000000000 +0200
@@ -34,7 +34,7 @@
     error="No database server specified."
 elif [ -z "$dbadmin" ] ; then
     error="No database administrator specified."
-elif [ ! -x $(which mysql) ] ; then
+elif [ -z $(which mysql) ] ; then
     echo "No mysql client to execute, install the mysql client package and
     run 'dpkg-reconfigure -plow packagename'."
 elif ! eval $mysqlcmd -f mysql -e "\"show tables;\"" >/dev/null 2>&1 ; then
diff -ur /usr/share/wwwconfig-common/mysql-exec.sh ./mysql-exec.sh
--- /usr/share/wwwconfig-common/mysql-exec.sh	2004-02-16 14:35:15.000000000 +0100
+++ ./mysql-exec.sh	2004-05-07 17:12:53.000000000 +0200
@@ -37,7 +37,7 @@
     error="No database server specified."
 elif [ -z "$dbadmin" ] ; then
     error="No database administrator specified."
-elif [ ! -x $(which mysql) ] ; then
+elif [ -z $(which mysql) ] ; then
     error="No mysql client to execute, install the mysql client package and
     run 'dpkg-reconfigure -plow packagename'."
 elif ! eval $mysqlcmd </dev/null >/dev/null 2>&1 ; then
diff -ur /usr/share/wwwconfig-common/mysql-if-exec.sh ./mysql-if-exec.sh
--- /usr/share/wwwconfig-common/mysql-if-exec.sh	2004-02-16 14:35:15.000000000 +0100
+++ ./mysql-if-exec.sh	2004-05-07 17:14:36.000000000 +0200
@@ -44,7 +44,7 @@
     error="No sqlfile to execute."
 elif [ ! -e "$sqlfile" ] ; then
     error="Sqlfile $sqlfile not found."
-elif [ ! -x $(which mysql) ] ; then
+elif [ -z $(which mysql) ] ; then
     error="No mysql client to execute, install the mysql client package and
     run 'dpkg-reconfigure -plow packagename'."
 elif ! eval $mysqlcmd </dev/null >/dev/null 2>&1 ; then
diff -ur /usr/share/wwwconfig-common/mysql-ifnot-exec.sh ./mysql-ifnot-exec.sh
--- /usr/share/wwwconfig-common/mysql-ifnot-exec.sh	2004-02-16 14:35:15.000000000 +0100
+++ ./mysql-ifnot-exec.sh	2004-05-07 17:14:49.000000000 +0200
@@ -43,7 +43,7 @@
     error="No sqlfile to execute."
 elif [ ! -e "$sqlfile" ] ; then
     error="Sqlfile $sqlfile not found."
-elif [ ! -x $(which mysql) ] ; then
+elif [ -z $(which mysql) ] ; then
     error="No mysql client to execute, install the mysql client package and
     run 'dpkg-reconfigure -plow packagename'."
 elif ! eval $mysqlcmd </dev/null >/dev/null 2>&1 ; then