NetBSD Problem Report #47189

From www@NetBSD.org  Tue Nov 13 13:19:40 2012
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id AD07D63E4AB
	for <gnats-bugs@gnats.NetBSD.org>; Tue, 13 Nov 2012 13:19:39 +0000 (UTC)
Message-Id: <20121113131939.007A263E4AB@www.NetBSD.org>
Date: Tue, 13 Nov 2012 13:19:38 +0000 (UTC)
From: nils.netbsd@anotherhomepage.org
Reply-To: nils.netbsd@anotherhomepage.org
To: gnats-bugs@NetBSD.org
Subject: Cacti configuration file is overwritten
X-Send-Pr-Version: www-1.0

>Number:         47189
>Category:       pkg
>Synopsis:       Cacti configuration file is overwritten
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 13 13:20:01 +0000 2012
>Last-Modified:  Wed Jan 15 02:10:00 +0000 2014
>Originator:     Nils Ratusznik
>Release:        NetBSD-5.1.2
>Organization:
>Environment:
NetBSD <name_of_the_machine> 5.1.2 NetBSD 5.1.2 (XEN3PAE_DOMU) #0: Thu Feb  2 17:18:36 UTC 2012  builds@b6.netbsd.org:/home/builds/ab/netbsd-5-1-2-RELEASE/i386/201202021012Z-obj/home/builds/ab/netbsd-5-1-2-RELEASE/src/sys/arch/i386/compile/XEN3PAE_DOMU i386
>Description:
when updating net/cacti, /usr/pkg/share/cacti/include/config.php is overwritten. This configuration file contains the credentials to connect to MySQL server, and the url path to cacti.


>How-To-Repeat:
Install and configure any older version of cacti in pkgsrc. Don't use default credentials provided by /usr/pkg/share/cacti/include/config.php . Then, upgrade to a newer version of cacti in pkgsrc (with pkgin, pkg_add or make). Try to browse cacti on your server : it will complain it cannot connect to the MySQL server.
>Fix:

>Audit-Trail:
From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/47189: Cacti configuration file is overwritten
Date: Tue, 13 Nov 2012 19:52:24 +0000

 On Tue, Nov 13, 2012 at 01:20:01PM +0000, nils.netbsd@anotherhomepage.org wrote:
  > when updating net/cacti, /usr/pkg/share/cacti/include/config.php is
  > overwritten. This configuration file contains the credentials to
  > connect to MySQL server, and the url path to cacti.

 The config file should be in /usr/pkg/etc and handled using the config
 file framework; that will make this problem go away.

 Getting that to happen will probably take some patching.

 -- 
 David A. Holland
 dholland@netbsd.org

From: Nils Ratusznik <nils.netbsd@anotherhomepage.org>
To: gnats-bugs@NetBSD.org
Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Subject: Re: pkg/47189: Cacti configuration file is overwritten
Date: Fri, 18 Oct 2013 14:15:58 +0200 (CEST)

 Hi,

 I made some modifications to the Makefile, following the example in databases/phpmyadmin. 2 Things to notice :
 - good news, this patch enables cacti to have a /usr/pkg/etc/cacti/ with config.php sitting here and linked to its reald path ;
 - bad news, the apache config file is not copied anymore, since the Makefile had "PKG_SYSCONFSUBDIR?=    httpd".

 Patches for Makefile and PLIST are below and made against pkgsrc-2013Q3.
 MESSAGES should also be modified but Makefile seems to be the most important here.

 What do you think ?

 Makefile :
 --- Makefile    2 Sep 2013 19:51:19 -0000       1.19
 +++ Makefile    18 Oct 2013 12:07:50 -0000
 @@ -2,7 +2,7 @@
  #

  DISTNAME=              cacti-0.8.8a
 -PKGREVISION=           7
 +PKGREVISION=           8
  CATEGORIES=            net
  MASTER_SITES=          http://www.cacti.net/downloads/

 @@ -33,9 +33,9 @@ PKG_USERS_VARS+=      CACTI_USER
  PKG_GROUPS_VARS+=      CACTI_GROUP

  BUILD_DEFS+=           PKG_SYSCONFBASE
 -PKG_SYSCONFSUBDIR?=    httpd
  EGDIR=                 ${PREFIX}/share/examples/cacti
 -CONF_FILES+=           ${EGDIR}/httpd-cacti.conf ${PKG_SYSCONFDIR}/httpd-cacti.conf
 +CONF_FILES+=           ${EGDIR}/config.php ${PKG_SYSCONFDIR}/cacti/config.php
 +OWN_DIRS=              ${PKG_SYSCONFDIR}/cacti
  CACTIDIR=              ${PREFIX}/share/cacti
  CACTI_LOGDIR?=         ${CACTIDIR}/log
  CACTI_RRADIR?=         ${CACTIDIR}/rra
 @@ -73,6 +73,7 @@ SPECIAL_PERMS+=               share/cacti/log/cacti.l

  INSTALLATION_DIRS=      share/examples/cacti
  INSTALLATION_DIRS+=    share/cacti
 +AUTO_MKDIRS=           yes

  post-extract:
         ${CP} ${FILESDIR}/httpd-cacti.conf ${WRKDIR}/
 @@ -84,6 +85,8 @@ do-install:
         ${INSTALL_DATA} ${WRKDIR}/httpd-cacti.conf ${DESTDIR}${EGDIR}/httpd-cacti.conf
         ${FIND} ${WRKSRC} -type f -name '*.orig' -exec ${RM} -f {} \;
         cd ${WRKSRC} && ${PAX} -wr * ${DESTDIR}${CACTIDIR}
 +       ${MV} ${DESTDIR}${CACTIDIR}/include/config.php ${DESTDIR}${EGDIR}/config.php
 +       ${LN} -s ${PKG_SYSCONFDIR}/config.php ${DESTDIR}${CACTIDIR}/include/config.php


  .include "../../databases/rrdtool/buildlink3.mk"

 PLIST : 
 --- PLIST       12 Dec 2012 10:48:43 -0000      1.3
 +++ PLIST       18 Oct 2013 12:12:47 -0000
 @@ -1,4 +1,4 @@
 -@comment $NetBSD: PLIST,v 1.3 2012/12/12 10:48:43 wiz Exp $
 +@comment $NetBSD$
  share/cacti/LICENSE
  share/cacti/README
  share/cacti/about.php
 @@ -494,4 +494,5 @@ share/cacti/templates_import.php
  share/cacti/tree.php
  share/cacti/user_admin.php
  share/cacti/utilities.php
 +share/examples/cacti/config.php
  share/examples/cacti/httpd-cacti.conf


 --
 Nils

From: Nils Ratusznik <nils.netbsd@anotherhomepage.org>
To: gnats-bugs@NetBSD.org
Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org, 
	dholland-pbugs@netbsd.org
Subject: Re: pkg/47189: Cacti configuration file is overwritten
Date: Tue, 14 Jan 2014 18:38:45 +0100 (CET)

 Hi,

 should I improve something in the patches before they can be committed ?

 Thanks,

 -- 
 Nils

From: "OBATA Akio" <obache@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/47189: Cacti configuration file is overwritten
Date: Wed, 15 Jan 2014 11:08:04 +0900

 On Wed, 15 Jan 2014 03:55:19 +0900, Nils Ratusznik <nils.netbsd@anotherhomepage.org> wrote:

 >  should I improve something in the patches before they can be committed ?

 1. original CONF_FILES line should be kept
 2. movement of config.php should be in before PAX, or it will overwritten with USE_DESTDIR=no
 3. config files may not be in ${PKG_SYSCONFDIR} and it may be kept in default location,
     or users may be confused (mismach with upstream original document.

 -- 
 OBATA Akio / obache@NetBSD.org

NetBSD Home
NetBSD PR Database Search

(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.