Bug 25518 - logrotate-3.5.4 leaves temp files in debug mode
Summary: logrotate-3.5.4 leaves temp files in debug mode
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: logrotate   
(Show other bugs)
Version: 1.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Preston Brown
QA Contact: David Lawrence
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-02-01 20:21 UTC by Jarno Huuskonen
Modified: 2007-04-18 16:31 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-06-25 07:51:02 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

Description Jarno Huuskonen 2001-02-01 20:21:34 UTC
If logrotate is run in debug mode (-d) it leaves temp files in /tmp.

This happens in rotateLogSet: mkstemp is used to create the file
but it's unlinked only if the debug is not set (see the if statement
on line 639).

Comment 1 Preston Brown 2001-06-21 20:10:05 UTC
mkstemp is only called from runScript.  runScript has the following snippet near the 
top:

    if (debug) {
	message(MESS_DEBUG, "running script with arg %s: \"%s\"\n", 
		logfn, script);
	return 0;
    }


Then two lines down:
    strcpy(filespec, "/tmp/logrotate.XXXXXX");
    if ((fd = mkstemp(filespec)) < 0 || fchmod(fd, 0700)) {

So mkstemp isn't even called when you are in debug mode.
Are you sure about this bug?  I don't see how it is possible.


Comment 2 Jarno Huuskonen 2001-06-25 07:50:58 UTC
Perhaps we're looking at different logrotate versions (3.5.4), but on
logrotate.c:int rotateLogSet
if (log->errAddress) {
    message(MESS_DEBUG, "errors will be mailed to %s\n", log->errAddress);

    strcpy(errorFileName, "/tmp/logrotate.XXXXXX");
    if ((newerr = mkstemp(errorFileName)) < 0) {
      message(MESS_ERROR, "error creating temporary file %s\n",
              errorFileName);

...
if (log->errAddress && !debug) {
...
    unlink(errorFileName);
^^^^^^
unlink is called if !debug, perhaps it is intentional ?





Comment 3 Preston Brown 2001-08-06 18:04:33 UTC
Newer versions have dropped this segment of code.



Note You need to log in before you can comment on or make changes to this bug.