Bug 255720

Summary: nss-mdns package, built for Factory, breaks nameservice
Product: [openSUSE] openSUSE.org Reporter: Wolfgang Rosenauer <wolfgang>
Component: BuildServiceAssignee: Michael Schröder <mls>
Status: RESOLVED FIXED QA Contact: Adrian Schröter <adrian.schroeter>
Severity: Critical    
Priority: P5 - None CC: mls, mrueckert, ro, sbrabec
Version: unspecified   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: Other Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Wolfgang Rosenauer 2007-03-19 07:14:22 UTC
If I run a local "osc build" on the factory tree (most probably) build changes my host system's local /etc/nsswitch.conf to the one of factory. The difference is only this line:
hosts:          files mdns_minimal [NOTFOUND=return] dns mdns
This breaks name resolution for many applications obviously!

10.2 x86-64
osc-0.9-40.1
build-2007.03.12-3.1
Comment 1 Wolfgang Rosenauer 2007-03-19 07:17:11 UTC
I'm not sure if "build" is the problem since the only hint of nsswitch in init_buildsystem seems to work correctly and the local file is changed before the nis flags removal is actually done at all.
So either any other part of build is modifying the local file or some scriptlet from any installed RPM is doing weird stuff (what shouldn't happen because of the   build-root). So I wasn't able to find the cause yet.
Comment 2 Peter Poeml 2007-03-20 10:36:21 UTC
Michael?
Comment 3 Michael Schröder 2007-03-20 10:57:09 UTC
Me? Dunno, I'll have to reproduce this. A simple grep over the sources didn't reveal anything suspicious.
Comment 4 Peter Poeml 2007-03-29 00:01:26 UTC
The nss-mdns package has a %posttrans script which does the change.
Seems that the script is run outside the build chroot.
Comment 5 Michael Schröder 2007-04-03 10:32:46 UTC
Grrr, posttrans suck. I'm considering to remove support for it, as it is so buggy. And you're using it for completely wrong reasons, it is not meant to be as a replacement for "%post" that is run after the uninstall scripts. 
Comment 6 Stanislav Brabec 2007-04-03 11:30:07 UTC
I guess it can be a duplicate of bug 235361.

Well. If you remove %posttrans, we will have to reopen bug 48114 and add non-optimal code to about 100 GNOME packages.
Comment 7 Peter Poeml 2007-04-12 10:44:37 UTC
If this bug cannot be fixed in a timely manner, please consider working
around by disabling the stuff in the nss-mdns package in Factory for
now.

It keeps breaking users machines setup, when they build packages for
Factory, and it is very hard to find for them.
Comment 8 Stanislav Brabec 2007-04-12 11:38:23 UTC
As a work-around:

Is there any way, how to detect from %posttrans, that RPM was called with --noscritps or --test?

Note that nss-mdns scriptlet should be root aware - it refers to etc/nsswitch.conf, not /etc/nsswitch.conf.
Comment 9 Michael Schröder 2007-04-12 11:56:44 UTC
Ah, I know what the problem is. Reordering is done with the rpm from the "outer" system, where #235361 isn't fixed. Tough, I can't do much about that. Maybe a --root to some dummy root might help. Or just update your rpm...
I can't imagine a workaround for the package, just don't use pre/posttrans. 
Comment 10 Stanislav Brabec 2007-04-12 12:06:41 UTC
It's not easy to stop using %posttrans:

cd /work/SRC/all
grep -l '^%posttrans' */*.spec */*/*.spec | wc -l
87

Maybe ask user to update and add fixed rpm to the repository where osc resides:

if ! rpm -q --changelog rpm | grep 235361 ; then
    echo "Your RPM does not have #235361 fixed. Please update it from ..."
fi

(Does not work for Debian/Fedora users.)
Comment 11 Michael Schröder 2007-04-12 14:16:53 UTC
Adding --root seems to do the trick...
Comment 12 Michael Schröder 2007-04-12 15:24:06 UTC
Please update to build-2007.04.12