Take the 2-minute tour ×
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?

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

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

%files
%config /app/product/tracking-tool/config
%config /app/product/tracking-tool/config/properties
%config /app/product/tracking-tool/config/other
%config /app/product/tracking-tool/config/xmlconfig.xml
%config /app/product/tracking-tool/config/properties/logging.properties
%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/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

Your Answer

 
discard

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.