Bug#792777: fails to send email on failure; falls over on circle at start of systemctl status

2018-10-21 Thread Jörg Sommer
Jörg Sommer hat am Sa 20. Okt, 11:29 (+0200) geschrieben:
> On Sat, 18 Jul 2015 15:25:06 +0200 Alexandre Detiste 
>  wrote:
> > control: tag -1 moreinfo
> > 
> > Hi,
> > 
> > I can't find the correct environnement needed to reproduce this bug.
> 
> I'm having the same problem. This is the environment of the script
> `mail_on_failure` when called from *systemd*
> 
> ```
> USER=nobody
> HOME=/nonexistent
> LOGNAME=nobody
> JOURNAL_STREAM=8:15023569
> PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
> INVOCATION_ID=8f1cf292d7024ede9aa1cb66dc58bef4
> PWD=/
> ```

I've found a workaround: Set the environment in the service file. Run
`systemctl edit cron-failure@.service` and insert

```
[Service]
Environment=LC_ALL=C.UTF-8
```

Regards Jörg

-- 
Life can only be understood backwards, but it must be lived forwards.
 (Soren Kierkegaard)


signature.asc
Description: PGP signature


Bug#792777: fails to send email on failure; falls over on circle at start of systemctl status

2018-10-20 Thread Jörg Sommer
On Sat, 18 Jul 2015 15:25:06 +0200 Alexandre Detiste 
 wrote:
> control: tag -1 moreinfo
> 
> Hi,
> 
> I can't find the correct environnement needed to reproduce this bug.

I'm having the same problem. This is the environment of the script
`mail_on_failure` when called from *systemd*

```
USER=nobody
HOME=/nonexistent
LOGNAME=nobody
JOURNAL_STREAM=8:15023569
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
INVOCATION_ID=8f1cf292d7024ede9aa1cb66dc58bef4
PWD=/
```

With this I can reproduce the error:

```
# env -i $(
systemctl = subprocess.check_output(['systemctl','status',job], 
universal_newlines=True)
  File "/usr/lib/python3.5/subprocess.py", line 316, in check_output
**kwargs).stdout
  File "/usr/lib/python3.5/subprocess.py", line 385, in run
stdout, stderr = process.communicate(input, timeout=timeout)
  File "/usr/lib/python3.5/subprocess.py", line 788, in communicate
stdout = self.stdout.read()
  File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal 
not in range(128)
```

```
# cat /etc/debian_version
9.5
# dpkg -l systemd systemd-sysv init-system-helpers python3
ii  init-system-helpers   1.48
ii  python3   3.5.3-1
ii  systemd   232-25+deb9u4
ii  systemd-sysv  232-25+deb9u4
```

Bye Jörg
-- 
Leben – es gibt nichts Selteneres auf der Welt. Die meisten Menschen
existieren, weiter nichts.
   (Oscar Wilde: Der Sozialismus und die Seele des Menschen)


signature.asc
Description: PGP signature


Bug#792777: fails to send email on failure; falls over on circle at start of systemctl status

2015-07-18 Thread Alexandre Detiste
control: tag -1 moreinfo

Hi,

I can't find the correct environnement needed to reproduce this bug.

This should work both in UTF-8  Ascii mode.

When systemctl detect it is run with LANG=C LC_CTYPE=C, the circle got replaced 
by a star (*).

I expect mail_on_failure.py  systemctl would always share the same environment,
so I can't se ho this error happens.


Can you communicate the env values needed to trigger this bug ?

Here is a little tweak to run pgm repeatedly without sending a ton of mails.

-p = Popen(['sendmail','-i','-B8BITMIME',mailto], stdin=PIPE)
+p = Popen(['cat'], stdin=PIPE)

 So, the 0xe2 it falls over on is the very first character, the circle
 
 ● cron-joey-joey-1.service - [Cron] @reboot mpd

 Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
 Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
This seems ok

Alexandre Detiste

PS: maybe that would go away with python 3.5
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=784330#25


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



Bug#792777: fails to send email on failure; falls over on circle at start of systemctl status

2015-07-18 Thread Joey Hess
Package: systemd-cron
Version: 1.5.2-1
Severity: normal

Jul 18 08:41:26 darkstar systemd[1]: Starting [Cron] @reboot mpd...
Jul 18 08:41:26 darkstar sh[1906]: Jul 18 08:41 : socket: Failed to bind to 
'[::]:6600': Address already in use
Jul 18 08:41:26 darkstar systemd[1]: cron-joey-joey-1.service: Main process 
exited, code=exited, status=1/FAILURE
Jul 18 08:41:26 darkstar systemd[1]: Failed to start [Cron] @reboot mpd.
Jul 18 08:41:26 darkstar systemd[1]: cron-joey-joey-1.service: Unit entered 
failed state.
Jul 18 08:41:26 darkstar systemd[1]: cron-joey-joey-1.service: Triggering 
OnFailure= dependencies.
Jul 18 08:41:26 darkstar systemd[1]: cron-joey-joey-1.service: Failed with 
result 'exit-code'.
Jul 18 08:41:26 darkstar systemd[1]: Created slice system-cron\x2dfailure.slice.
Jul 18 08:41:26 darkstar systemd[1]: Starting system-cron\x2dfailure.slice.
Jul 18 08:41:26 darkstar systemd[1]: Starting systemd-cron OnFailure for 
cron-joey-joey-1...
Jul 18 08:41:26 darkstar mail_on_failure[1909]: Traceback (most recent call 
last):
Jul 18 08:41:26 darkstar mail_on_failure[1909]: File 
/lib/systemd-cron/mail_on_failure, line 43, in module
Jul 18 08:41:26 darkstar mail_on_failure[1909]: systemctl = 
subprocess.check_output(['systemctl','status',job], universal_newlines=True)
Jul 18 08:41:26 darkstar mail_on_failure[1909]: File 
/usr/lib/python3.4/subprocess.py, line 609, in check_output
Jul 18 08:41:26 darkstar mail_on_failure[1909]: output, unused_err = 
process.communicate(inputdata, timeout=timeout)
Jul 18 08:41:26 darkstar mail_on_failure[1909]: File 
/usr/lib/python3.4/subprocess.py, line 949, in communicate
Jul 18 08:41:26 darkstar mail_on_failure[1909]: stdout = 
_eintr_retry_call(self.stdout.read)
Jul 18 08:41:26 darkstar mail_on_failure[1909]: File 
/usr/lib/python3.4/subprocess.py, line 491, in _eintr_retry_call
Jul 18 08:41:26 darkstar mail_on_failure[1909]: return func(*args)
Jul 18 08:41:26 darkstar mail_on_failure[1909]: File 
/usr/lib/python3.4/encodings/ascii.py, line 26, in decode
Jul 18 08:41:26 darkstar mail_on_failure[1909]: return 
codecs.ascii_decode(input, self.errors)[0]
Jul 18 08:41:26 darkstar mail_on_failure[1909]: UnicodeDecodeError: 'ascii' 
codec can't decode byte 0xe2 in position 0: ordinal not in range(128)
Jul 18 08:41:26 darkstar systemd[1]: cron-failure@cron-joey-joey-1.service: 
Main process exited, code=exited, status=1/FAILURE
Jul 18 08:41:26 darkstar systemd[1]: Failed to start systemd-cron OnFailure for 
cron-joey-joey-1.
Jul 18 08:41:26 darkstar systemd[1]: cron-failure@cron-joey-joey-1.service: 
Unit entered failed state.
Jul 18 08:41:26 darkstar systemd[1]: cron-failure@cron-joey-joey-1.service: 
Failed with result 'exit-code'.

This seems to be trying to mail the output of systemctl status.

joey@darkstar:~systemctl  status cron-joey-joey-1.service|hexdump -C
  e2 97 8f 20 63 72 6f 6e  2d 6a 6f 65 79 2d 6a 6f  |... cron-joey-jo|
0010  65 79 2d 31 2e 73 65 72  76 69 63 65 20 2d 20 5b  |ey-1.service - [|
0020  43 72 6f 6e 5d 20 22 40  72 65 62 6f 6f 74 20 6d  |Cron] @reboot m|
0030  70 64 22 0a 20 20 20 4c  6f 61 64 65 64 3a 20 6c  |pd.   Loaded: l|

So, the 0xe2 it falls over on is the very first character, the circle

● cron-joey-joey-1.service - [Cron] @reboot mpd

-- Package-specific info:
-- output of systemd-delta

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages systemd-cron depends on:
ii  init-system-helpers  1.23
ii  python3  3.4.3-4
ii  systemd-sysv 222-1

Versions of packages systemd-cron recommends:
ii  postfix [mail-transport-agent]  2.11.3-1

systemd-cron suggests no packages.

-- no debconf information

-- 
see shy jo


signature.asc
Description: Digital signature