Bug 1279952 - cronolog -l fails to update its symlink when log is deleted or too big
cronolog -l fails to update its symlink when log is deleted or too big
Status: NEW
Product: Fedora EPEL
Classification: Fedora
Component: cronolog (Show other bugs)
All Linux
unspecified Severity high
: ---
: ---
Assigned To: Ken Dreyer
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2015-11-10 10:05 EST by Jim Toth
Modified: 2017-01-08 00:50 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 411441
Last Closed:
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 Jim Toth 2015-11-10 10:05:19 EST
+++ This bug was initially created as a clone of Bug #411441 +++

Looks like this is still a problem in epel7.  I know for certain it is currently a problem in epel6, and since it appears the last patch (vs rebuilds, etc) was in 1.6.2-5 and epel6 is using 1.6.2-10, I feel confident it's a problem in 7.

The specific use case we have is if a particular pipe doesn't get any traffic for a full day (e.g. because a host in development or is only used for failover), the file the symlink is pointing to gets gzipped, at which time it's broken (and thus cronolog stops updating it).

(Original description below).

Description of problem:
when cronolog is used with the -l (or equivalents like -H and -S) it won't be
able to update that link if any of the following common situations happen :

1) log file the link is pointing to gets deleted
2) log file the link is pointing to is bigger than 2GB in 32bit environments

Version-Release number of selected component (if applicable):
1.6.2-6 (or any other previous release)

How reproducible:

Steps to Reproduce:
1. start cronolog with -l
2. either delete the linked file (not the link) or wait until it goes over 2GB
in a 32bit architecture
3. wait for cronolog to try to rotate the log
Actual results:
link is never updated until process is restarted and link manually deleted

Expected results:
link should be updated normally

Additional info:
first case reported upstream and has a proposed fix (now upstream site is down
so it can't be retrieved from there) which was meant to be included in the next

the patch is available as part of the gentoo package for cronolog and a cache of
the report can be retrieved from google from :

since the affected function doesn't have any valid error detection and the
proposed patch doesn't support case 2, a different fix is proposed which has
also the added benefit of protecting against similar failures when using the -P

--- Additional comment from Arenas Belon, Carlo Marcelo on 2007-12-04 21:57:16 EST ---

--- Additional comment from Arenas Belon, Carlo Marcelo on 2007-12-05 14:17:17 EST ---

disregard this patch, the logic got mixed up by excesive refactoring, but the
principle is still valid (stat calls are not valid when testing for the
existence of symlinks and since there is no error checking they are irrelevant
anyway when unlink could be called instead and the error ignored)

--- Additional comment from Arenas Belon, Carlo Marcelo on 2007-12-06 11:28:31 EST ---

essentially the same patch posted before, and even if it looks confusing
because of the unified patch format has been validated to be correct with all
combination of affected flags "-S, -H, -l, -P" and for both cases reported.

upstreamed patch (or suggestion for a patch) also covers both cases out of luck
and the fact that there is no error checking in that function, but the logic is
incorrect as it still stats the linked file and not the link for prevlinkname
(-P) and relies on the fact that even when that fails the link is overwritten
by the following rename call.

for a test case do (in a system with more than 2GB of memory, or a very fast
disk with ample free disk space)

  cat /dev/zero | cronolog -l log %Y%m%d%H%M.log

--- Additional comment from Arenas Belon, Carlo Marcelo on 2007-12-18 00:11:45 EST ---

upstream is back online with the following being a report of this bug which was
never resolved (from the "Known Bugs" page in http://cronolog.org/bugs.html) :


and this being the proposed fix which is the one that was referenced on that old
cached record :


--- Additional comment from Arenas Belon, Carlo Marcelo on 2007-12-18 00:29:35 EST ---

the jumbo patch (all patches are linked into the "patches" page in
http://cronolog.org/patches/index.html) and that was meant to be part of release
1.7.0 which never got out of beta, has a different implementation of this
solution which extends the original fix to also uses lstat for prevlinkname
(because using stat is logically incorrect as I mentioned earlier) and as can be
seen in :


a similar fix was re-implemented while looking for a solution to this bug and
later discarded and replaced by the proposed fix, because even though it adds a
little more error checking and is logically correct it is not portable (and
portability for it wasn't checked at "configure" time) and the final solution is
more complex and still missing error checking for the other calls (rename and
unlink) and therefore not complete.
Comment 1 Ken Dreyer 2017-01-08 00:50:15 EST
cronolog.org is no more.

You might want to submit these patches to the new GitHub upstream repo: https://github.com/fordmason/cronolog

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