Bug 1723265

Summary: recursion fails when broken symlink is present
Product: Red Hat Enterprise Linux 8 Reporter: Cédric Jeanneret <cjeanner>
Component: logrotateAssignee: Kamil Dudka <kdudka>
Status: CLOSED ERRATA QA Contact: Frantisek Sumsal <fsumsal>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.1CC: bdobreli, fsumsal, kdudka, msecaur, pmatilai
Target Milestone: rc   
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: logrotate-3.14.0-4.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-04 01:59:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Cédric Jeanneret 2019-06-24 05:34:00 UTC
Hello,

Description of problem:
popt as shipped on RHEL-8.1 breaks recursion when we have a broken symlink in the tree.

This is affecting "logrotate" and other application based on popt.

Version-Release number of selected component (if applicable):


How reproducible:
Always (using logrotate as a "popt enabled app")


Steps to Reproduce:
1. create a directory tree with a broken symlink, and put files in that tree
2. configure logrotate to manage this tree
3. run logrotate with "-d" option, using the crafted configuration

Actual results:
popt (hence logrotate) doesn't see anything

Expected results:
popt (hence logrotate) should at least list the files in that tree

Additional info:
An upstream github issue was opened against logrotate first: https://github.com/logrotate/logrotate/issues/251
Apparently popt website doesn't exist anymore, so no way to open a bug on their side.

Thank you!

Cheers,

C.

Comment 1 Panu Matilainen 2019-06-24 07:09:31 UTC
Upstream seems confused, popt does not implement any globbing beyond using glibc's glob() for finding its own config files.
As I pointed out in the upstream ticket, logrotate *could* be affected by this glibc fix to revert a long-standing broken behavior on glob() regarding broken symlinks: https://sourceware.org/bugzilla/show_bug.cgi?id=866.

Reassigning to logrotate, until proven otherwise this is strictly between logrotate and glibc.

Comment 2 Kamil Dudka 2019-06-24 07:49:08 UTC
The upstream bug report you refer to is about a different issue -- whether symlinks should be included in the glob result or not.  However, Cédric is reporting an issue about regular files not being processed when a broken symlink appears in the directory being globbed.  I have not tried to reproduce it myself.  It could be logrotate's issue as you say.

Panu, could you please clarify the situation about popt's upstream?  Does it still exist?

If yes, the URL in popt.spec should be updated.  Do you need a separate bug report for that?

Comment 3 Panu Matilainen 2019-06-24 08:05:56 UTC
We sheltered popt at https://github.com/rpm-software-management/popt just a couple of weeks ago due to upstream vanishing for the second time within a year, but we beyond that I don't know yet what, if anything, is going to happen. So updating URL's is premature at this point.

As for the issue itself, I just pointed out the glibc issue because it seems closely related - I can quite easily imagine code which does not expect to see broken symlinks (due to the longstanding glibc behavior) from glob() doing unexpected things when those broken symlinks are suddenly there again. Unexpected things such as stopping with error code and returning nothing. But that's just a guess, I didn't try reproducing either because I don't see how popt could be involved in this at all.

Comment 4 Kamil Dudka 2019-06-28 16:37:55 UTC
Panu was right.  This is a bug of logrotate.  I have pushed a fix upstream:

https://github.com/logrotate/logrotate/commit/4297f011

Comment 11 errata-xmlrpc 2020-11-04 01:59:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (logrotate bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:4538

Comment 12 Kamil Dudka 2021-11-08 16:22:33 UTC
*** Bug 2021216 has been marked as a duplicate of this bug. ***