Python and /etc/resolv.conf changes

Mike McGrath mmcgrath at redhat.com
Wed Jan 21 02:02:01 UTC 2009


On Tue, 20 Jan 2009, Jesse Keating wrote:

> I'm looking at what might be a bug in python.  The anaconda installer
> launches python, then we get network configs going and write out some
> files such as /etc/resolv.conf.  However that original python process
> can't seem to resolve anything after this file has been written out,
> whereas new python processes started on a different terminal can indeed
> use the new /etc/resolv.conf data.
>
> My thought is that the original python process is using stale
> information, and that something like a res_init() is needed, but google
> doesn't seem to have any real connection between python and calling
> res_init.  The guys in #python on freenode aren't exactly sure what to
> do here either.
>
> In fact, I just did a simple test of an strace on python, where I import
> socket, do a lookup, modify /etc/resolv.conf, do more lookups and review
> the results.  Strace shows that python opens /etc/resolv.conf exactly
> once (after I've imported socket), and never again, so it never sees any
> of the changes made.
>
> Can anybody confirm what I'm seeing as buggy and in need of fixing?
>

I believe this might be the same thing that happens to preupgrade and
smolt.  It's a hacky fix but here's how we dealt with it:

http://tinyurl.com/8lz8gh

	-Mike




More information about the devel mailing list