Your message dated Sat, 10 Feb 2024 18:22:57 +0000
with message-id <[email protected]>
and subject line Bug#1061792: fixed in mini-httpd 1.30-8
has caused the Debian Bug report #1061792,
regarding mini-httpd: Update of mini-httpd still breaks default web page if it
is not index.html
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
1061792: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1061792
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: mini-httpd
Version: 1.30-7
Severity: normal
Dear Maintainer,
unfortunately, the current version mini-httpd 1.30-7 in unstable does
NOT fix the Bug#1057842.
The postinst script
<https://salsa.debian.org/debian/mini-httpd/-/blob/master/debian/mini-httpd.postinst?ref_type=heads>
still creates an unwanted default page. It is no longer named
index.mini-httpd.html, but instead index.html. This makes things worse
with the new version of the 0003-fix-change-index-document-root patch
<https://salsa.debian.org/debian/mini-httpd/-/blob/master/debian/patches/0003-fix-change-index-document-root?ref_type=heads>.
index.mini-httpd.html would have lower priority than any other default
page, but index.html has highest priority.
Here is how I tested:
Installed Debian stable (12.4) via netinstall ISO in a VirtualBox VM.
Installed stable version of mini-httpd: apt-get install mini-httpd
Changed cgipat to **.cgi in /etc/mini-httpd.conf and restarted mini-httpd
Tested basic function of mini-httpd: wget -q -O /dev/stdout
http://localhost/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; " />
<title>Welcome page</title>
</head>
<body>
It works!
</body>
</html>
This is the default page of the mini-httpd package.
Created an executable /var/www/html/index.cgi:
#!/bin/bash
echo -en "Content-Type: text/plain\r\n\r\n"
echo "*** HELLO FROM CGI ***"
Testing that index.cgi works: wget -q -O /dev/stdout
http://localhost/index.cgi
*** HELLO FROM CGI ***
Switched to index.cgi as default page: rm
/var/www/html/index.mini-httpd.html
Testing index.cgi as default page: wget -q -O /dev/stdout http://localhost/
*** HELLO FROM CGI ***
Changed to sid by editing /etc/apt/sources.list as documented in
<https://wiki.debian.org/DebianUnstable>, this will update mini-http to
the unstable version.
echo deb http://deb.debian.org/debian/ unstable main > /etc/apt/sources.list
echo deb-src http://deb.debian.org/debian/ unstable main >>
/etc/apt/sources.list
apt update
apt full-upgrade
reboot
Testing default page again: wget -q -O /dev/stdout http://localhost/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Welcome page</title>
</head>
<body>
It works!
</body>
</html>
Unfortunately, that is the package default page again, not my index.cgi.
Looking at the html directory: ls -alF /var/www/html/
total 16
drwxr-xr-x 2 root root 4096 Jan 28 12:19 ./
drwxr-xr-x 3 root root 4096 Jan 28 11:41 ../
-rwxr-xr-x 1 root root 86 Jan 28 11:55 index.cgi*
-rw-r--r-- 1 root root 312 Jan 28 12:19 index.html
Look at the time of index.html: It was created AFTER my index.cgi, by
the postinst script. The postinst script had found a readable
/usr/share/doc/mini-httpd/examples/index.html but no readable
/var/www/html/index.html, and so it copied the former to the latter and
broke my (simulated) webpage again.
Checking for and copying to /var/www/html/index.mini-httpd.html would
have prevented that.
As before, the real problem is that the postinst script re-creates an
index file in the document directory during the update of the package.
It is ok to do so during installation of the package, but not during the
update.
Looking at the apache2 package may help:
<https://salsa.debian.org/apache-team/apache2/-/blob/master/debian/apache2.postinst?ref_type=heads>
It has a function to detect a fresh installation:
is_fresh_install()
{
if [ -z "$2" ] ; then
return 0
fi
return 1
}
And that function is called before copying default pages to the web
server directory. The function for copying files is even smart enough to
test for existing default pages in the webserver and preventy copying if
any default page exists, even for a fresh install of the apache2 package.
install_default_files()
{
if is_fresh_install $@ ; then
local do_copy=true
local dir ext
for dir in /var/www /var/www/html ; do
for ext in html cgi pl php xhtml htm ; do
if [ -e $dir/index.$ext ] ; then
do_copy=false
break 2
fi
done
if [ -h $dir/index.html ] ; then
do_copy=false
break
fi
done
if $do_copy ; then
cp /usr/share/apache2/default-site/index.html
/var/www/html/index.html
fi
else
# ... omitted, just an unrelated bugfix ...
fi
}
The install_default_files() function is called with all arguments passed
to the postinst script:
case "$1" in
configure)
enable_default_mpm $@
install_default_files $@
enable_default_modules $@
enable_default_conf $@
install_default_site $@
execute_deferred_actions
;;
# ... omitted ...
esac
I did not research how apt calls the postinst script, but to me, it is
clear what needs to be checked in the postinst script. Just follow the
code in the apache2 package:
#!/bin/sh
set -e
if [ "$1" = configure ] ; then
if [ -z "$2" ] ; then # fresh install, not updating
# avoid clobbering existing default page
local do_copy = true
# note: file name list must match index_names[] in compiled
mini_httpd.c, order is not important
for file in index.html index.htm index.xhtml index.xht
Default.htm index.cgi index.php index.mini-httpd.html ; do
if [ -e "/var/www/html/$file" ] ; then
do_copy = false
break
fi
done
if $do_copy ; then
# copy default page, if available
if [ -r /usr/share/doc/mini-httpd/examples/index.html ]; then
mkdir -p /var/www/html
cp /usr/share/doc/mini-httpd/examples/index.html
/var/www/html/index.html
fi
fi
fi
fi
#DEBHELPER#
Best regards
Alexander Foken
-- System Information:
Debian Release: trixie/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 6.6.13-amd64 (SMP w/2 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8),
LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages mini-httpd depends on:
ii init-system-helpers 1.66
ii libc6 2.37-14
ii libcrypt1 1:4.4.36-4
ii libssl3 3.1.4-2
Versions of packages mini-httpd recommends:
ii apache2-utils 2.4.58-1+b1
mini-httpd suggests no packages.
-- Configuration Files:
/etc/mini-httpd.conf changed:
host=localhost
port=80
user=nobody
nochroot # no
data_dir=/var/www/html
cgipat=**.cgi
logfile=/var/log/mini_httpd.log
pidfile=/var/run/mini_httpd.pid
charset=iso-8859-1
-- no debconf information
--- End Message ---
--- Begin Message ---
Source: mini-httpd
Source-Version: 1.30-8
Done: Alexandru Mihail <[email protected]>
We believe that the bug you reported is fixed in the latest version of
mini-httpd, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Alexandru Mihail <[email protected]> (supplier of updated
mini-httpd package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Format: 1.8
Date: Fri, 02 Feb 2024 19:42:56 +0200
Source: mini-httpd
Architecture: source
Version: 1.30-8
Distribution: unstable
Urgency: medium
Maintainer: Alexandru Mihail <[email protected]>
Changed-By: Alexandru Mihail <[email protected]>
Closes: 1061792
Changes:
mini-httpd (1.30-8) unstable; urgency=medium
.
* Modified mini-httpd.postinst to check if we're doing a
fresh install or upgrading. Secondly, if we're fresh installing,
the default index.html file is copied into /var/www/html only if
no other index files are present (ex: index.cgi). This prevents
the shipped index.html overwriting existing index.ext files.
If we are upgrading, no files will be touched.
(Closes: #1061792)
* Removed erroneous duplicate "-C /etc/mini-httpd.conf" in
systemd ExecStart. The "-C" call was already present in
the EnvironmentFile (/etc/default/mini-httpd) read and
used by the service. This resulted in mini-httpd's
commandline containing the "-C" call twice.
Thanks, Alexander Foken.
Checksums-Sha1:
252c6e9e50abb4395cd7ecceae5f36a29b6885f1 1898 mini-httpd_1.30-8.dsc
38783e27dc1901bf91076ae9331ef444eb83bb60 16892 mini-httpd_1.30-8.debian.tar.xz
14d6773e8dcfff90af2641a81041416b7407416f 6554 mini-httpd_1.30-8_amd64.buildinfo
Checksums-Sha256:
7974c4ca4889fd84d2ec4451dafeb9dc75c11623e2c5be9f9fd67d61748cb198 1898
mini-httpd_1.30-8.dsc
4decef16b10d1093cf77659bdc0d12f555e4bca947e415a8b6005314ff79e9f0 16892
mini-httpd_1.30-8.debian.tar.xz
025a63143945824df86c53cb6158dec26c2c71ca422affc753ea0084aca40d52 6554
mini-httpd_1.30-8_amd64.buildinfo
Files:
57a7510f826449c1cfb8702d0e6b49e0 1898 web optional mini-httpd_1.30-8.dsc
0037b2fe7fb9560b07a18860f023f80c 16892 web optional
mini-httpd_1.30-8.debian.tar.xz
d9a8bf66c0754c5997a7f340301feb67 6554 web optional
mini-httpd_1.30-8_amd64.buildinfo
-----BEGIN PGP SIGNATURE-----
iQJIBAEBCgAyFiEE7xPqJqaY/zX9fJAuhj1N8u2cKO8FAmXHqQIUHGFiaGlqaXRo
QGRlYmlhbi5vcmcACgkQhj1N8u2cKO9U4A/9Hq4u9diG1b1lvWplx+eTSBLcvJ/a
7/GhwWYzvJUkgpZFn9uYk3ZnvzmG5cxV9Mdh0FeJFbf8lOBdJDb93P/xP1zQSOAZ
NrfaUd+qCSzuWPjLqtSqV8SND+mxqmnpEgnXycizBsWH+yqMvCyreJ1sFlSeZwM3
AMGT/v4EtzLOPmBSDTBCD6pZ3+L8/l8BPueR2+VRzS20nc74NZ1K/m+3/EXpk/FU
BaobCtBvIAvsq8FW8CrBIStUKd9XO7WG6g/UiFw3hHIaqsefvwW9i2tfa3DBP8fd
rWLreo/gkA/BdnXutDoVSpiPODLRZXDqO0pyMAjNAOOLu1iz7Z2JtpF4hFuDVoKT
xisyQLmQJ2Hz7v5djbNJZmDr7im60zM+0s8oDkde0LTF4cRGU3LTyqd+I1oVpm14
vh+DHnb2k2IUcZmep6oUpQmWsjxTysGwgkQW2zozOkRFWOUWcJthuCsdxrLtVIUT
xVs8te0DcQAGnrxFHZSEuUwQyuCURpCJHI4VLUFNRqjTpp2RbRrvMWe/eeIqhMoA
RsqTvf0V5Z0xPKUx1XSneIbdhy6RsX4DIK++qOafaRHls4mTd5RkKpX9fkuN9Z7z
R6ETiewUZ8DuO802mId/C43bu3Ef1Gx4QYYCjp69GzuUh11qi7ktALPfkFdo8Dhv
q02TvtRHVy4JRmc=
=tzTE
-----END PGP SIGNATURE-----
--- End Message ---