4

Consider a SPEC file containing:

%install
install -m u=rwx,g=rx,o= -D bin/blah.jar ${RPM_BUILD_ROOT}%{_libexecdir}/foo/blah.jar

Then in the %files section, the permissions are not changed (say, %defattr(-,bubba,users,-)).

Installing the RPM results in blah.jar having permissions 644 instead of 640. Indeed, no matter what permissions are used in the install command, they're reset to the default 640. I've found that the cause is the jar repacking, as permissions are maintained if I disable repacking by adding %define __jar_repack %{nil} to the SPEC file.

This is a nasty bug of the repacker.

How do I get both repacking to work and the permissions to be preserved (and I mean preserved, not setting them instead in the %files section, as then I'd have to mention individual files not only in %install but in %files as well, rather than just whole directories in the latter)?

Display Name
  • 2,323
  • 1
  • 26
  • 45
  • What OS is this? What is the repacker doing? Can you edit the repacker? – Etan Reisner Jun 24 '15 at 22:32
  • CentOS 7. This repack runs by default on several other distros, and at least on RedHat and Fedora. The description I've found is here: https://www.redhat.com/archives/fedora-devel-java-list/2008-September/msg00040.html However, I notice even when what is explained there doesn't apply to my use case, it still reduces the size of the jars by quite a lot, which is a good reason to continue to be able to use it. – Display Name Jun 25 '15 at 21:19
  • How are you creating your jars? Ultimately the command that it uses to put the jars back together (assuming the `brp-java-repack-jars` script I'm looking at isn't too out of date) is `/usr/bin/zip -q -X -9 $j -@` so the size difference you are seeing might just be the compression they are using (and dropping extra attributes and directory names). You could see if doing that yourself gets you comparable results. – Etan Reisner Jun 26 '15 at 13:38
  • I'm creating the jars using "maven package", and the project files are configured so that dependencies are left as external, and not embedded in the jar files. – Display Name Jun 30 '15 at 22:52

0 Answers0