[BlueOnyx:21801] Re: Apache broken after yum update

Michael Stauber mstauber at blueonyx.it
Fri Mar 2 13:32:24 -05 2018


Hi Colin,

> It did that but that (apart from deleting all the include lines) also created this error:
> 
> Starting httpd: Syntax error on line 1010 of /etc/httpd/conf/httpd.conf:
> Invalid command 'PerlConfigRequire', perhaps misspelled or defined by a module not included in the server configuration


I am looking at that problem now. For editing httpd.conf I used a
function that's part of BlueOnyx and is used elsewhere as well. It's
been around since the Cobalt days:

Sauce::Util::replaceblock()

It's used like this:

$ok = Sauce::Util::replaceblock($textfile, '#Start', $replacement, '#End');

That will edit $textfile and will shove $replacement between the defined
start and end lines.

We use this in quite a few places for editing config files and it works
pretty well. The caveat appears to be (from looking at the code for this
function): If it doesn't find the defined end line it will snip off the
rest. In your case the code hasn't found the end line it was looking for
and kept looking until it ran out of file.

Which is totally *not* what we'd ever want this function to do.

It's interesting that this function (in this form) has been around for
20 years and we've just now spotted this, but it's what it is.

I did a small demonstrator and used it to debug and fix the function. If
the fixed function finds the start tag, it will start printing the
replacement. Then it keeps track of all lines below the start tag and
goes on looking for the end tag. If it reaches the end of the file
without ever encountering the end tag, then it'll now simply print
everything it's been sitting on. That way it'll never loose anything again.

I'll publish a fixed "perl-handler-utils" RPM, which is where
Sauce::Util comes from.

-- 
With best regards

Michael Stauber



More information about the Blueonyx mailing list