Bug 25518 - logrotate-3.5.4 leaves temp files in debug mode
logrotate-3.5.4 leaves temp files in debug mode
Product: Red Hat Raw Hide
Classification: Retired
Component: logrotate (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Preston Brown
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2001-02-01 15:21 EST by Jarno Huuskonen
Modified: 2007-04-18 12:31 EDT (History)
0 users

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

Attachments (Terms of Use)

  None (edit)
Description Jarno Huuskonen 2001-02-01 15:21:34 EST
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 16:10:05 EDT
mkstemp is only called from runScript.  runScript has the following snippet near the 

    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 03:50:58 EDT
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",

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

Comment 3 Preston Brown 2001-08-06 14:04:33 EDT
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.