What are differences between real and rpmbuild's environment?

Michal Hlavinka mhlavink at redhat.com
Tue Nov 9 09:07:05 UTC 2010


On Monday, November 08, 2010 19:34:14 Richard W.M. Jones wrote:
> On Mon, Nov 08, 2010 at 03:49:28PM +0100, Michal Hlavinka wrote:
> > I'm trying to find out what are differences between environment for
> > local rpm build and usual user's environment. I've added regression
> > tests to %check section of ksh spec file. These tests never fails
> > when executed in user's environment, but some of them always fail
> > when executed as part of rpm build process. I've tried to compare
> > variable in the environment and ulimit values, but there does not
> > seem to be any significant difference. I've also tried to use the
> > same script generated by rpmbuild for %check section (from
> > /var/tmp/rpm.*), but still it does not reproduce the problem. Any
> > ideas?
> 
> Is the spec file using %configure?  That adds a lot of flags to the
> configure script.  Similarly make _vs_ make %{_smp_flags}.

I'm always using the same ksh binary, so this does not make any difference

> Have you tried 'printenv' at the top of the %check section?

tried, but there does not seem to be significant difference. Also the %check 
script I used was the same script rpmbuild creates from the %check section (in 
/var/tmp/rpm*) and it defines the same environment:

-------------------------------------------
#!/bin/sh

  RPM_SOURCE_DIR="/home/mhlavink/gitf/ksh"
  RPM_BUILD_DIR="/home/mhlavink/gitf/ksh"
  RPM_OPT_FLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -
fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic"
  RPM_ARCH="x86_64"
  RPM_OS="linux"
  export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS
  RPM_DOC_DIR="/usr/share/doc"
  export RPM_DOC_DIR
  RPM_PACKAGE_NAME="ksh"
  RPM_PACKAGE_VERSION="20101026"
  RPM_PACKAGE_RELEASE="1.fc14"
  export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE
  LANG=C
  export LANG
  unset CDPATH DISPLAY ||:
  RPM_BUILD_ROOT="/home/mhlavink/rpmbuild/BUILDROOT/ksh-20101026-1.fc14.x86_64"
  export RPM_BUILD_ROOT
  
  PKG_CONFIG_PATH="/usr/lib64/pkgconfig:/usr/share/pkgconfig"
  export PKG_CONFIG_PATH
  
  set -x
  umask 022
  cd "/home/mhlavink/gitf/ksh"
cd 'ksh-20101026'
unset DISPLAY

SHELL=$(ls $(pwd)/arch/*/bin/ksh)
cp $SHELL ${SHELL}4check
export SHELL=${SHELL}4check
cd src/cmd/ksh93/tests/
ulimit -c unlimited
if [ ! -e /dev/fd ]
then
  echo "ERROR: /dev/fd does not exist, regression tests skipped"
  exit 0
fi
$SHELL ./shtests 2>&1 | tee testresults.log
killall ksh4check -s SIGKILL
...
-------------------------------------------

> Are you specifically running rpmbuild as the same user?  

rpmbuild vs. just %check script executed by the same user on the same machine

> Or are we
> talking about rpmbuild in some other environment (mock or Koji)?
> There is a Koji bug which affects ksh %check in particular
> (RHBZ#639275).

I know. I reported that bug


More information about the devel mailing list