Bug 166665 - Pre-existing installation confuses RPM build
Pre-existing installation confuses RPM build
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: postgresql (Show other bugs)
3
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Tom Lane
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-08-24 10:20 EDT by Philippe Rigault
Modified: 2013-07-02 23:06 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-10-04 19:19:14 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Philippe Rigault 2005-08-24 10:20:56 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (compatible; Konqueror/3.4; Linux; en_US, fr) KHTML/3.4.2 (like Gecko)

Description of problem:
Building postgresql RPM from source RPM fails because rpmbuild (which must be    
run as root if I am correct) executes initdb as root during 'make check'.  

Version-Release number of selected component (if applicable):
postgresql-8.0.3-1.src.rpm

How reproducible:
Always

Steps to Reproduce:
(these commands must be run as root)  
1. rpm -i postgresql-8.0.3-1.src.rpm  
2. cd /usr/src/redhat/SPECS  
3. rpmbuild -ba postgresql.spec  
    

Actual Results:  rpmbuild fails with the following output: 
<snip> 
+ make MAX_CONNECTIONS=5 check 
make -C ../../../contrib/spi refint.so autoinc.so 
make[1]: Entering directory 
`/usr/src/redhat/BUILD/postgresql-8.0.3/contrib/spi' 
make[1]: `refint.so' is up to date. 
make[1]: `autoinc.so' is up to date. 
make[1]: Leaving directory 
`/usr/src/redhat/BUILD/postgresql-8.0.3/contrib/spi' 
rm -rf ./testtablespace 
mkdir ./testtablespace 
/bin/sh ./pg_regress --temp-install --top-builddir=../../.. 
--schedule=./parallel_schedule --multibyte=SQL_ASCII  --max-connections=5 
============== creating temporary installation        ============== 
============== initializing database system           ============== 
 
pg_regress: initdb failed 
Examine ./log/initdb.log for the reason. 
 
make: *** [check] Error 2 
error: Bad exit status from /var/tmp/rpm-tmp.2098 (%build) 
 

Expected Results:  rpmbuils successfully builds RPM files. 

Additional info:

From log/initdb.log, the error happens because initdb was run as root:  
# more log/initdb.log  
Running in noclean mode.  Mistakes will not be cleaned up.  
initdb: cannot be run as root  
Please log in (using, e.g., "su") as the (unprivileged) user that will  
own the server process.  
  
From the specfile postgresql.spec, this happens during 'make MAX_CONNECTIONS=5 
check' here: 
<snip>  
%if %runselftest  
        pushd src/test/regress  
        make all  
        make MAX_CONNECTIONS=5 check  
        make clean  
        popd  
%endif
Comment 1 Tom Lane 2005-08-24 12:46:29 EDT
rpmbuild does not need to be run as root; certainly no one at Red Hat does so.
I don't think this is a bug.
Comment 2 Philippe Rigault 2005-08-24 15:08:47 EDT
Thank you very much for the rapid answer.       
I stand corrected with regards to using rpmbuild from user space, and doing so      
succesfully completes the process. I agree therefore with your NOTABUG      
resolution.      
      
However, I noticed one other problem. The FC3 system I use for rpmbuild has   
postgres-{libs,devel}-7.4.8-1.FC3.1 installed, and the postgresql-tcl package  
produced by rpmbuild (of the 8.0.3 src.rpm) ends up requiring this old  
installed version of libpq (libpq.so.3) rather than the one (libpg.so.4) just  
built during rpmbuild.   
  
As a consequence, it is not possible to build (from src.rpm) and upgrade  
postgresql packages in one shot:  
  
$ rpm -Fvh RPMS/x86_64/postgres*.rpm   
   error: Failed dependencies:   
        libpq.so.3()(64bit) is needed by postgresql-tcl-8.0.3-2.x86_64   
  
$ rpm -qa|grep postgresql|sort  
postgresql-7.4.8-1.FC3.1  
postgresql-contrib-7.4.8-1.FC3.1  
postgresql-devel-7.4.8-1.FC3.1  
postgresql-docs-7.4.8-1.FC3.1  
postgresql-jdbc-7.4.8-1.FC3.1  
postgresql-libs-7.4.8-1.FC3.1  
postgresql-odbc-7.3-8.FC3.1  
postgresql-pl-7.4.8-1.FC3.1  
postgresql-python-7.4.8-1.FC3.1  
postgresql-server-7.4.8-1.FC3.1  
postgresql-tcl-7.4.8-1.FC3.1  
postgresql-test-7.4.8-1.FC3.1  
  
$ ls RPMS/x86_64/postgres*  
RPMS/x86_64/postgresql-8.0.3-2.x86_64.rpm  
RPMS/x86_64/postgresql-contrib-8.0.3-2.x86_64.rpm  
RPMS/x86_64/postgresql-debuginfo-8.0.3-2.x86_64.rpm  
RPMS/x86_64/postgresql-devel-8.0.3-2.x86_64.rpm  
RPMS/x86_64/postgresql-docs-8.0.3-2.x86_64.rpm  
RPMS/x86_64/postgresql-jdbc-8.0.3-2.x86_64.rpm  
RPMS/x86_64/postgresql-libs-8.0.3-2.x86_64.rpm  
RPMS/x86_64/postgresql-pl-8.0.3-2.x86_64.rpm  
RPMS/x86_64/postgresql-python-8.0.3-2.x86_64.rpm  
RPMS/x86_64/postgresql-server-8.0.3-2.x86_64.rpm  
RPMS/x86_64/postgresql-tcl-8.0.3-2.x86_64.rpm  
RPMS/x86_64/postgresql-test-8.0.3-2.x86_64.rpm  
  
(I bumped the release to 2 to distinguish it from FC4's true RPMs)  
      
$ rpm -qp --requires RPMS/x86_64/postgresql-tcl-8.0.3-2.x86_64.rpm      
libc.so.6()(64bit)      
libc.so.6(GLIBC_2.2.5)(64bit)      
libc.so.6(GLIBC_2.3)(64bit)      
libdl.so.2()(64bit)      
libm.so.6()(64bit)      
libpq.so      
libpq.so.3()(64bit)      
rpmlib(CompressedFileNames) <= 3.0.4-1      
rpmlib(PayloadFilesHavePrefix) <= 4.0-1      
tcl >= 8.3      
   
The postgresql-tcl-8.0.3-1.x86_64.rpm distributed in FC4 correctly requires   
libpq.so.4. I suspect it required postgresql-{libs,devel}-8.0 to be installed  
_prior_ to do rpmbuild.  
   
I know that one solution would be to   
 1. remove postgresql-tcl  
 2. upgrade postgresql-{libs,devel}-8.0.3   
 3. rebuild postgresql rpms to create postgresql-tcl that links with correct  
libpq  
 4. upgrade postgresql-tcl  
  
but that is sub-standard, to say the least. It should be possible to force  
postgresql-tcl to link with the libraries built during the same rpmbuild.  
  
Cheers, 
 
Philippe 
      
Comment 3 Tom Lane 2005-08-24 16:07:18 EDT
Hmm.  I believe that Postgres isn't installed at all on our build machines,
which may explain why the distributed RPMs are OK.  But I've not noticed this
effect in my own personal builds.  Maybe it occurs only on x86_64?
Comment 4 Tom Lane 2005-10-04 19:19:14 EDT
Well, the reason I hadn't noticed it is I don't generally build with a different
version of Postgres already installed :-(.  It's definitely broken.  There's a
fix in postgresql-8.0.4-2.FC4.1.

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