Bug 210129 - sysutils/apcupsd: Update to 3.14.14
Summary: sysutils/apcupsd: Update to 3.14.14
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Emanuel Haupt
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2016-06-08 09:19 UTC by Leonid Nevecherya
Modified: 2016-12-04 10:50 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (itetcu)


Attachments
Update_to_1.3.14 (3.24 KB, patch)
2016-06-08 09:19 UTC, Leonid Nevecherya
no flags Details | Diff
Update_to_1.3.14 ver2 (4.92 KB, patch)
2016-06-09 18:06 UTC, Leonid Nevecherya
no flags Details | Diff
apcupsd-3.14.14-without-tcp-wrappers (3.18 KB, patch)
2016-06-14 13:36 UTC, Danilo G. Baio
no flags Details | Diff
Update_to_1.3.14 ver3 (13.49 KB, patch)
2016-06-15 10:37 UTC, Leonid Nevecherya
nevecherya: maintainer-approval? (itetcu)
vlad-fbsd: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Leonid Nevecherya 2016-06-08 09:19:44 UTC
Created attachment 171194 [details]
Update_to_1.3.14

3.14.14 -- 31 May 2016 
BUG FIXES
  * win32: Fix missing DLLs when installing only apctray
  * Fixes for socket error handling. Resolves apcaccess crash when connection fails as well as several other theoretical issues.
  * MODBUS/USB error handling (COMMLOST) improvements for faulty USB links
  * Fix hiddev binding when usbfs is mounted on /dev/bus/usb instead of /proc/bus/usb. This is necessary for switching between MODBUS/USB and USB/HID on Linux.
  * Update GPLv2 text and FSF address to match current versions from FSF.
  * Various fixes for potential issues suggested by Coverity Scan
  * MacOS X port support for El Capitan System Integrity Protection (SIP) aka "rootless"
  * Fix shutdown failure on Windows when UPSNAME includes spaces
  * Fix building bsd-usb driver (This was broken when modbus-usb support was added.)
FEATURES
  * Add status display for output current as well as apparent power
Comment 1 Leonid Nevecherya 2016-06-09 18:06:57 UTC
Created attachment 171238 [details]
Update_to_1.3.14 ver2

Addition patch of configure and autoconf/configure.in.
I am not sure that it needed.
Comment 2 Danilo G. Baio freebsd_committer 2016-06-14 13:36:50 UTC
Created attachment 171424 [details]
apcupsd-3.14.14-without-tcp-wrappers

Hi.

The configure patch is needed on older versions of FreeBSD. 8.X (not supported anymore) and 9.X. 

I've tried like you the approach on apcnis.c and it didn't work. It breaks NIS server and apcaccess.

-----------------------------------------
# /usr/local/etc/rc.d/apcupsd start
Starting apcupsd.

# netstat -an | grep 3551
tcp4       0      0 *.3551                 *.*                    LISTEN

# ps ax | grep apcupsd
 7042  -  Ss       0:00.08 /usr/local/sbin/apcupsd --kill-on-powerfail

# apcaccess
Error reading status from apcupsd @ localhost:3551: Connection reset by peer

# netstat -an | grep 3551
EMPTY

# ldd /usr/local/sbin/apcupsd
/usr/local/sbin/apcupsd:
	libwrap.so.6 => /usr/lib/libwrap.so.6 (0x80084d000)
	libusb.so.3 => /usr/lib/libusb.so.3 (0x800a56000)
	libc++.so.1 => /usr/lib/libc++.so.1 (0x800c69000)
	libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x800f28000)
	libm.so.5 => /lib/libm.so.5 (0x801145000)
	libthr.so.3 => /lib/libthr.so.3 (0x80136e000)
	libc.so.7 => /lib/libc.so.7 (0x801593000)
	libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x801940000)

-----------------------------------------

This happens because on older versions of apcupsd is used a hacked tcpd.h, and now on 3.14.14 is used the tcpd.h from the system.

Dropping the option TCP_WRAPPERS will bypass this problem. Nowadays it's not even used. If this approach is accepted, deserves an entry on /usr/ports/UPDATING ?

Attached the patch.

Poudriere builds fine on 9.3 (amd64|i386), 10.3 (amd64|i386) and 11 (amd64|i386)

Regards.
Comment 3 Leonid Nevecherya 2016-06-14 19:53:20 UTC
I test my "Update_to_1.3.14 ver2" attachment #171238 [details] on FreeBSD 9.3 and 10.3.
All (apcupsd as server, apcaccess, apcupsd as client, CGI multimon) WORK with option TCP_WRAPPERS!
Of course "older versions of apcupsd is used a hacked tcpd.h, and now on 3.14.14 is used the tcpd.h from the system."
Functions used in older versions of apcupsd from the hacked tcpd.h require parameter, but not functions from system tcpd.d
I patch all calls functions from tcpd.h to disable this parameter.
Comment 4 Leonid Nevecherya 2016-06-14 20:14:00 UTC
This is client apcupsd-3.14.14 to server apcupsd-3.14.14 (FreeBSD 10.3) output:

# pkg version -v | grep apcupsd
apcupsd-3.14.14                    >   succeeds index (index has 3.14.13)

# apcaccess
APC      : 001,040,0981
DATE     : 2016-06-14 23:07:27 +0300
HOSTNAME : ***
VERSION  : 3.14.14 (31 May 2016) freebsd
UPSNAME  : ***
CABLE    : Ethernet Link
DRIVER   : NETWORK UPS Driver
UPSMODE  : Stand Alone
STARTTIME: 2016-06-14 23:07:26 +0300
MASTERUPD: 2016-06-14 23:07:27 +0300
MASTER   : *.*.*.*:3551
MODEL    : Smart-UPS 2200 RM
STATUS   : ONLINE SLAVE
LINEV    : 217.4 Volts
LOADPCT  : 24.0 Percent
BCHARGE  : 100.0 Percent
TIMELEFT : 35.0 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME  : 0 Seconds
OUTPUTV  : 217.4 Volts
SENSE    : High
LOTRANS  : 208.0 Volts
HITRANS  : 253.0 Volts
RETPCT   : 15.0 Percent
ITEMP    : 27.9 C
BATTV    : 55.1 Volts
LINEFREQ : 50.0 Hz
LASTXFER : Low line voltage
NUMXFERS : 0
TONBATT  : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
SELFTEST : NO
STATFLAG : 0x05000408
SERIALNO : ***
BATTDATE : 2015-12-16
NOMOUTV  : 230 Volts
NOMBATTV : 48.0 Volts
FIRMWARE : 665.4.I USB FW:2.3
END APC  : 2016-06-14 23:07:31 +0300
Comment 5 Danilo G. Baio freebsd_committer 2016-06-14 21:39:34 UTC
Hi Leonid.

Maybe I missed something on my test.

I will try "Update_to_1.3.14 ver2" again on my system.

Regards.
Comment 6 Danilo G. Baio freebsd_committer 2016-06-14 23:37:42 UTC
Hi.

Trying attachment 171238 [details].

It didn't work on my environment, check this debug log:
http://dbaio.bs2cloud.com.br/FreeBSD/apcupsd_debug.txt

The segmentation fault occurs when runs apcaccess command.

Poudriere build log:
http://dbaio.bs2cloud.com.br/poudriere/data/103amd64-default/2016-06-14_19h40m20s/logs/apcupsd-3.14.14.log

Package:
http://dbaio.bs2cloud.com.br/pkgng/103amd64-default/All/apcupsd-3.14.14.txz

Have any idea ?

Maybe because the master apcupsd is still on 3.14.12 ?

Regards.
Comment 7 Leonid Nevecherya 2016-06-15 08:40:27 UTC
Hmm... 
I build may version with option TCP_WRAPPERS on amd64 arch and...
It's crash!
It's work on i386 arch. It's work without option TCP_WRAPPERS on amd64 arch.
Comment 8 Leonid Nevecherya 2016-06-15 10:37:57 UTC
Created attachment 171458 [details]
Update_to_1.3.14 ver3

I turned back hacked tcpd.h from version 3.14.13.
The apcupsd don't crash with option TCP_WRAPPERS on amd64 architecture.
Please retest.
Comment 9 Danilo G. Baio freebsd_committer 2016-06-15 16:59:37 UTC
Nice, with attachment 171458 [details] worked here.

But I think we should propose a patch like attachment 171458 [details]. Without changes on tcpd.h. Dropping TCP_WRAPPERS option because IMHO it is not used anymore... it's just messing around. Do you agree ?

On NetBSD and OpenBSD apcupsd doesn't have support for TCP_WRAPPERS. Only linux RPMs are still building with it.

But it's just a thought... what itetcu@ or other committer think about it ?

Regards.
Comment 10 VK freebsd_triage 2016-10-12 22:18:13 UTC
Maintainer timeout, back to the pool.
Comment 11 VK freebsd_triage 2016-10-12 22:19:11 UTC
Comment on attachment 171458 [details]
Update_to_1.3.14 ver3

Implicit approval based on timeout, not attachment review.
Comment 12 commit-hook freebsd_committer 2016-12-04 10:31:26 UTC
A commit references this bug:

Author: ehaupt
Date: Sun Dec  4 10:30:48 UTC 2016
New revision: 427764
URL: https://svnweb.freebsd.org/changeset/ports/427764

Log:
  Update to 3.14.14

  PR:		210129
  Submitted by:	nevecherya@gmail.com
  Approved by:	maintainer-timeout (itetcu)

Changes:
  head/sysutils/apcupsd/Makefile
  head/sysutils/apcupsd/distinfo
  head/sysutils/apcupsd/files/patch-configure
  head/sysutils/apcupsd/files/patch-include_apc.h
  head/sysutils/apcupsd/files/patch-include_tcpd.h
Comment 13 Emanuel Haupt freebsd_committer 2016-12-04 10:50:13 UTC
Committed, thanks!