After using webapp-config to install cgit webapp, the contents of /usr/share/webapps/cgit/<version_number>/postinst-en.txt are shown. This results in a recommendation to add the following snippet to Apache configuration: RewriteEngine On # Redirect all non-existant urls to cgit RewriteCond RewriteCond RewriteRule ^.* /cgi-bin/cgit.cgi//bin/sh [L,PT] # Redirect the empty url to cgit RewriteRule ^$ /cgi-bin/cgit.cgi/ [L,PT] There are two errors there. The first one is the blank RewriteCond lines and the second one is the reference to /bin/sh in the first RewriteRule. This is caused by unescaped special characters in the postinst-en.txt mentioned above which is installed from the packages ${FILESDIR}. This could be fixed by escaping the affected characters: --- www-apps/cgit/files/postinstall-en.txt 2019-09-16 19:42:25.121000000 +0200 +++ www-apps/cgit/files/postinstall-en.txt 2019-11-17 22:10:48.819000000 +0100 @@ -29,9 +29,9 @@ <snip> RewriteEngine On # Redirect all non-existant urls to cgit - RewriteCond %{REQUEST_FILENAME} !-f - RewriteCond %{REQUEST_FILENAME} !-d - RewriteRule ^.* /cgi-bin/cgit.cgi/$0 [L,PT] + RewriteCond %%{REQUEST_FILENAME} !-f + RewriteCond %%{REQUEST_FILENAME} !-d + RewriteRule ^.* /cgi-bin/cgit.cgi/\$0 [L,PT] # Redirect the empty url to cgit RewriteRule ^$ /cgi-bin/cgit.cgi/ [L,PT] But of course that would show the wrong instructions to somebody directly reading the postinstall-en.txt. A better solution would be to tell webapp-config to show the contents of the file without making any substitution, but I don't know how exactly webapp-config displays that file.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=25d173ae900cb25661f28092995cee221d2f7be2 commit 25d173ae900cb25661f28092995cee221d2f7be2 Author: Jesus P Rey (Chuso) <gentoo@chuso.net> AuthorDate: 2020-09-24 09:21:18 +0000 Commit: Matt Turner <mattst88@gentoo.org> CommitDate: 2020-11-05 01:52:09 +0000 www-apps/cgit: Add missing escape characters in postinst message. Signed-off-by: Jesus P Rey <gentoo@chuso.net> Closes: https://bugs.gentoo.org/700402 Closes: https://github.com/gentoo/gentoo/pull/17649 Signed-off-by: Matt Turner <mattst88@gentoo.org> www-apps/cgit/files/postinstall-en.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)