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

Bug 553294

Summary: sys-process/cronbase: mixed up output of scripts from cron.* directories
Product: Gentoo Linux Reporter: Amadeusz Żołnowski (RETIRED) <aidecoe>
Component: [OLD] Core systemAssignee: Cron Team <cron-bugs+disabled>
Status: RESOLVED DUPLICATE    
Severity: enhancement    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: run-crons-script-prefix.patch

Description Amadeusz Żołnowski (RETIRED) gentoo-dev 2015-06-26 09:04:17 UTC
When scripts are executed from cron.* directories, the mailed output is mixed up. It is hard to say which output applies to each script.

Reproducible: Always

Steps to Reproduce:
1.Add some scripts to cron.* dirs which produce output.
2.Wait until cronie executes these scripts.
3.Check mail.
Actual Results:  
Concatenated output of all scripts.


Expected Results:  
Output from various scripts should distinguished.


I'm attaching a simple patch solving the problem.
Comment 1 Amadeusz Żołnowski (RETIRED) gentoo-dev 2015-06-26 09:04:55 UTC
Created attachment 405780 [details, diff]
run-crons-script-prefix.patch
Comment 2 SpanKY gentoo-dev 2015-07-23 03:04:01 UTC
Comment on attachment 405780 [details, diff]
run-crons-script-prefix.patch

rather than prefix each line, should be able to do:

  $SCRIPT 2>&1 | sed "1i${SCRIPT}:"

if script produces no output, then sed won't do anything, but as soon as it produces at least one line, sed will add a header like:
  /etc/cron.daily/foo:

unfortunately though, this now conflicts with bug 491520 where we track the exit status and bug 530416 where we use POSIX shell (so we can't check PIPESTATUS).
Comment 3 SpanKY gentoo-dev 2015-07-23 03:04:15 UTC

*** This bug has been marked as a duplicate of bug 540274 ***