Subject: | cpan2aur generates wrong "find" command leaving .packlist in place |
Date: | Thu, 28 Sep 2017 21:26:18 +0200 |
To: | bug-CPANPLUS-Dist-Arch [...] rt.cpan.org |
From: | Moritz Bunkus <moritz [...] bunkus.org> |
Hey,
the "find" line that's supposed to delete both ".packlist" and
"perllocal.pod" is wrong. Here's the generated one:
find "$pkgdir" -name .packlist -o -name perllocal.pod -delete
For clarity this is equivalent to the following:
find "$pkgdir" -name .packlist -o -name perllocal.pod -a -delete
Now we have to remember that "-a = and" has precedence over "-o =
or". Therefore this is equivalent to:
find "$pkgdir" "(" -name .packlist ")" -o "(" -name perllocal.pod -a -delete ")"
Effectively this means that nothing is done for files named ".packlist",
and deletion is only carried out for files named "perllocal.pod".
Small proof of concept:
touch a b
find -name a -o -name b -delete
ls
You'll see 'a' still existing.
The fix is easy; group the two "-name" checks like this:
find "$pkgdir" "(" -name .packlist -o -name perllocal.pod ")" -delete
Proof of this working:
rm -f a b
touch a b
find "(" -name a -o -name b ")" -delete
ls
Both files are now gone.
The effective result of this bug is:
1. Files named ".packlist" remain in "$srcdir" during makepkg.
2. Therefore "options=(!emptydirs)" does not apply to the corresponding
directory.
3. Files whose name starts with a . aren't packaged by makepkg.
4. But the directory is.
Now the package contains an empty directory. "namcap" complains about that.
Kind regards,
mosu