From owner-freebsd-ports-bugs@FreeBSD.ORG Wed Feb 27 08:10:01 2008 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 483E9106566B for ; Wed, 27 Feb 2008 08:10:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 230C213C4EC for ; Wed, 27 Feb 2008 08:10:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m1R8A17O090940 for ; Wed, 27 Feb 2008 08:10:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m1R8A1sE090939; Wed, 27 Feb 2008 08:10:01 GMT (envelope-from gnats) Resent-Date: Wed, 27 Feb 2008 08:10:01 GMT Resent-Message-Id: <200802270810.m1R8A1sE090939@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Adrian Penisoara Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20CDA106566B for ; Wed, 27 Feb 2008 08:01:27 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 0D2E613C448 for ; Wed, 27 Feb 2008 08:01:27 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m1R7weXW084785 for ; Wed, 27 Feb 2008 07:58:40 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.2/8.14.1/Submit) id m1R7weRj084784; Wed, 27 Feb 2008 07:58:40 GMT (envelope-from nobody) Message-Id: <200802270758.m1R7weRj084784@www.freebsd.org> Date: Wed, 27 Feb 2008 07:58:40 GMT From: Adrian Penisoara To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/121141: [ports] fix apcaccess functionality in apcupsd package X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Feb 2008 08:10:01 -0000 >Number: 121141 >Category: ports >Synopsis: [ports] fix apcaccess functionality in apcupsd package >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Feb 27 08:10:00 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Adrian Penisoara >Release: 7.0-RC3 >Organization: EntepriseBSD >Environment: FreeBSD husky.ady.ro 7.0-RC3 FreeBSD 7.0-RC3 #0: Sun Feb 24 20:26:26 EET 2008 root@husky.ady.ro:/usr/obj/usr/src/sys/HUSKY i386 >Description: In recent sysutils/apcupsd package versions the apcaccess tool has been "downsized" to its minimal "status" functionality, thus the developer(s) have stripped down a lot of code from it -- from the Changelog: 2007-08-03 11:17 adk0212 * src/apcaccess.c: Remove lots of obsolete code. 'status' is now the only supported option. However, together with this "downsizing" operation some critical functionality: the tools is not able anymore to fetch the apcuspd daemon binding point (host:port) from its configuration file; by default it can query only the localhost:3551 address. This will impact running the tool for non-default apcupsd configurations. While it previously was able to correctly read daemon binding point from the configuration file, it can no longer do so in the new versions. >How-To-Repeat: Configure your apcupsd daemon (in /usr/local/etc/apcupsd/apcupsd.conf) to run on a non-default IP and/or port. Running the "apcaccess [status]" command will fail now, including when ran from the default-action scripts like "commok" , "offbattery, "onbattery", etc. This will show up in email reports and web interface. >Fix: I have backported some minimal code from the 3.12.4 sources to restore the missing functionality (reading host:port configuration from the configuration file). See patch attached (raises PORTREVISION). Patch attached with submission follows: diff -ruN apcupsd.orig/Makefile apcupsd/Makefile --- apcupsd.orig/Makefile 2007-10-21 13:39:38.000000000 +0300 +++ apcupsd/Makefile 2008-02-27 09:39:19.659171480 +0200 @@ -7,6 +7,7 @@ PORTNAME= apcupsd PORTVERSION= 3.14.2 +PORTREVISION= 1 CATEGORIES= sysutils MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:S/$/:src_sf/g} \ http://sce-tindy.tecnik93.com/FreeBSD/ports/${PORTNAME}/sources/:src_bk \ diff -ruN apcupsd.orig/files/patch-aa apcupsd/files/patch-aa --- apcupsd.orig/files/patch-aa 1970-01-01 02:00:00.000000000 +0200 +++ apcupsd/files/patch-aa 2008-02-27 09:36:59.310547004 +0200 @@ -0,0 +1,51 @@ +--- src/apcaccess.c.orig 2007-08-03 18:17:38.000000000 +0300 ++++ src/apcaccess.c 2008-02-27 09:30:39.352400647 +0200 +@@ -62,11 +62,19 @@ + int main(int argc, char **argv) + { + int mode = 0; ++ UPSINFO *ups = NULL; ++ ++ char *cfgfile = APCCONF; ++ struct stat cfgstat; + + #ifdef HAVE_MINGW + WSA_Init(); /* init MS networking */ + #endif + ++ ups = attach_ups(ups); ++ if (!ups) ++ Error_abort0(_("Cannot attach SYSV IPC.\n")); ++ + if (argc < 2) { + /* Assume user wants "status" */ + mode = 2; +@@ -87,6 +95,20 @@ + *p++ = 0; + port = atoi(p); + } ++ } else { ++ /* check configuration so local NISIP and NISPORT variables can be used as ++ defaults */ ++ if (!stat(cfgfile, &cfgstat)) { ++ check_for_config(ups, cfgfile); ++ ++ if (ups) { ++ if (ups->nisip && ups->nisip[0]) ++ host = ups->nisip; ++ ++ if (ups->statusport) ++ port = ups->statusport; ++ } ++ } + } + + if (!*host || strcmp(host, "0.0.0.0") == 0) +@@ -101,5 +123,7 @@ + Error_abort0(_("Strange mode\n")); + } + ++ detach_ups(ups); ++ + return 0; + } >Release-Note: >Audit-Trail: >Unformatted: