Bug 1270052 - brp-java-repack-jars doesn't preserve UID / GID on jar files
brp-java-repack-jars doesn't preserve UID / GID on jar files
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: redhat-rpm-config (Show other bugs)
6.7
All Linux
medium Severity medium
: rc
: ---
Assigned To: Florian Festi
Karel Srot
:
Depends On:
Blocks: 1172231 1270053
  Show dependency treegraph
 
Reported: 2015-10-08 18:25 EDT by Ryan Sawhill
Modified: 2016-05-10 21:03 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1270053 (view as bug list)
Environment:
Last Closed: 2016-05-10 21:03:46 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
patch for file /usr/lib/rpm/redhat/brp-java-repack-jars (673 bytes, patch)
2016-01-14 09:26 EST, Ľuboš Kardoš
no flags Details | Diff

  None (edit)
Description Ryan Sawhill 2015-10-08 18:25:20 EDT
Description of problem:

  The UID and GID of any jar files gets reset by brp-java-repack-jars.

  I think few people notice this because it's extremely common to manually set those attributes in the %files section.

  If however you configure the ownership & perms in the %install section (e.g., with chown, chgrp, chmod) and use "%defattr(-,-,-,-)"  in the %files section ... well, then this hurts bad.


Version-Release number of selected component (if applicable):

  All. Tried the version of redhat-rpm-config shipped in every RHEL 6 and RHEL 7 release DVD. I didn't try RHEL 5 but I suspect it would be the same.


How reproducible:

  100%


Steps to Reproduce:

~~~~~~~~
yum -y install zip rpm-build rpmdevtools
user=mockbuild      # or whatever
group=OTHERGRP      # or whatever

cat >/tmp/jartest.spec <<EOF
%define __jar_repack %{nil}
Name:           jartest
Version:        1.0
Release:        1
Summary:        Demonstrate how brp-java-repack-jars messes w/GID
License:        GPLv3
Source0:        %{name}-%{version}.tar
%description
%{summary}
%prep
%setup -q
%install
rm -vrf %{buildroot}
mkdir -vp %{buildroot}
chgrp -v ${group} number1.jar
mv -v * %{buildroot}
%files
%defattr(-,-,-,-)
/*
EOF

groupadd ${group}
useradd -G ${group} ${user}
su - ${user}
rpmdev-setuptree
cd rpmbuild
mkdir SOURCES/jartest-1.0
zip SOURCES/jartest-1.0/number1.jar /etc/issue
zip SOURCES/jartest-1.0/number2.jar /etc/yum.conf
tar -C SOURCES -cf SOURCES/jartest-1.0.tar jartest-1.0
cp /tmp/jartest.spec SPECS/

rpmbuild -bb SPECS/jartest.spec
rpm -qplv RPMS/x86_64/jartest-1.0-1.x86_64.rpm

   # The two jar files are owned by different groups
   # Now remove the line disabling java_repack and try again

sed -i.bak 1d SPECS/jartest.spec
rpmbuild -bb SPECS/jartest.spec
rpm -qplv RPMS/x86_64/jartest-1.0-1.x86_64.rpm

   # Notice that the jar files are both owned by user's primary group
~~~~~~~~


Additional info:

  The latest version of rpm-build added redhat-rpm-config as a dependency which means that some folks are only now running into this.
Comment 6 Ľuboš Kardoš 2016-01-14 09:26 EST
Created attachment 1114819 [details]
patch for file /usr/lib/rpm/redhat/brp-java-repack-jars
Comment 22 errata-xmlrpc 2016-05-10 21:03:46 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-0948.html

Note You need to log in before you can comment on or make changes to this bug.