Bug 1747454

Summary: rebuild fails if DISTRO variable is exported
Product: Red Hat Enterprise Linux 8 Reporter: Sumit Bose <sbose>
Component: realmdAssignee: Sumit Bose <sbose>
Status: CLOSED ERRATA QA Contact: sssd-qe <sssd-qe>
Severity: low Docs Contact:
Priority: low    
Version: 8.2CC: ksrot, pcech, sgadekar, sgoveas, sssd-qe
Target Milestone: rc   
Target Release: 8.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: sync-to-jira
Fixed In Version: realmd-0.16.3-17.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1638396 Environment:
Last Closed: 2020-04-28 16:59:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1638396    
Bug Blocks:    

Description Sumit Bose 2019-08-30 13:21:36 UTC
+++ This bug was initially created as a clone of Bug #1638396 +++

Description of problem:

I had find out that having variable DISTRO set in the environment would break realmd rebuild.

Version-Release number of selected component (if applicable):
realmd-0.16.1-11.el7.src.rpm

How reproducible:
# export DISTRO=foo
# rpmbuild --rebuild realmd-0.16.1-11.el7.src.rpm
...
...
/usr/bin/install -c -m 644 ./service/realmd-foo.conf /root/rpmbuild/BUILDROOT/realmd-0.16.1-11.el7.x86_64/usr/lib64/realmd/realmd-distro.conf
/usr/bin/install: cannot stat './service/realmd-foo.conf': No such file or directory
make[3]: *** [install-service] Error 1
make[3]: Leaving directory `/root/rpmbuild/BUILD/realmd-0.16.1'
make[2]: *** [install-am] Error 2
make[2]: Leaving directory `/root/rpmbuild/BUILD/realmd-0.16.1'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/root/rpmbuild/BUILD/realmd-0.16.1'
make: *** [install] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.yGUro6 (%install)

I do not know what is the exact purpose of this variable in the MAKEFILE so probably the result is expected. I did identify this bug accidentally due to a conflict with our test environment that exports this variable.

--- Additional comment from Sumit Bose on 2018-10-11 14:59:07 UTC ---

This is an interaction with the configure script which uses DISTRO as a variable, too:

# Distro Detection

AC_ARG_WITH([distro],
            [AS_HELP_STRING([--with-distro],
                            [Configure for a specific distribution (eg: redhat)]
                           )],
            [DISTRO=$withval])

if test -z $DISTRO; then
    AC_CHECK_FILE(/etc/redhat-release, [DISTRO="redhat"])
    AC_CHECK_FILE(/etc/debian_version, [DISTRO="debian"])
    AC_CHECK_FILE(/etc/SuSE-release, [DISTRO="suse"])

    # Not customized for these yet
    dnl AC_CHECK_FILE(/etc/gentoo-release, [DISTRO="gentoo"])
    dnl AC_CHECK_FILE(/etc/slackware-version, [DISTRO="slackware"])

fi

if test -z $DISTRO; then
    AC_MSG_ERROR([Couldn't detect the distro to configure for. Specify one with --with-distro])
fi

AC_SUBST(DISTRO)


So if DISTRO is set and --with-distro is not used when calling configure the value of DISTRO is used in the Makefile to select the distribution specific defaults.

Comment 1 Sumit Bose 2019-11-28 18:00:47 UTC
Master:
 - 506887297ea33339d8ad8b274be643d220bf22f8

Comment 3 shridhar 2020-01-27 09:20:39 UTC
Tested with following details:

--------------------
With realmd-0.16.3-16.el8.src.rpm version
--------------------

[root@ci-vm-10-0-137-107 tmp.EDyBx2Xu9Y]# echo $DISTRO
foo
[root@ci-vm-10-0-137-107 tmp.EDyBx2Xu9Y]# 

[root@ci-vm-10-0-137-107 tmp.EDyBx2Xu9Y]# rpmbuild --rebuild realmd-0.16.3-16.el8.src.rpm 

[....]
make[3]: Leaving directory '/root/rpmbuild/BUILD/realmd-0.16.3/po'
make[3]: Entering directory '/root/rpmbuild/BUILD/realmd-0.16.3'
make[4]: Entering directory '/root/rpmbuild/BUILD/realmd-0.16.3'
 /usr/bin/mkdir -p '/root/rpmbuild/BUILDROOT/realmd-0.16.3-16.el8.x86_64/usr/sbin'
  /usr/bin/install -c realm '/root/rpmbuild/BUILDROOT/realmd-0.16.3-16.el8.x86_64/usr/sbin'
/usr/bin/install -c -d /root/rpmbuild/BUILDROOT/realmd-0.16.3-16.el8.x86_64/usr/lib/realmd
/usr/bin/install -c -d /root/rpmbuild/BUILDROOT/realmd-0.16.3-16.el8.x86_64/var/lib/realmd
/usr/bin/install -c -d /root/rpmbuild/BUILDROOT/realmd-0.16.3-16.el8.x86_64/var/cache/realmd
/usr/bin/install -c -m 644 ./service/realmd-foo.conf /root/rpmbuild/BUILDROOT/realmd-0.16.3-16.el8.x86_64/usr/lib/realmd/realmd-distro.conf
/usr/bin/install: cannot stat './service/realmd-foo.conf': No such file or directory
make[4]: *** [Makefile:3636: install-service] Error 1
make[4]: Leaving directory '/root/rpmbuild/BUILD/realmd-0.16.3'
make[3]: *** [Makefile:3305: install-am] Error 2
make[3]: Leaving directory '/root/rpmbuild/BUILD/realmd-0.16.3'
make[2]: *** [Makefile:2793: install-recursive] Error 1
make[2]: Leaving directory '/root/rpmbuild/BUILD/realmd-0.16.3'
make[1]: *** [Makefile:3299: install] Error 2
make[1]: Leaving directory '/root/rpmbuild/BUILD/realmd-0.16.3'
error: Bad exit status from /var/tmp/rpm-tmp.Ood2KG (%install)


RPM build errors:
    user mockbuild does not exist - using root
    group mockbuild does not exist - using root
    user mockbuild does not exist - using root
    group mockbuild does not exist - using root
    user mockbuild does not exist - using root
    group mockbuild does not exist - using root
    user mockbuild does not exist - using root
    group mockbuild does not exist - using root
    user mockbuild does not exist - using root
[.....]
    user mockbuild does not exist - using root
    group mockbuild does not exist - using root
    Bad exit status from /var/tmp/rpm-tmp.Ood2KG (%install)
[root@ci-vm-10-0-137-107 tmp.EDyBx2Xu9Y]# 


=================================================================================================================

In fixed packages

--------------------
realmd-0.16.3-17.el8.src.rpm
--------------------

[root@ci-vm-10-0-137-107 tmp.EDyBx2Xu9Y]# echo $DISTRO
foo
[root@ci-vm-10-0-137-107 tmp.EDyBx2Xu9Y]# 

[root@ci-vm-10-0-137-107 tmp.EDyBx2Xu9Y]# rpmbuild --rebuild realmd-0.16.3-17.el8.src.rpm 

[.....]

make[4]: Leaving directory '/root/rpmbuild/BUILD/realmd-0.16.3'
make  check-TESTS
make[4]: Entering directory '/root/rpmbuild/BUILD/realmd-0.16.3'
make[5]: Entering directory '/root/rpmbuild/BUILD/realmd-0.16.3'
PASS: test-dn-util 1 /realmd/samba-ou-format/OU_One
PASS: test-dn-util 2 /realmd/samba-ou-format/OU_One_ou_two
PASS: test-dn-util 3 /realmd/samba-ou-format/Ou_One_Long_OU_two

[.....]

PASS: test-login-name 8 /realmd/login-name/parse_different_User_suffix
PASS: test-login-name 9 /realmd/login-name/parse_user_another
PASS: test-login-name 10 /realmd/login-name/parse-all
PASS: test-login-name 11 /realmd/login-name/parse-all-failed
PASS: test-settings 1 /realmd/settings/string
PASS: test-settings 2 /realmd/settings/double
PASS: test-settings 3 /realmd/settings/boolean
============================================================================
Testsuite summary for realmd 0.16.3
============================================================================
# TOTAL: 101
# PASS:  101
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[5]: Leaving directory '/root/rpmbuild/BUILD/realmd-0.16.3'
make[4]: Leaving directory '/root/rpmbuild/BUILD/realmd-0.16.3'
make[3]: Leaving directory '/root/rpmbuild/BUILD/realmd-0.16.3'
make[2]: Leaving directory '/root/rpmbuild/BUILD/realmd-0.16.3'
make[1]: Leaving directory '/root/rpmbuild/BUILD/realmd-0.16.3'
+ exit 0
Processing files: realmd-0.16.3-17.el8.x86_64
Executing(%doc): /bin/sh -e /var/tmp/rpm-tmp.OdzGk0
[.....]
Checking for unpackaged file(s): /usr/lib/rpm/check-files /root/rpmbuild/BUILDROOT/realmd-0.16.3-17.el8.x86_64
Wrote: /root/rpmbuild/RPMS/x86_64/realmd-0.16.3-17.el8.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/realmd-devel-docs-0.16.3-17.el8.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/realmd-debugsource-0.16.3-17.el8.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/realmd-debuginfo-0.16.3-17.el8.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.CR1Sb5
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd realmd-0.16.3
+ /usr/bin/rm -rf /root/rpmbuild/BUILDROOT/realmd-0.16.3-17.el8.x86_64
+ exit 0
Executing(--clean): /bin/sh -e /var/tmp/rpm-tmp.QA2uE8
+ umask 022
+ cd /root/rpmbuild/BUILD
+ rm -rf realmd-0.16.3
+ exit 0
[root@ci-vm-10-0-137-107 tmp.EDyBx2Xu9Y]# 

Marking bz verified.

Comment 5 errata-xmlrpc 2020-04-28 16:59:49 UTC
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://access.redhat.com/errata/RHBA-2020:1884