Bug 290531 - poptReadDefaultConfig reads /etc/popt twice
poptReadDefaultConfig reads /etc/popt twice
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: popt (Show other bugs)
rawhide
All Linux
medium Severity low
: ---
: ---
Assigned To: Robert Scheck
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-09-14 04:00 EDT by Ralf Corsepius
Modified: 2008-01-15 18:11 EST (History)
1 user (show)

See Also:
Fixed In Version: 1.13-1.fc8
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-01-15 18:11:57 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ralf Corsepius 2007-09-14 04:00:06 EDT
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 07:56:33 EDT
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 08:14:09 EDT
(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 08:49:48 EDT
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 16:59:14 EST
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-02 20:39:40 EST
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 18:11:50 EST
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.