From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050524 Fedora/1.0.4-4 Firefox/1.0.4
Description of problem:
We have used swatch for some time. When installed on to FC3 there were a few problems which I corrected but did not submit them. Since we hit the same problems with FC4, installed a couple of days ago, I am now submitting the changes as a patch against the supplied swatch perl program.
There are only a few changes, and some are quite minor - just typos and reformatting some of the pod documentation. Other changes are: the '-tail' option is ambiguous and is re-implemented as '-file-tail'; the use of single and double-quotes seems to be incorrect. Using "$0" (note the quotes) in config files causes errors; this has been fixed.
John.
Version-Release number of selected component (if applicable):
swatch-3.1.1-3.fc4
How reproducible:
Always
Steps to Reproduce:
1.Create a swatch config file containg "$0".
2.Start up swatch using the config file.
3.
Actual Results: Starting swatch produces errors. The problem seems to be due to swatch unable to handle single and double-quotes around the $0, as such perl gets confused:
====================================================================
Scalar found where operator expected at ./.swatch_script.27548 line 141, near ""/usr/local/bin/bb_event --add --service msgs --colour yellow --title 'Message in messages log file:' --message "$S_"
(Missing operator before $S_?)
String found where operator expected at ./.swatch_script.27548 line 141, near "$S_", 'MESSAGE' => ""
(Missing operator before ", 'MESSAGE' => "?)
Scalar found where operator expected at ./.swatch_script.27548 line 141, near "", 'MESSAGE' => "$_"
(Missing operator before $_?)
String found where operator expected at ./.swatch_script.27548 line 146, near "&Swatch::Actions::exec_command('COMMAND' => ""
(Might be a runaway multi-line "" string starting on line 141)
(Missing semicolon on previous line?)
Bareword found where operator expected at ./.swatch_script.27548 line 146, near "/bin/bb_event"
(Missing operator before bb_event?)
Bareword found where operator expected at ./.swatch_script.27548 line 146, near "--add"
(Missing operator before add?)
Bareword found where operator expected at ./.swatch_script.27548 line 146, near "--service"
(Missing operator before service?)
String found where operator expected at ./.swatch_script.27548 line 146, near "title 'Message in messages log file:'"
(Do you need to predeclare title?)
Bareword found where operator expected at ./.swatch_script.27548 line 146, near "--message"
(Missing operator before message?)
String found where operator expected at ./.swatch_script.27548 line 146, near "message "$S_""
(Do you need to predeclare message?)
syntax error at ./.swatch_script.27548 line 141, near ""/usr/local/bin/bb_event --add --service msgs --colour yellow --title 'Message in messages log file:' --message "$S_"
Execution of ./.swatch_script.27548 aborted due to compilation errors.
====================================================================
Expected Results: Swatch should startup with no errors.
Additional info:
An example config file is (line wrapped by me):
watchfor = /[^\B.]warning[^\B.]/io
exec = /usr/local/bin/bb_event --add --service msgs --colour yellow
--title 'Message in messages log file:' --message "$0"

John,
Diff -ruN is fine for generating patches.
I skimmed through your patch and I wouldn't change the regular expression
that detects empty lines. The original one is better as it also ignores
lines with only white spaces (the \s* should stay).
...
@@ -569,8 +576,8 @@
s/^\s+//; ## strip off leading blank space
s/\s+$//; ## strip off trailing blank space
- ### Skip comments blank lines ###
- next if (/^\#/ or /^\s*$/);
+ ### Skip comments and blank lines ###
+ next if (/^\#/ or /^$/);
s/\#.*$//; ## strip trailing comments
...
By the way, have you tried to send the patch to the author
(http://swatch.sourceforge.net/) ?
Regards,
jpo

No, the '\s*' is not required because the previous 2 lines remove trailing and
leading blanks:
s/^\s+//; ## strip off leading blank space
s/\s+$//; ## strip off trailing blank space
As such you can't possibly have a line with only spaces or tabs in it by the
time you reach the 'next' statement.
Yes I submitted the patch to the author at sourceforge - look at July 2004,
patches '[ 986013 ] Fix exec command and awk option'. It wasn't picked up by the
author, but has a comment by another user who had problems downloading the
patch. I have, however, just downloaded the patch myself (again), and it is
still fine - all there, no funny characters or anything.

I've just noticed that there are one or two differences between the patch at
sourceforge and the one I submitted here. I would use the patch submitted here
because it was produced later, and it is what we have been using on FC3 and FC4
with no problems.