2

How do I handle filenames that contain special characters within an rpm's %files section?

I'm building an RPM but I have a few filenames that contain special characters. I'm not the developer so I do not control the filenames checked into the source code repository.

My example %files section is below:

 %files -f files.serviceX.list
 %defattr(-,serviceXuser,serviceXuser,-)

My files.serviceX.list contains:

%config(noreplace) %attr(-,serviceXuser,serviceXuser) /etc/serviceX/serviceX.conf
%attr(-,serviceXuser,serviceXuser) /opt/serviceX/tests/runtests.sh
%attr(-,serviceXuser,serviceXuser) /opt/serviceX/tests/configtests.sh
%attr(-,serviceXuser,serviceXuser) /opt/serviceX/tests/badinput.sh
%attr(-,serviceXuser,serviceXuser) /opt/serviceX/tests/#1 escaping.sh
%attr(-,serviceXuser,serviceXuser) /opt/serviceX/tests/#2 bad filenames.sh

The only workaround I've found so far is to list the directory which contains the filenames using special characters in files.serviceX.list:

%config(noreplace) %attr(-,serviceXuser,serviceXuser) /etc/serviceX/serviceX.conf
%attr(-,serviceXuser,serviceXuser) /opt/serviceX/tests/

Is there a better way to deal with this?

devteam
  • 21
  • 2
  • I should add that quoting the bad filename does not work and rpmbuild still complains: `%attr(-,serviceXuser,serviceXuser) "/opt/serviceX/tests/#1 escaping.sh"` – devteam Aug 19 '16 at 13:12
  • did you try escaping the space using `\ ` ? – Chris Maes Aug 19 '16 at 14:28

1 Answers1

0

You can use a wildcard and avoid the problem:

%attr(-,serviceXuser,serviceXuser) /opt/serviceX/tests/*.sh
Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105