Bug#661485: smartmontools: smartd-runner fails to send email to more than one recipient

2021-05-12 Thread John Denker
Here is a replacement for bug 988384.
This is a better place for it.



*** Expected, documented, and desired behavior:

In /etc/smartd.conf it is permitted to specify multiple email recipients.
Here is the relevant snippet:

###
DEFAULT -d removable -n standby \
-a -M test  \
-s S/../.././01 \
-m root,blakeney,reid,delavega,wayne \
-M exec /usr/share/smartmontools/smartd-runner
###

The last line is relevant, and the next-to-last line is super-relevant, insofar 
as it contains a comma-separated list of recipients.

The code in smartd itself handles this just fine, and always has.

*** Observed bad behavior:

I observe that the smartd-runner script throws away all recipients after the 
first.

*** Remark:

The root problem is that smartd-runner assumes it will be called with exactly 
three arguments.
It can be expected that this will cause multiple bugs, not just the one 
reported here.

*** Patch to fix the problem

A patch file is attached.

Compared to others that have been suggested, this patch is superior in
a couple of ways:
*) It accepts an /arbitary/ number of arguments and passes them to the
run-parts script(s) appropriately.
*) It is agnostic as to the number, format, and semantics of the
arguments.

*** Platform details

ProblemType: Bug
ApportVersion: 2.20.11-0ubuntu27.17
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: MATE
Date: Mon May 10 07:13:51 2021
Dependencies:
 debianutils 4.9.1
 gcc-10-base 10.2.0-5ubuntu1~20.04
 libc6 2.31-0ubuntu9.2
 libcap-ng0 0.7.9-2.1build1
 libcrypt1 1:4.4.10-10ubuntu4
 libgcc-s1 10.2.0-5ubuntu1~20.04
 libgcrypt20 1.8.5-5ubuntu1
 libgpg-error-l10n 1.37-1
 libgpg-error0 1.37-1
 libidn2-0 2.2.0-2
 liblz4-1 1.9.2-2
 liblzma5 5.2.4-1ubuntu1
 libpcre2-8-0 10.34-7
 libselinux1 3.0-1build2
 libstdc++6 10.2.0-5ubuntu1~20.04
 libsystemd0 245.4-4ubuntu3.6
 libunistring2 0.9.10-2
 lsb-base 11.1.0ubuntu2
DistroRelease: Ubuntu 20.04
InstallationDate: Installed on 2010-07-10 (3957 days ago)
InstallationMedia: Ubuntu 10.04 LTS "Lucid Lynx" - Release amd64 (20100429)
Package: smartmontools 7.1-1build1 [modified: 
usr/share/smartmontools/smartd-runner]
PackageArchitecture: amd64
ProcCpuinfoMinimal:
 processor  : 1
 vendor_id  : GenuineIntel
 cpu family : 6
 model  : 23
 model name : Intel(R) Core(TM)2 Duo CPU T9600  @ 2.80GHz
 stepping   : 10
 microcode  : 0xa07
 cpu MHz: 800.000
 cache size : 6144 KB
 physical id: 0
 siblings   : 2
 core id: 1
 cpu cores  : 2
 apicid : 1
 initial apicid : 1
 fpu: yes
 fpu_exception  : yes
 cpuid level: 13
 wp : yes
 flags  : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov 
pat pse36 clflush dts acpi mmx fxsr sse sse2 ht tm pbe syscall nx lm 
constant_tsc arch_perfmon pebs bts nopl cpuid aperfmperf pni dtes64 monitor 
ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm sse4_1 xsave lahf_lm pti tpr_shadow 
vnmi flexpriority vpid dtherm ida
 vmx flags  : vnmi flexpriority tsc_offset vtpr vapic
 bugs   : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds 
swapgs itlb_multihit
 bogomips   : 5585.85
 clflush size   : 64
 cache_alignment: 64
 address sizes  : 36 bits physical, 48 bits virtual
 power management:
ProcEnviron:
 TERM=xterm
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: smartmontools
Tags:  focal
Uname: Linux 5.11.0+ x86_64
UpgradeStatus: Upgraded to focal on 2020-08-09 (273 days ago)
_MarkForUpload: True
modified.conffile..etc.default.apport: [modified]
modified.conffile..etc.default.smartmontools: [modified]
modified.conffile..etc.smartd.conf: [modified]
mtime.conffile..etc.default.apport: 2020-08-09T18:38:49.803212
mtime.conffile..etc.default.smartmontools: 2010-11-12T20:22:37
mtime.conffile..etc.smartd.conf: 2016-05-14T13:58:08.981915

/// sent Mon 10 May 2021  7:35:45 AM MST
https://bugs.launchpad.net/ubuntu/+source/smartmontools/+bug/1927980

/// patch is:
--- smartd-runner#orig  2021-05-06 03:25:01.324133900 -0700
+++ smartd-runner   2021-05-10 07:00:08.342798348 -0700
@@ -3,8 +3,15 @@
 tmp=$(tempfile)
 cat >$tmp
 
-run-parts --report --lsbsysinit --arg=$tmp --arg="$1" \
---arg="$2" --arg="$3" -- /etc/smartmontools/run.d
+# Decorate every one of our args with "--arg=".
+# Use an array, since each arg might contain spaces.
+args=("$@")
+cmd=()
+for ((ii=0; ii<${#args[@]}; ii++)); do
+  cmd[$ii]="--arg=${args[$ii]}"
+done
 
-rm -f $tmp
+run-parts --report --lsbsysinit --arg=$tmp \
+ "${cmd[@]}" -- /etc/smartmontools/run.d
 
+rm -f $tmp



Bug#661485: smartmontools: smartd-runner fails to send email to more than one recipient

2020-04-20 Thread David Osolkowski
This bug appears to still be present in version 6.6-1, the current in
buster. Additionally, Jawaad's proposed patch (no longer?) appears to
work, as it provides the multiple recipients space-delimited, where
mail wants them to be comma-delimited, at least for me. In
smartd-runner, I changed:

recipients="${@}"

to:

IFS=","
recipients="$*"

which appears to work, but I won't claim this is perfect. Maybe the
10mail script could be changed instead? Happy to help develop or test
an acceptable solution and get this bug closed after eight years.



Bug#661485: smartmontools: smartd-runner fails to send email to more than one recipient

2017-05-29 Thread Jawaad Ahmad
Gabriele's fix will only work for two recipients.

I modified the smartd-runner script as follows for additional recipients as
I needed three:

#run-parts --report --lsbsysinit --arg=$tmp --arg="$1" \
#--arg="$2" --arg="$3" -- /etc/smartmontools/run.d
subject_opt="${1}"
shift

subject="${1}"
shift

recipients="${@}"

run-parts --report --lsbsysinit --arg=$tmp --arg="${subject_opt}" \
--arg="${subject}" --arg="${recipients}" -- /etc/smartmontools/run.d


Bug#661485: smartmontools: smartd-runner fails to send email to more than one recipient

2012-02-27 Thread Gabriele Vivinetto
Package: smartmontools
Version: 5.39.1+svn3124-2
Severity: normal


Using more than one email recipient in /etc/smartd.conf using the syntax
-m fi...@example.com,sec...@example.com
results in the second email recipient to be ignored.
I solved adding in /usr/share/smartmontools/smartd-runner in line 7 one more 
argument:
 --arg=$2 --arg=$3 --arg=$4 -- /etc/smartmontools/run.d


-- Package-specific info:
Output of /usr/share/bug/smartmontools:
# CONFIG_IDE_TASK_IOCTL is not set

-- System Information:
Debian Release: 6.0.4
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages smartmontools depends on:
ii  debianutils 3.4  Miscellaneous utilities specific t
ii  libc6   2.11.3-3 Embedded GNU C Library: Shared lib
ii  libcap-ng0  0.6.4-1  An alternate posix capabilities li
ii  libgcc1 1:4.4.5-8GCC support library
ii  libselinux1 2.0.96-1 SELinux runtime shared libraries
ii  libstdc++6  4.4.5-8  The GNU Standard C++ Library v3
ii  lsb-base3.2-23.2squeeze1 Linux Standard Base 3.2 init scrip

Versions of packages smartmontools recommends:
ii  bsd-mailx [mailx]  8.1.2-0.20100314cvs-1 simple mail user agent

Versions of packages smartmontools suggests:
pn  gsmartcontrol none (no description available)
pn  smart-notifiernone (no description available)

-- Configuration Files:
/etc/default/smartmontools changed:
start_smartd=yes

/etc/smartd.conf changed:
DEVICESCAN -d removable \
   -a -o on -S on \
   -s (S/../.././05|L/../../7/03) \
   -m fi...@example.com,sec...@example.com \
   -M test \
   -M daily \
   -M exec /usr/share/smartmontools/smartd-runner


-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org