Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 553294 - sys-process/cronbase: mixed up output of scripts from cron.* directories
Summary: sys-process/cronbase: mixed up output of scripts from cron.* directories
Status: RESOLVED DUPLICATE of bug 540274
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Cron Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-26 09:04 UTC by Amadeusz Żołnowski (RETIRED)
Modified: 2015-07-23 03:04 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
run-crons-script-prefix.patch (run-crons-script-prefix.patch,549 bytes, patch)
2015-06-26 09:04 UTC, Amadeusz Żołnowski (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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 ***