Bug 1638396

Summary: rebuild fails if DISTRO variable is exported
Product: Red Hat Enterprise Linux 7 Reporter: Karel Srot <ksrot>
Component: realmdAssignee: Sumit Bose <sbose>
Status: CLOSED ERRATA QA Contact: sssd-qe <sssd-qe>
Severity: low Docs Contact:
Priority: low    
Version: 7.6CC: sgadekar, sgoveas, thalman
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: sync-to-jira
Fixed In Version: realmd-0.16.1-12.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1747454 (view as bug list) Environment:
Last Closed: 2020-09-29 20:35:34 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:    
Bug Blocks: 1747454    

Description Karel Srot 2018-10-11 13:04:26 UTC
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.

Comment 1 Sumit Bose 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 2 Sumit Bose 2019-11-28 17:59:27 UTC
Master:
 - 506887297ea33339d8ad8b274be643d220bf22f8

Comment 5 shridhar 2020-06-01 12:17:00 UTC
Tested with

~]# yum install automake autoconf intltool gettext-devel glib2-devel openldap-devel polkit-devel krb5-devel systemd-devel xmlto -y
~]# yum install gcc -y
~]# yum install glibc-devel

blade-12 ~]# rpmbuild --rebuild realmd-0.16.1-12.el7.src.rpm 
Installing realmd-0.16.1-12.el7.src.rpm
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root

[....]

PASS: test-settings 1 /realmd/settings/string
PASS: test-settings 2 /realmd/settings/double
PASS: test-settings 3 /realmd/settings/boolean
make[5]: Entering directory `/root/rpmbuild/BUILD/realmd-0.16.1'
make  all-recursive
make[6]: Entering directory `/root/rpmbuild/BUILD/realmd-0.16.1'
Making all in po
make[7]: Entering directory `/root/rpmbuild/BUILD/realmd-0.16.1/po'
make[7]: Nothing to be done for `all'.
make[7]: Leaving directory `/root/rpmbuild/BUILD/realmd-0.16.1/po'
make[7]: Entering directory `/root/rpmbuild/BUILD/realmd-0.16.1'
make[7]: Leaving directory `/root/rpmbuild/BUILD/realmd-0.16.1'
make[6]: Leaving directory `/root/rpmbuild/BUILD/realmd-0.16.1'
make[5]: Leaving directory `/root/rpmbuild/BUILD/realmd-0.16.1'
============================================================================
Testsuite summary for realmd 0.16.1
============================================================================
# TOTAL: 101
# PASS:  101
# SKIP:  0
# XFAIL: 0
# FAIL:  0
# XPASS: 0
# ERROR: 0
============================================================================
make[4]: Leaving directory `/root/rpmbuild/BUILD/realmd-0.16.1'
make[3]: Leaving directory `/root/rpmbuild/BUILD/realmd-0.16.1'
make[2]: Leaving directory `/root/rpmbuild/BUILD/realmd-0.16.1'
make[1]: Leaving directory `/root/rpmbuild/BUILD/realmd-0.16.1'
+ exit 0
Processing files: realmd-0.16.1-12.el7.x86_64

[....]

Wrote: /root/rpmbuild/RPMS/x86_64/realmd-debuginfo-0.16.1-12.el7.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.Q98wT6
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd realmd-0.16.1
+ /usr/bin/rm -rf /root/rpmbuild/BUILDROOT/realmd-0.16.1-12.el7.x86_64
+ exit 0
Executing(--clean): /bin/sh -e /var/tmp/rpm-tmp.MVIY2C
+ umask 022
+ cd /root/rpmbuild/BUILD
+ rm -rf realmd-0.16.1
+ exit 0
[root@qe-blade-12 ~]# 


Marking verified.

Comment 7 errata-xmlrpc 2020-09-29 20:35:34 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 (realmd bug fix and enhancement update), 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:4014