Make double-quoting work for special %doc (and %license) too
authorPanu Matilainen <pmatilai@redhat.com>
Tue, 22 Jan 2013 05:55:11 +0000 (07:55 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Tue, 29 Jan 2013 06:14:38 +0000 (08:14 +0200)
- Up to now, special %doc has been different from everything else in
  %files: double-quoting which is used to escape eg spaces in filenames
  has not worked, but single-quoting and backslash-escapes (which do
  not work elsewhere in %files) "worked" by happenstance due to getting
  passed verbatim to shell/cp. Those and various other %doc hacks people
  have come with stopped working (ticket #858) as starting from
  commit 29677605d44dc9cba3119135653ba0372ab58037 we perform the
  copies in slightly more controlled manner.
- Rather than re-enable old quirks, make %doc and %license behavior
  consistent with the rest of the %files section: double-quoting and
  globs work, other escaping methods do not.
- This does mean a minor (as docs with spaces are relatively rare)
  compatibility rift in specs, the "official workaround" is that
  if compatibility with older rpm versions is required globs can
  be used instead of quotation.
(cherry picked from commit a1d9364adb556813886d91b2799217a412ac5bb0)

build/files.c

index 10d7fff..4a8cb56 100644 (file)
@@ -1762,10 +1762,13 @@ static void processSpecialDir(rpmSpec spec, Package pkg, FileList fl,
     appendLineStringBuf(docScript, mkdocdir);
 
     for (ARGV_const_t fn = sd->files; fn && *fn; fn++) {
+       /* Quotes would break globs, escape spaces instead */
+       char *efn = rpmEscapeSpaces(*fn);
        appendStringBuf(docScript, "cp -pr ");
-       appendStringBuf(docScript, *fn);
+       appendStringBuf(docScript, efn);
        appendStringBuf(docScript, " $");
        appendLineStringBuf(docScript, sdenv);
+       free(efn);
     }
 
     if (install) {