Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 254242

Summary: sys-power/apcupsd - default MTA setting could be set to a better default for Gentoo
Product: Gentoo Linux Reporter: Gordon Pritchard <gordonp>
Component: Current packagesAssignee: Diego Elio Pettenò (RETIRED) <flameeyes>
Status: RESOLVED FIXED    
Severity: normal CC: base-system, burnsmellfactory
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Gordon Pritchard 2009-01-08 16:04:01 UTC
The APC UPS daemon has the ability to mail alerts.  The default MTA is specified in /etc/apcupsd/changeme, and could be better-set as /bin/mail rather than /usr/sbin/sendmail.  The action of the default /usr/sbin/sendmail results in a mis-parsing of the message, instead sending a message to bogus recipients: one recipient for each word in the text of the alert-Subject.

Reproducible: Always

Steps to Reproduce:
1. generate some sort of apcupsd alert, such as "low battery"
2. watch for mail-arrival, which was sent to ~dozen bogus recipients, one for each word in the Subject: field.  Probably only one will actually reach you, the specified admin, but you will see all the others in the To: field.
3. wonder who received all the other bogus emails

Actual Results:  
Multiple To: recipients for an apcupsd alert, one for each word in the Subject: field.

Expected Results:  
Should be a single To: recipient only.

FIX:  simply change the ebuild-default value in /etc/apcupsd/changeme

From:
APCUPSD_MAIL="/usr/sbin/sendmail"

To:
APCUPSD_MAIL="/bin/mail"

Behaviour is now as-expected.

I don't believe it's helpful, but here is emerge --info for one system (of many I admin that exhibit this behaviour):

Portage 2.1.6.4 (default/linux/x86/2008.0/desktop, gcc-4.1.2, glibc-2.6.1-r0, 2.6.27-gentoo-r7 i686)
=================================================================
System uname: Linux-2.6.27-gentoo-r7-i686-AMD_Athlon-TM-_XP_2400+-with-glibc2.0
Timestamp of tree: Thu, 08 Jan 2009 09:15:02 +0000
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p39
dev-java/java-config: 1.3.7-r1, 2.1.6-r1
dev-lang/python:     2.5.2-r7
dev-util/ccache:     2.4-r7
dev-util/cmake:      2.4.6-r1
sys-apps/baselayout: 2.0.0
sys-apps/openrc:     0.3.0-r1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.63
sys-devel/automake:  1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=athlon-xp -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/splash /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -march=athlon-xp -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://mirror.iat.sfu.ca/gentoo http://gentoo.osuosl.org http://gentoo.arcticnetworks.ca"
LANG="en_GB.UTF-8"
LC_ALL="en_GB.UTF-8"
LDFLAGS="-Wl,-O1"
LINGUAS="en en_GB zh zh_CN"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://musashi.iat.sfu.ca/gentoo-portage"
USE="X a52 aac acl acpi alsa avi bash-completion beagle berkdb bluetooth branding browserplugin bzip2 cairo cdparanoia cdr cjk cli cracklib crypt cups dbus divx dri dvd dvdr dvdread eds emacs emboss encode evo exif fam fbcondecor ffmpeg firefox flac fortran gcj gdbm gif gimpprint gnome gphoto2 gpm gstreamer gtk gtk2 gtkhtml gzip hal iconv ieee1394 imagemagick imap imlib immqt ipv6 isdnlog jack java jpeg jpeg2k lcms ldap libg++ libnotify libwww lirc lm_sensors mad midi mikmod mmx mng mono mp3 mpeg mpeg4 mudflap ncurses nfs nls nowlistening nptl nptlonly nsplugin nvidia ogg oggvorbis opengl openmp pam pcre pda pdf perl php pic png ppds pppd python qt qt3 qt3support qt4 quicktime readline reflection sdl seamonkey session slp spell spl sse sse2 ssl startup-notification svg sysfs tar tcltk tcpd tiff truetype unicode usb userlocales utf8 vorbis webdav win32codecs wmf x86 xcomposite xine xinerama xml xml2 xorg xulrunner xv zeroconf zip zlib" ALSA_CARDS="cmipci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en en_GB zh zh_CN" USERLAND="GNU" VIDEO_CARDS="nvidia vesa fbdev"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 1 Diego Elio Pettenò (RETIRED) gentoo-dev 2009-01-15 15:20:31 UTC
*** Bug 201628 has been marked as a duplicate of this bug. ***
Comment 2 Diego Elio Pettenò (RETIRED) gentoo-dev 2009-01-15 15:23:25 UTC
Taking over. Michael you let this package rot so much, since I need it, I'm going to take it over and take care.

Please don't say I didn't give you enough notice, last year I already asked you this much and now I'm simply tired.
Comment 3 Diego Elio Pettenò (RETIRED) gentoo-dev 2009-01-15 15:24:23 UTC
Fixed in 3.14.5, thanks.
Comment 4 Gordon Pritchard 2009-01-15 15:36:51 UTC
Thank-you (very much!).
Comment 5 Michael Yagliyan 2009-01-18 02:29:11 UTC
Using mailx, the 'echo "Subject: $MSG"' line becomes redundant since there is already a '-s "$MSG"' option specified to the mailx command.  In fact, mailx will just read that 'Subject:' line as part of the message body, so $MSG will actually appear three times in the email.  Twice in the body and once in the subject.  I think all the /etc/apcupsd/ scripts should be changed from:
   echo "Subject: $MSG"
   echo " "
   echo "$MSG"
   echo " "
   /sbin/apcaccess status
to:
   echo "$MSG"
   echo
   /sbin/apcaccess status