Bug 34419

Summary: koha-plack contains a wrong test about missing Apache modules
Product: Koha Reporter: Marcel de Rooy <m.de.rooy>
Component: Architecture, internals, and plumbingAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low CC: tomascohen
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Marcel de Rooy 2023-07-26 15:03:08 UTC
All needed Apache modules are installed but koha-plack tells me:

WARNING: koha-plack requires some Apache modules that you are missing.
You can install them with:
    sudo a2enmod headers proxy_http

This really is not true.
What happened?
There is a syntax error in one of my local sed changes in a config file.

Looking a bit deeper, I see this test in sub check_env_and_warn()

        if ! /usr/sbin/apachectl -M 2> /dev/null | grep -q ${module}; then
            missing_modules="${missing_modules}${module} "
        fi

Altough the grep -q part looked mysterious to me at first, the problem seems to be the pipe. If the first process exits with an error, the second will have an error too on the closed handles.
Comment 1 Marcel de Rooy 2023-07-26 15:06:03 UTC
/usr/sbin/apachectl -M 2>/dev/null | grep -q headers; echo "${PIPESTATUS[0]} ${PIPESTATUS[1]}"
1 1
Comment 2 Marcel de Rooy 2023-07-26 15:07:10 UTC
Error fixed

/usr/sbin/apachectl -M 2>/dev/null | grep -q headers; echo "${PIPESTATUS[0]} ${PIPESTATUS[1]}"

/usr/sbin/apachectl -M 2>/dev/null | grep -q badheaders; echo "${PIPESTATUS[0]} ${PIPESTATUS[1]}"
0 1
Comment 3 Marcel de Rooy 2023-07-26 15:07:39 UTC
(In reply to Marcel de Rooy from comment #2)
> /usr/sbin/apachectl -M 2>/dev/null | grep -q headers; echo "${PIPESTATUS[0]}
> ${PIPESTATUS[1]}"
0 0