Bug 426955 - rpm build fails in prep if CDPATH is set
Summary: rpm build fails in prep if CDPATH is set
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: 10
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Panu Matilainen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-12-28 21:24 UTC by David Kovalsky
Modified: 2014-03-31 23:44 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-08-13 14:25:39 UTC
Type: ---


Attachments (Terms of Use)

Description David Kovalsky 2007-12-28 21:24:02 UTC
Description of problem:
Attempting to build an RPM in the environment where CDPATH is set makes cp
function in a way that breaks the build, because cd tries to find the path in
the CDPATH. If I unset the CDPATH variable the build works correctly.

Just set the package name that is not in the SCMROOT. My setup below.

Version-Release number of selected component (if applicable):
rpm-4.4.2.2-7.fc8
rpmrebuild-2.1.1-9.fc8


How reproducible:
Always

### be sure to have CDPATH set
[dkovalsk@kovinek ~]$ echo $CDPATH
/home/dkovalsk/SCM

### relevant part of the specfile (only the prep section)
%prep
echo SETUP1 - `pwd`
ls -l |head
%setup -q -n Django
echo SETUP2 - `pwd`
ls -l


### my SCMROOT, note there's no Django with capital 'D'
[dkovalsk@kovinek ~]$ ls -l /home/dkovalsk/SCM/|grep -i dj
lrwxrwxrwx  1 dkovalsk dkovalsk   11 2007-10-07 20:10 django -> SVN/django/
lrwxrwxrwx  1 dkovalsk dkovalsk   14 2007-10-07 20:10 django-dk -> GIT/django-dk/


### Now the build fails:
...
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.91696
+ umask 022
+ cd /tmp/Django/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
++ pwd
+ echo SETUP1 - /tmp/Django/BUILD
SETUP1 - /tmp/Django/BUILD
+ ls
+ head
+ cd /tmp/Django/BUILD
+ rm -rf Django
+ /bin/gzip -dc /tmp/Django/Django.tar.gz
+ tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd Django
/var/tmp/rpm-tmp.91696: line 35: cd: Django: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.91696 (%prep)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.91696 (%prep)
make: *** [rpm] Error 1


### /var/tmp/rpm-tmp.91696
#!/bin/sh

  RPM_SOURCE_DIR="/tmp/Django"
  RPM_BUILD_DIR="/tmp/Django/BUILD"
  RPM_OPT_FLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables"
  RPM_ARCH="i386"
  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="Django"
  RPM_PACKAGE_VERSION="0.97"
  RPM_PACKAGE_RELEASE="pre1_svn6702.TEST"
  export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE
  RPM_BUILD_ROOT="/var/tmp/Django-0.97-pre1_svn6702.TEST-root-dkovalsk"
  export RPM_BUILD_ROOT


  set -x
  umask 022
  cd /tmp/Django/BUILD
LANG=C
export LANG
unset DISPLAY

echo SETUP1 - `pwd`
ls | head
cd /tmp/Django/BUILD
rm -rf Django
/bin/gzip -dc /tmp/Django/Django.tar.gz | tar -xf -
STATUS=$?
if [ $STATUS -ne 0 ]; then
  exit $STATUS
fi
cd Django
[ `/usr/bin/id -u` = '0' ] && /bin/chown -Rhf root .
[ `/usr/bin/id -u` = '0' ] && /bin/chgrp -Rhf root .
/bin/chmod -Rf a+rX,u+w,g-w,o-w .
echo SETUP2 - `pwd`
ls -l


exit 0



If I add `ls -l | head' to line 34 -> the files are there.


Additional info:
Let me know if you need any.

Comment 1 Bug Zapper 2008-11-26 09:12:22 UTC
This message is a reminder that Fedora 8 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 8.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '8'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 8's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 8 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 2 David Kovalsky 2008-12-22 18:39:08 UTC
Yup, still valid for Fedora 10. The saga continues.

[dkovalsk@kovy ~]$ rpm -q rpm bash
rpm-4.6.0-0.rc1.8.x86_64
bash-3.2-29.fc10.x86_64

Comment 3 Jeff Johnson 2008-12-31 01:58:51 UTC
Edit /usr/lib/rpm/macros, find the %___build_pre macro.

Add
  unset CDPATH \

Comment 4 Jeff Johnson 2008-12-31 15:06:02 UTC
Slightly better:

...
Add
    unset CDPATH || : \
in case you __DONT__ have CDPATH set.

No matter what, rpmbuild works fine without CDPATH,
all that is needed is to unset CDPATH before using rpmbuild.
Whether that is done automagically with macros or manually
is up to you.

Comment 5 David Kovalsky 2009-01-02 12:21:44 UTC
Agreed :)

My favorite is to unset automagically in rpmmacros since it creates a sane and reproducible build environment.

Comment 6 Panu Matilainen 2009-08-13 14:25:39 UTC
Fixed upstream now, Fedora will get it eventually through updates.


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