escaping '%' in a file name.

Jordan Sissel jls at semicomplete.com
Tue May 29 01:29:34 UTC 2012


Howdy folks!

I'm mostly noting this here for posterity.

I'm trying to package software that has files with '%' in the names. I
tried a few things, but nothing worked. Googling found only this thread
from 2003 which indicated that "%%" "should" work but it does not (thread;
://tech.groups.yahoo.com/group/rpm-list/message/21824<http://tech.groups.yahoo.com/group/rpm-list/message/21824>
)

If my %files section is follows, for testing all possible permutations ;)

%files
/example/%name
/example/%%name
/example/%%%name
/example/%%%%name
/example/%{%}name
/example/\%name

The error with rpmbuild is:

RPM build errors:
    File not found:
/tmp/package-rpm-build20120528-31204-qsgxuu/BUILD/example/helloworld
    File not found:
/tmp/package-rpm-build20120528-31204-qsgxuu/BUILD/example/helloworld
    File not found:
/tmp/package-rpm-build20120528-31204-qsgxuu/BUILD/example/%helloworld
    File not found:
/tmp/package-rpm-build20120528-31204-qsgxuu/BUILD/example/helloworld
    File not found:
/tmp/package-rpm-build20120528-31204-qsgxuu/BUILD/example/%{%}name
    File not found:
/tmp/package-rpm-build20120528-31204-qsgxuu/BUILD/example/\helloworld

Judging from the above, it appears the correct way to escape a single % in
a filename is to use '%%%'

-Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-list/attachments/20120528/b10998d6/attachment.html>


More information about the Rpm-list mailing list