Bug 1338039

Summary: scripts run through "at" ignore SIGPIPE due to systemd, atd@.service needs IgnoreSIGPIPE=no
Product: Red Hat Enterprise Linux 7 Reporter: giulioo
Component: atAssignee: Tomas Mraz <tmraz>
Status: CLOSED ERRATA QA Contact: Radka Brychtova <rskvaril>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: jscotka, rskvaril
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: at-3.1.13-22.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-04 03:30:06 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description giulioo 2016-05-20 21:03:19 UTC
Description of problem:
Scripts run through "at" will ignore SIGPIPE sue to atd being tun from systemd which defaults to IgnoreSIGPIPE=yes

Version-Release number of selected component (if applicable):
at-3.1.13-20.el7.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Create this script

#!/bin/sh
/usr/bin/seq 1 1000000|/usr/bin/head -n 1  >/tmp/my.out
/usr/bin/perl -le 'print $SIG{PIPE}' >> /tmp/my.out

2.
echo /path/script|at "now +1 minutes"

Actual results:
1. /tmp/my.out will contain 
   1
   IGNORE
2. /var/spool/mail/<user> will contain an email with
   /usr/bin/seq: write error: Broken pipe

Expected results:
1. /tmp/my.out will contain 
   1
   
2. No email

Additional info:

The file /usr/lib/systemd/system/atd.service needs
IgnoreSIGPIPE=no
in [Service] section

Comment 5 Radka Brychtova 2016-06-09 09:21:59 UTC
OLD PACKAGE
at-3.1.13-20.el7.x86_64

running reproducer: 
:: [   PASS   ] :: Command 'echo '#!/bin/sh
:: [   PASS   ] :: /usr/bin/seq 1 1000000|/usr/bin/head -n 1  >/tmp/my.out
:: [   PASS   ] :: /usr/bin/perl -le 'print {PIPE}' >> /tmp/my.out
:: [   PASS   ] :: ' > /tmp/tmp.vnQQ84kQ0d/testscript.sh' (Expected 0, got 0)
:: [  BEGIN   ] :: Running 'chmod +x /tmp/tmp.vnQQ84kQ0d/testscript.sh'
:: [   PASS   ] :: Command 'chmod +x /tmp/tmp.vnQQ84kQ0d/testscript.sh' (Expected 0, got 0)
:: [  BEGIN   ] :: Running 'echo $TmpDir/testscript.sh |at "now +1 minutes"'
job 1 at Thu Jun  9 08:53:00 2016
:: [   PASS   ] :: Command 'echo $TmpDir/testscript.sh |at "now +1 minutes"' (Expected 0, got 0)
:: [   PASS   ] :: File '/tmp/my.out' should contain '1' 
:: [   FAIL   ] :: File '/var/spool/mail/root' should not contain '/usr/bin/seq: write error: Broken pipe' 

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

NEW PACKAGE
at-3.1.13-22.el7.x86_64

running reproducer:
:: [   PASS   ] :: Command 'echo '#!/bin/sh
:: [   PASS   ] :: /usr/bin/seq 1 1000000|/usr/bin/head -n 1  >/tmp/my.out
:: [   PASS   ] :: /usr/bin/perl -le 'print {PIPE}' >> /tmp/my.out
:: [   PASS   ] :: ' > /tmp/tmp.S7tx9LXGyG/testscript.sh' (Expected 0, got 0)
:: [  BEGIN   ] :: Running 'chmod +x /tmp/tmp.S7tx9LXGyG/testscript.sh'
:: [   PASS   ] :: Command 'chmod +x /tmp/tmp.S7tx9LXGyG/testscript.sh' (Expected 0, got 0)
:: [  BEGIN   ] :: Running 'echo $TmpDir/testscript.sh |at "now +1 minutes"'
job 1 at Thu Jun  9 04:51:00 2016
:: [   PASS   ] :: Command 'echo $TmpDir/testscript.sh |at "now +1 minutes"' (Expected 0, got 0)
:: [   PASS   ] :: File '/tmp/my.out' should contain '1' 
:: [   PASS   ] :: There is no new email


Since this test Passed on all architectures => verified

Comment 7 errata-xmlrpc 2016-11-04 03:30:06 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2311.html