craigwblake / redline

Pure Java Rpm Library
http://redline-rpm.org
MIT License
128 stars 97 forks source link

Files in /var/lib that have owner/group set can not be installed #58

Closed joker1 closed 10 years ago

joker1 commented 10 years ago

Using the redline ant task to create an rpm package that contains files/folders in /var/lib which have owner/group that is not root, can not be installed on RHEL/CentOS (and possibly other rpm distributions).

Rpm file installation fails with message file /var/lib from install of <name>-<version>.<arch> conflicts with file from package filesystem-<version>.<arch>

For example: file /var/lib from install of test-0:1.1-1.noarch conflicts with file from package filesystem-3.2-18.el7.x86_64

This bug can be reproduced by creating an rpm package and including rpmfileset with prefix="/var/lib" and username="" and group="" attributes set to value other than root.

Conflict happens because the rpm package installation tries to set owner/group for /var/lib folder instead of just /var/lib/<folder>.

You can use ant script below to create example rpm package that produces this bug (when installed on RHEL/CentOS). Change username="tomcat" and group="tomcat" if needed (user and group must exist on target system).

<project name="test" default="rpm" xmlns:redline="antlib:org.redline_rpm">

    <property name="redline.lib" value="target/redline-1.1.17-SNAPSHOT-jar-with-dependencies.jar" />

    <typedef resource="org/redline_rpm/antlib.xml" uri="antlib:org.redline_rpm" classpath="${redline.lib}" />

    <target name="rpm">
        <mkdir dir="rpms/var/lib/test" />
        <touch file="rpms/var/lib/test/file" />
        <redline:rpm group="Java Development" name="test" version="1.2.3" destination="rpms">
            <redline:rpmfileset dir="rpms/var/lib" prefix="/var/lib" username="tomcat" group="tomcat"/>
        </redline:rpm>
    </target>

</project>