[CMake] CPack 2.8.7 RPM: hiding /etc/init.d from %files list

Eric Noulard eric.noulard at gmail.com
Mon Jan 9 02:08:49 EST 2012


2012/1/9 Deborah Pickett <Deborah.Pickett at autodesk.com>:
> Hi Eric,
>
> On 06/01/2012, at 7:36 PM, Eric Noulard wrote:
>
>>> From a ton of googling, consensus seems to be that for directories that you "know" are on the target system, you don't have to list them in the %files list.  I'm confident that /etc/init.d is in this category.
>>
>> I think you are right for that and we should add a list of "don't"
>> include directories,
>> or more generally
>> We should add
>>
>> CPACK_RPM_FILTER_FILELIST
>> [...]
>> You are welcome to file a bug report on that.
>
> I will, but I think I found an underlying bug too... read on.
>
>> I think there is an unexpected [nasty] workaround...
>> [...]
>> This should work. At least it works on my small test here.
>> Please tell us if it works for you.
>
> Almost.  The RPM compiles with the %ignore'd comment (lovely dirty hack, by the way).  But the resulting RPM still has the offending directory:
>
> $ rpm -q --filesbypkg -p mypackage.rpm
> mypackage /etc
> mypackage /etc/init.d
> mypackage /etc/init.d/mydaemon
> [...]
>
> Hand-editing the .spec file and completely removing the %ignore line, and it's still being included.
>
> I think I found out why.  When I pack verbosely, I get these warnings from rpmbuild:
>
> warning: File listed twice: /etc/init.d/mydaemon
> warning: File listed twice: /etc/sysconfig
> warning: File listed twice: /etc/sysconfig/autodesk
> warning: File listed twice: /etc/sysconfig/autodesk
> warning: File listed twice: /etc/sysconfig/autodesk/mydaemon
> warning: File listed twice: /etc/sysconfig/autodesk/mydaemon
> warning: File listed twice: /etc/sysconfig/autodesk/mydaemon
> [...]
>
> What's happening is that CPack is putting directories in the %files list (as it should) but it isn't tagging them with the %dir directive, so rpmbuild is doing a little mini "find . -print" on each line in %files, and ends up re-including /etc/init.d when it processes /etc.
>
> About the %dir directive: http://www.rpm.org/max-rpm/s1-rpm-inside-files-list-directives.html#S3-RPM-INSIDE-DIR-DIRECTIVE

You are right, we should tag dir as "%dir" .

> I confirmed that by %ignore-ing /etc too:
> SET(CPACK_RPM_jobmanager_USER_FILELIST "%ignore /etc" "%ignore /etc/init.d")
> (%dir would have worked for /etc too) and now the RPM correctly has only mydaemon and not its ancestors:
> $ rpm -q --filesbypkg -p /tmp/mypackage.rpm
> mypackage /etc/init.d/mydaemon
>
> NOW the workaround succeeds.

Good catch and nice analysis.

> So here's my assertion:
>
> CPackRPM should be explicitly marking directories with "%dir" in the %files list, to prevent rpmbuild from recursively including each directory's descendants implicitly.
>
> That's a pretty big change in behaviour, though.  What do other users of CPackRPM think?  Perhaps it's never actually come up because we haven't had CPACK_RPM_USER_FILELIST for long enough for anyone to notice.
>
>> Ok with, but on my side I do happily review clean patches :-]
>
> I'll file a bug report for the %dir "File listed twice" issue as well as a placeholder for your suggested CPACK_RPM_FILTER_FILELIST variable.  Then I'll get to work on some patches.

I think the double inclusion of file/dir due to the missing %dir is a plain bug,
I cannot imagine a situation where not including %dir would lead to a
regression.
So go ahead for the bug report "File listed twice"
and answer to ML with the bug report number in order to create a link.
Off course anyone having strong opinion (and argument) for not fixing this
or with potential regression example should step up and comment on the ML
and/or the bug tracker.

Moreover this must have appeared when fixing this:
http://public.kitware.com/Bug/view.php?id=12305
which was only included in 2.8.6.

This should have been silently ignored by most of us because
it was harmless and unnoticeable until you have too look into rpmbuild log...

> Thanks for the hack.  I've now got a workaround until 2.8.8. :)

You are welcome.
Thank you for your investigation.

I'll review your patch proposal for inclusion in 2.8.8.

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list