[Bug 689563] Re: packages: mysql/mysql.init, mysql/mysql.spec - allow spaces and tabs after ...

Caleb Maclennan caleb at pld-linux.org
Tue Dec 14 11:02:28 CET 2010


>>> ...pff, make temp var "key" there
>> you have write access.
>  no, fix yourself,

Hey guys don't forget we're on the same team here.

I tried making this change myself, but either my smattering of awk
knowledge is not enough or something else is going on here. I made up
a variable and striped the spaces from it and used that for the tests,
but it gives the same error we started with. Then I realized that the
original variable was already being stripped (see line 199)! The ~
comparison must be doing something other than just stripping spaces as
per the regex.

Anybody know what else is going on there? Here is my attempted patch.

Index: mysql.init
===================================================================
RCS file: /cvsroot/packages/mysql/mysql.init,v
retrieving revision 1.144
diff -u -r1.144 mysql.init
--- mysql.init  13 Dec 2010 15:09:11 -0000      1.144
+++ mysql.init  14 Dec 2010 09:24:43 -0000
@@ -209,22 +209,25 @@
                next;
        }

+       key = $1;
+       gsub(/[ \t]*/, "", $key);
+
        section == "mysqld" {
-               if ($1 ~ /^datadir[ \t]*$/) {
+               if ($key == "datadir") {
                        printf("MYSQL_DATA_DIR=%s;", $2);
-               } else if ($1 ~ /^user[ \t]*$/) {
+               } else if ($key == "user") {
                        printf("MYSQL_USER=%s;", $2);
-               } else if ($1 ~ /^pid-file[ \t]*$/) {
+               } else if ($key == "pid-file") {
                        printf("MYSQL_PIDFILE=%s;", $2);
-               } else if ($1 ~ /^socket[ \t]*$/) {
+               } else if ($key == "socket") {
                        printf("MYSQL_SOCKET=%s;", $2);
-               } else if ($1 ~ /^port[ \t]*$/) {
+               } else if ($key == "port") {
                        printf("MYSQL_PORT=%s;", $2);
-               } else if ($1 ~ /^bind-address[ \t]*$/) {
+               } else if ($key == "bind-address") {
                        printf("MYSQL_BIND_ADDRESS=%s;", $2);
-               } else if ($1 ~ /^skip-networking[ \t]*$/) {
+               } else if ($key == "skip-networking") {
                        printf("MYSQL_SKIP_NETWORKING=1;");
-               } else if ($1 ~ /^log-error[ \t]*$/) {
+               } else if ($key == "log-error") {
                        printf("MYSQL_LOG_ERROR=%s;", $2);
                }
        }


More information about the pld-devel-en mailing list