Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My understanding is that if I specify the %dir directive under the %files list, RPM will not list any files under that directory. Doing this can allow you to set specific permissions for the directory in question (or user, group etc). However I still get "files listed twice warning" messages when in addition to the directory that is specified I also explicitly list the files. This sounds daft I know, but the files have different permissions to the directory which is why I need to define the directory separately using the %dir directive.

If I was not using the %dir directive then yes I would expect to see these warning messages.

Am I correct?


Actually, the file listed twice seems to only appear when I combine the %dir directive with the %config directive.

So the following is fine with no warning messages:

%dir %attr(0755,testuser,test) /app/product/tracking-tool/bin/
%dir %attr(0755,testuser,test) /app/product/tracking-tool/bin/scripts/

%attr(0755,vscc_prod,vscc) /app/product/tracking-tool/bin/
%attr(0755,vscc_prod,vscc) /app/product/tracking-tool/bin/
%attr(0755,vscc_prod,vscc) /app/product/tracking-tool/bin/
%attr(0755,vscc_prod,vscc) /app/product/tracking-tool/bin/scripts/

But the following results in warning messages:

%config %dir %attr(0755,testuser,test)  /app/product/tracking-tool/config/
%config %dir %attr(0755,testuser,test)  /app/product/tracking-tool/config/properties
%config %dir %attr(0755,testuser,test)  /app/product/tracking-tool/config/other

%config %attr(0644,testuser,test)  /app/product/tracking-tool/config/xmlconfig.xml
%config %attr(0644,testuser,test)  /app/product/tracking-tool/config/properties/
%config %attr(0600,testuser,test)  /app/product/tracking-tool/config/properties/test.txt
%config %attr(0600,testuser,test)  /app/product/tracking-tool/config/other/other.txt

Warning appear as follows:

[WARNING] warning: File listed twice: /app/product/tracking-tool/config/xmlconfig.xml
[WARNING] warning: File listed twice: /app/product/tracking-tool/config/properties/
[WARNING] warning: File listed twice: /app/product/tracking-tool/config/properties/test.txt
[WARNING] warning: File listed twice: /app/product/tracking-tool/config/other/other.txt
share|improve this question

1 Answer 1

As far as I'm aware the %config directive doesn't allow additional directives after it since it's just used to mark files as configuration files. Try something like this (I'm still not 100% sure the %config directive works for directories, the documentation doesn't say whether it does or not):

%config /app/product/tracking-tool/config/xmlconfig.xml
%config /app/product/tracking-tool/config/properties/
%config /app/product/tracking-tool/config/other/other.txt
%dir %attr(0755,testuser,test) /app/product/tracking-tool/config/ 
%dir %attr(0755,testuser,test) /app/product/tracking-tool/config/properties
%dir %attr(0755,testuser,test) /app/product/tracking-tool/config/other
%attr(0644,testuser,test) /app/product/tracking-tool/config/xmlconfig.xml
%attr(0644,testuser,test) /app/product/tracking-tool/config/properties/
%attr(0600,testuser,test) /app/product/tracking-tool/config/properties/test.txt
%attr(0600,testuser,test) /app/product/tracking-tool/config/other/other.txt
share|improve this answer
%config applies to files only, not directories, because of the action(s) undertaken (e.g. installing as *.rpmnew if file is modified) when %config is processed. There is no simple definition for what a "modified" directory might mean, nor is renaming a modified directory a reasonable/useful definition when "modified". – Jeff Johnson Nov 25 at 16:03
Good to know, thanks @JeffJohnson. I've updated my answer to remove the directory, but left the questioning portion so hopefully people review your comment. – Forrest Nov 26 at 0:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.