Bug 290531 - poptReadDefaultConfig reads /etc/popt twice
Summary: poptReadDefaultConfig reads /etc/popt twice
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: popt
Version: rawhide
Hardware: All
OS: Linux
medium
low
Target Milestone: ---
Assignee: Robert Scheck
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-09-14 08:00 UTC by Ralf Corsepius
Modified: 2008-01-15 23:11 UTC (History)
1 user (show)

Fixed In Version: 1.13-1.fc8
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-01-15 23:11:57 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Ralf Corsepius 2007-09-14 08:00:06 UTC
Description of problem:

poptReadDefaultConfig reads /etc/popt twice

Version-Release number of component (if applicable):
popt-1.12-3.fc8

How reproducible:
Deterministic

Compile this program and debug/strace it:
include <popt.h>
int main(int argc, char *argv[] )
{
  poptContext ctx;
  ctx = poptGetContext( argv[0], argc, argv, NULL, 0);
  poptReadDefaultConfig( ctx, 1 );
}


Steps to Reproduce:
1. compile this program:

cat foo.c
include <popt.h>
int main(int argc, char *argv[] )
{
  poptContext ctx;
  ctx = poptGetContext( argv[0], argc, argv, NULL, 0);
  poptReadDefaultConfig( ctx, 1 );
}


2. debug or strace it.

  
Actual results:

# strace -o bla ./foo
# grep /etc/popt bla 
open("/etc/popt", O_RDONLY|O_LARGEFILE) = 3
open("/etc/popt", O_RDONLY|O_LARGEFILE) = 3


Expected results:
/etc/popt being opened only once.

Additional info:
The cause is this:

From poptconfig.c
...
    rc = poptReadConfigFile(con, POPT_SYSCONFDIR "/popt");
    if (rc) return rc;

    rc = poptReadConfigFile(con, "/etc/popt");
    if (rc) return rc;
...

If popt is being configured with --sysconfdir=/etc this causes the code fragment
above to read /etc/popt twice.

Comment 1 Robert Scheck 2007-09-14 11:56:33 UTC
Thanks for the report, Ralf. The problem was resolved in upstream CVS, further 
information here: http://www.rpm5.org/cvs/chngview?cn=8385 - IMHO this is only 
nasty and not critical nor should it cause any issue. I would wait for the next 
popt release instead of backporting it from CVS.

Comment 2 Ralf Corsepius 2007-09-14 12:14:09 UTC
(In reply to comment #1)
> IMHO this is only 
> nasty and not critical nor should it cause any issue. I would wait for the next 
> popt release instead of backporting it from CVS.
Does popt allow recursive aliases/defines or similar?

Then, this issue could cause pretty ugly effects, because each time /etc/popt is
being read, a macro/alias/define would change itself, i.e. this issue would
cause malfunctions.



Comment 3 Robert Scheck 2007-09-14 12:49:48 UTC
There are no recursive things, the last definition always wins. Otherwise I 
would have pushed an update already.

Comment 4 Robert Scheck 2007-12-30 21:59:14 UTC
Package: popt-1.13-1.fc8 Tag: dist-f8-updates-candidate Status: complete
Package: popt-1.13-1.fc9 Tag: dist-f9 Status: complete

An update for Fedora 8 is around the corner and already requested for testing 
repository. Please test it carefully and reopen the bug report, if it doesn't 
solve the problem for you. Please also add a comment at bodhi:

https://admin.fedoraproject.org/updates/F8/pending/popt-1.13-1.fc8

Comment 5 Fedora Update System 2008-01-03 01:39:40 UTC
popt-1.13-1.fc8 has been pushed to the Fedora 8 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update popt'

Comment 6 Fedora Update System 2008-01-15 23:11:50 UTC
popt-1.13-1.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.


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