clearlinux / autospec

RPM packaging automation tool
GNU General Public License v3.0
100 stars 59 forks source link

Escaping needed when filenames contain glob metacharacters #295

Open phmccarty opened 5 years ago

phmccarty commented 5 years ago

If filename paths in %files sections contain a [...] sequence, rpmbuild considers it a glob, so the square brackets require some form of escaping. Other glob metacharacters are * and ?, so ideally autospec should escape them, too. Though the build won't break in any obvious way if autospec does not escape them. See, for example, my second comment below.

An example filename that needs this escaping is from libsigc++: /usr/share/doc/libsigc++-2.0/reference/html/structsigc_1_1type__trait_3_01T__type[N]_4-members.html

phmccarty commented 5 years ago

First escaping option to consider: /usr/share/doc/libsigc++-2.0/reference/html/structsigc_1_1type__trait_3_01T__type[\[]N[\]]_4-members.html

Though a disadvantage is that the filename cannot contain spaces... double-quoting the filename combined with this form of escaping does not work.

phmccarty commented 5 years ago

Another escaping option to consider: /usr/share/doc/libsigc++-2.0/reference/html/structsigc_1_1type__trait_3_01T__type?N?_4-members.html

Because the ? is a glob metacharacter, this strategy is still not ideal, because many files may be matched. If the matched files reside in the same subpackage, rpmbuild doesn't seem to care, but if the files are installed across more than one subpackage, we've encountered bugs in that case, so it's best avoided.