NetBSD Problem Report #47479
From kre@munnari.OZ.AU Mon Jan 21 11:50:00 2013
Return-Path: <kre@munnari.OZ.AU>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
by www.NetBSD.org (Postfix) with ESMTP id 8B6D463E6F1
for <gnats-bugs@gnats.NetBSD.org>; Mon, 21 Jan 2013 11:50:00 +0000 (UTC)
Message-Id: <201301211148.r0LBmbYQ025962@jade.coe.psu.ac.th>
Date: Mon, 21 Jan 2013 18:48:37 +0700 (ICT)
From: kre@munnari.OZ.AU
To: gnats-bugs@gnats.NetBSD.org
Subject: sysutils/webmin fails with USE_DESTDIR=no (+FIX)
X-Send-Pr-Version: 3.95
>Number: 47479
>Category: pkg
>Synopsis: sysutils/webmin fails with USE_DESTDIR=no (+FIX)
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jan 21 11:55:01 +0000 2013
>Originator: Robert Elz
>Release: NetBSD 5.1_STABLE (irrelevant) pkgsrc current 2012-01-21
>Organization:
Prince of Songkla University
>Environment:
System: NetBSD jade.coe.psu.ac.th 5.1_STABLE NetBSD 5.1_STABLE (JADE-1.12-20120130) #27: Tue Jan 31 05:20:31 ICT 2012 kre@jade.coe.psu.ac.th:/usr/obj/5/kernels/i386/JADE i386
Architecture: i386
Machine: i386
>Description:
I (mostly) build packages in a pkg_comp sandbox, in which the
USE_DESTDIR mechanism is pointless, so I have it turned off
(USE_DESTDIR=no in the mk.conf in the sandbox). (I leave the
default for USE_DESTDIR in the real system for the odd times
when I need to build a packags outside pkg_comp).
In that environment, building sysutils/webmin (vers 1.600) fails.
There are two problems .. first (and most people would probably
not see this one, even with USE_DESTDIR=no) nothing creates the
/usr/pkg/share/examples directory, the webmin setup.sh script
attempts "mkdir /usr/pkg/share/examples/webmin" - this is assuming
all default locations for everything of course - which fails.
The patch included below fixes that my simply making the mkdir
commands in setup.sh all include the -p option. Initially, I
hesitated to go that way, in case pkgsrc is installed on systems
where mkdir has no -p arg, but then I saw that one (of the 4)
mkdir calls in setup.sh was already using mkdir -p, so ...
Incidentally, I have no idea why this doesn't fail when USE_DESTDIR=yes
I guess something else must be making all the (parent) directories in
that case.
This problem would rarely be seen, as most installations would have
had /usr/pkg/share/examples created by some other package install.
My environment doesn't, as I build everything in a clean sandbox
(very few packages installed) and it turns out that none of the
dependencies of sysutils/webmin (there are only a few) need that
directory, so in my sandbox, it didn't exist.
More seriously, the do-install recipe in the pkgsrc Makefile
includes
sed -e ... -e "s,${DESTDIR},,g"
When USE_DESTDIR=no, $DESTDIR is (normally anyway) "", which
results in
sed .... -e "s,,,g"
which is not legal sed usage. The patch below includes a
hack to workaround that...
>How-To-Repeat:
Attempt to build sysutils/webmin with USE_DESTDIR=no on a very
clean (extra virgin) system (like a new pkg_comp sandbox, with
no packages installed at all).
Expect to see ...
Config file directory [/etc/webmin]: mkdir: /usr/pkg/share/examples/webmin: No s
uch file or directory
ERROR: Failed to create directory /usr/pkg/share/examples/webmin
If you fix that problem (by using mkdir -p, or just manually creating
/usr/pkg/share/examples), then you will see on a later attempt ...
sed -e "/^env_WEBMIN_CONFIG=/s,/usr/pkg/share/examples/webmin,/etc/conf/webmin," -e "/^logout=/s,/usr/pkg/share/examples/webmin,/etc/conf/webmin," -e "/^userfile=/s,/usr/pkg/share/examples/webmin,/etc/conf/webmin," -e "/^keyfile=/s,/usr/pkg/share/examples/webmin,/etc/conf/webmin," -e "s,,,g" /usr/pkg/share/examples/webmin/miniserv.conf > /pkg_comp/obj/pkgsrc/sysutils/webmin/5/miniserv.conf
sed -e "s,,,g" /usr/pkg/share/webmin/setup-pre.sh > /pkg_comp/obj/pkgsrc/sysutils/webmin/5/setup-pre.sh
sed: first RE may not be empty
*** Error code 1
>Fix:
Apply the patch below (in sysutils/webmin). This patch patches the
Makefile, patches/patch-aa, and distinfo files. With this patch
applied, a USE_DESTDIR=no build succeeds (there should be no effect
to a USE_DESTDIR=yes build).
The setup.sh script really needs serious work, it needs variable
quoting fixed, and just to be done in more rational ways; Eg: using
echo "$var" | grep "^/" to see if $var starts with a / is just
bizarre! (Sure it works, but a case statement is so much easier).
But that's all someone else's problem...
Index: Makefile
===================================================================
RCS file: /cvsroot/NetBSD/pkgsrc/sysutils/webmin/Makefile,v
retrieving revision 1.33
diff -u -r1.33 Makefile
--- Makefile 2 Nov 2012 19:02:50 -0000 1.33
+++ Makefile 21 Jan 2013 10:42:45 -0000
@@ -102,19 +102,20 @@
# Fix up the path to the config directory in the installed example config
# files.
#
+DDIR:=${DESTDIR:S/^$/UnLiKeLy_StRiNg/}
do-install:
${SH} ${WRKSRC}/setup.sh ${DESTDIR}${WEBMIN_DIR}
sed -e "/^env_WEBMIN_CONFIG=/s,${DESTDIR}${WEBMIN_EGDIR},${WEBMIN_ETCDIR}," \
-e "/^logout=/s,${DESTDIR}${WEBMIN_EGDIR},${WEBMIN_ETCDIR}," \
-e "/^userfile=/s,${DESTDIR}${WEBMIN_EGDIR},${WEBMIN_ETCDIR}," \
-e "/^keyfile=/s,${DESTDIR}${WEBMIN_EGDIR},${WEBMIN_ETCDIR}," \
- -e "s,${DESTDIR},,g" \
+ -e "s,${DDIR},,g" \
${DESTDIR}${WEBMIN_EGDIR}/miniserv.conf > ${WRKDIR}/miniserv.conf
- sed -e "s,${DESTDIR},,g" \
+ sed -e "s,${DDIR},,g" \
${DESTDIR}${WEBMIN_DIR}/setup-pre.sh > ${WRKDIR}/setup-pre.sh
for file in install-dir reload restart start stop var-path; do \
sed -e "s,${DESTDIR}${WEBMIN_EGDIR}/miniserv.conf,${WEBMIN_ETCDIR}/miniserv.conf," \
- -e "s,${DESTDIR},,g" \
+ -e "s,${DDIR},,g" \
${DESTDIR}${WEBMIN_EGDIR}/$$file > ${WRKDIR}/$$file; \
done
cd ${DESTDIR}${WEBMIN_EGDIR} && ${RM} -f miniserv.conf install-dir reload restart start stop var-path
Index: distinfo
===================================================================
RCS file: /cvsroot/NetBSD/pkgsrc/sysutils/webmin/distinfo,v
retrieving revision 1.19
diff -u -r1.19 distinfo
--- distinfo 2 Nov 2012 19:02:50 -0000 1.19
+++ distinfo 21 Jan 2013 11:19:35 -0000
@@ -3,7 +3,7 @@
SHA1 (webmin-1.600.tar.gz) = b915b7127a9579cac8993c4ef54462dfa404bf64
RMD160 (webmin-1.600.tar.gz) = 33f0c67b47bc7db625fc66b85ee1872e77f32ad5
Size (webmin-1.600.tar.gz) = 21397348 bytes
-SHA1 (patch-aa) = e1196764fefed872e84a76dc32b428c504920468
+SHA1 (patch-aa) = c75f415f96b11eaffb7bf91eaa08871f05216757
SHA1 (patch-ab) = fa07200462df76af23b9952739388053940c6743
SHA1 (patch-ac) = 8803482bd0ab02e3d70683a520a76c3dc680df6b
SHA1 (patch-ad) = 279ed8684448f1bae252bbe3ba7f9179fdd17737
Index: patches/patch-aa
===================================================================
RCS file: /cvsroot/NetBSD/pkgsrc/sysutils/webmin/patches/patch-aa,v
retrieving revision 1.8
diff -u -r1.8 patch-aa
--- patches/patch-aa 2 Nov 2012 19:02:51 -0000 1.8
+++ patches/patch-aa 21 Jan 2013 11:19:14 -0000
@@ -1,7 +1,7 @@
$NetBSD: patch-aa,v 1.8 2012/11/02 19:02:51 shattered Exp $
--- setup.sh.orig 2009-03-18 07:30:26.000000000 +0200
-+++ setup.sh 2009-04-09 12:24:40.000000000 +0300
++++ setup.sh 2013-01-21 10:46:30.000000000 +0000
@@ -35,6 +35,11 @@
# Only root can run this
@@ -14,6 +14,24 @@
if [ $? != "0" ]; then
uname -a | grep -i CYGWIN >/dev/null
if [ $? != "0" ]; then
+@@ -49,7 +54,7 @@
+ wadir=$1
+ echo "Installing Webmin from $srcdir to $wadir ..."
+ if [ ! -d "$wadir" ]; then
+- mkdir "$wadir"
++ mkdir -p "$wadir"
+ if [ "$?" != "0" ]; then
+ echo "ERROR: Failed to create $wadir"
+ echo ""
+@@ -109,7 +114,7 @@
+ exit 2
+ fi
+ if [ ! -d $config_dir ]; then
+- mkdir $config_dir;
++ mkdir -p $config_dir;
+ if [ $? != 0 ]; then
+ echo "ERROR: Failed to create directory $config_dir"
+ echo ""
@@ -122,6 +127,9 @@
upgrading=1
fi
@@ -24,7 +42,7 @@
# Check if upgrading from an old version
if [ "$upgrading" = 1 ]; then
echo ""
-@@ -199,6 +207,10 @@
+@@ -200,6 +208,10 @@
else
# Config directory exists .. make sure it is not in use
ls $config_dir | grep -v rpmsave >/dev/null 2>&1
@@ -35,7 +53,16 @@
if [ "$?" = "0" -a "$config_dir" != "/etc/webmin" ]; then
echo "ERROR: Config directory $config_dir is not empty"
echo ""
-@@ -528,6 +540,12 @@
+@@ -226,7 +238,7 @@
+ exit 3
+ fi
+ if [ ! -d $var_dir ]; then
+- mkdir $var_dir
++ mkdir -p $var_dir
+ if [ $? != 0 ]; then
+ echo "ERROR: Failed to create directory $var_dir"
+ echo ""
+@@ -530,6 +542,12 @@
kfile=$config_dir/miniserv.pem
openssl version >/dev/null 2>&1
@@ -48,7 +75,7 @@
if [ "$?" = "0" ]; then
# We can generate a new SSL key for this host
host=`hostname`
-@@ -742,44 +760,47 @@
+@@ -757,44 +775,47 @@
echo ""
fi
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.