Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

UPDATE:

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:

%files
%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/run.sh
%attr(0755,vscc_prod,vscc) /app/product/tracking-tool/bin/count.sh
%attr(0755,vscc_prod,vscc) /app/product/tracking-tool/bin/delete.sh
%attr(0755,vscc_prod,vscc) /app/product/tracking-tool/bin/scripts/script1.sh

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/logging.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/logging.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

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):

%files
%config /app/product/tracking-tool/config/xmlconfig.xml
%config /app/product/tracking-tool/config/properties/logging.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/logging.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 '15 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 '15 at 0:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .