|Summary:||rpmbuild gives misleading/meaningless "Package already exists" errors|
|Product:||[Retired] Red Hat Linux||Reporter:||Gilles Detillieux <grdetil>|
|Component:||rpm-build||Assignee:||Jeff Johnson <jbj>|
|Status:||CLOSED WORKSFORME||QA Contact:|
|Fixed In Version:||Doc Type:||Bug Fix|
|Doc Text:||Story Points:||---|
|Last Closed:||2003-04-14 18:43:55 UTC||Type:||---|
|oVirt Team:||---||RHEL 7.3 requirements from Atomic Host:|
|Cloudforms Team:||---||Target Upstream Version:|
Description Gilles Detillieux 2003-04-11 22:03:51 UTC
Description of problem: Under Red Hat 9, rpmbuild rejected a couple of my .spec files, giving the very unhelpful error message: error: Package already exists: %package debuginfo After hours of scratching my head, fruitlessly searching for the origin and meaning of this message, I found out by systematically hacking off bits of my .spec file that what it was choking on was a comment in %changelog that made reference to %install, e.g.: - cleaned up %install to make use of new features Removing the "%" made rpmbuild happy. Version-Release number of selected component (if applicable): 4.2-0.69 How reproducible: Consistently Steps to Reproduce: 1. Add a comment like the one above containing the string "%install" to the %changelog section of just about any .spec file. 2. "rpmbuild -bp your.spec" Actual results: error: Package already exists: %package debuginfo Expected results: Something that would at least remotely suggest where the problem might actually lie, or better still not treating the above, normal condition, as an error. Additional info:
Comment 1 Jeff Johnson 2003-04-14 18:23:32 UTC
Yes, the redhat-rpm-config package is overloading %install, so innocent uses of %install now get expanded in mysterious ways. Escaping the % (i.e. "%%install" not "%install") in comment is the best fix.
Comment 2 Gilles Detillieux 2003-04-14 18:36:15 UTC
Thanks, Jeff. Your response explains why rpmbuild now has problems with the %install in the changelog, but it doesn't explain why the error message is so misleading. What does 'error: Package already exists: %package debuginfo' have to do with anything that I was doing? If it gave a useful message like error: Section already exists: %install instead, I wouldn't have wasted hours trying to figure out what could possibly be the problem with my .spec files.
Comment 3 Jeff Johnson 2003-04-14 18:43:55 UTC
There are two objects both with name "%install". The first is a section marker, this is the object you know well. The other is a macro, which is expanded wherever found, and, in this case, is being used as a vehicle to carry a definition for a -debuginfo sub-package into a spec file just before the %install section. Unfortunately, if "%install" is used elsewhere, then there are unintended side effects. The config is in /usr/lib/rpm/redhat/macros if you're interested. BTW, this is a requested feature that -debuginfo packages can be produced w/o changing spec files, although is is very mysterious.
Comment 4 Gilles Detillieux 2003-04-14 19:18:55 UTC
This is all very informative, but it only confirms my suspicion that without some pretty intimate knowledge of how rpmbuild works internally, a casual user doesn't have a hope of understanding this particular error message. If it's too difficult to change the error message to give a bit of context as to where the error occurs (even just a .spec file line number would be a HUGE help), then there really ought to be a section in the rpmbuild man page that gives a proper explanation of what this error message means. Red Hat 9 has only been out a week, so I don't think I'm going to be the only user to be totally baffled by this very mysterious message.
Comment 5 Greg Ercolano 2004-11-25 17:39:27 UTC
I have to agree with Gilles, having been through the same process myself with the exact same error, and not knowing wtf was wrong. I had to hack off the bottom half of my spec file, basically the entire %changelog section which had some comments containing %%'s, and others having single %'s (which seemed to be causing the problem). There were so many single %'s, that it was easier to just remove the whole changelog to get things working. -greg