Bug 113273

Summary: rpm-build check-files Broken pipe
Product: [Fedora] Fedora Reporter: Andrea Pasquinucci <cesare>
Component: rpmAssignee: Jeff Johnson <jbj>
Status: CLOSED RAWHIDE QA Contact: Mike McLean <mikem>
Severity: medium Docs Contact:
Priority: medium    
Version: 1   
Target Milestone: ---   
Target Release: ---   
Hardware: athlon   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-02-10 21:26:17 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
output of rpmbuild with original check-files script
none
rpmbuild output with modified check-files script none

Description Andrea Pasquinucci 2004-01-11 20:29:21 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1)
Gecko/20031114

Description of problem:
This leaves me quite puzzled. Always been able to build rpms both as
root and as an user. On Fedora Core1 never worked under any
circumstance, giving the (NON error) messages

Checking for unpackaged file(s): /usr/lib/rpm/check-files %{buildroot}
getOutputFrom(): Broken pipe

and stop dead there. Tried adding BuildRoot to the package, defined
all possible macros in ~/.rpmmacros, setting
%_unpackaged_files_terminate_build 0 (as for BUG 103455), nothing at
all (even fixed "spit" in perl.prov...)

Then I tried to modify /usr/lib/rpm/check-files as follows at its
beginning:

RPM_BUILD_ROOT=$1
echo "Value of RPM_BUILD_ROOT="$RPM_BUILD_ROOT 1>&2
RPM_BUILD_ROOT=/my/real/dir/to/build
echo "New Value of RPM_BUILD_ROOT="$RPM_BUILD_ROOT 1>&2

and added at the end

echo "End check-files" 1>&2

and set "%_topdir /my/dir" in ~/.rpmmacros (wont work otherwise) 
finally as an normal user I give:

rpmbuild -bb --root /my/dir file.spec

and it builds cleanly saying:

Checking for unpackaged file(s): /usr/lib/rpm/check-files %{buildroot}
Value of RPM_BUILD_ROOT=%{buildroot}
New Value of RPM_BUILD_ROOT=/my/real/dir/to/build
End check-files

Now I build rpms, but I do not understand why....


Version-Release number of selected component (if applicable):
rpm-4.2.1-0.30 rpm-build-4.2.1-0.30

How reproducible:
Always

Steps to Reproduce:
1. have a spec file ready
2. run rpmbuild -bb  on it
3.
    

Actual Results:  Checking for unpackaged file(s):
/usr/lib/rpm/check-files %{buildroot}
getOutputFrom(): Broken pipe


Expected Results:  build rpm

Additional info:

If it could be useful, I upgraded RH-7.3 to Fedora Core1 directly, I
run strace on rpmbuild with no useful info at all (apart from a few
complaint on LC_ALL been set to the wrong thing, which I changed of
course)

Comment 1 Jeff Johnson 2004-01-12 11:21:34 UTC
Do you have a BuildRoot: directive in your spec file?

Comment 2 Andrea Pasquinucci 2004-01-12 13:20:42 UTC
Yes I do! 

Please notice the output of my 
   echo "Value of RPM_BUILD_ROOT="$RPM_BUILD_ROOT 1>&2 
added command to check-files, there is %{buildroot}, that is
the name of the parameter and not its value.

Andrea

Comment 3 Jeff Johnson 2004-01-12 14:44:52 UTC
Please supply a ptr (i.e. URL) to a src.rpm and I'll take a look.

Comment 4 Andrea Pasquinucci 2004-01-18 19:59:07 UTC
I'm back, sorry for the delay. I spent part of today trying to figure
out what is going on, little luck. First the URLs:

http://www.ucci.it/prps-0-2.src.rpm
http://www.ucci.it/rpmmacros

the simpliest src.rpm I have and my latest ~/.rpmmacros

Anyway, now I can build rpm giving as a normal user the command

   rpmbuild -vv --root ~/URPM -ba prps-0.spec

but
1. there MUST NOT be a Buildroot: in the spec file (last time I tried
   I had to have a BuildRoot, boh...)
2. there MUST NOT be a %_topdir in the .rpmmacros file
3. there MUST NOT be any variable used to define parameters in the
   .rpmmacros file (like %{name} etc.)
4. I MUST set by hand the variable $RPM_BUILD_ROOT in the file  
   /usr/lib/rpm/check-files

If I do not do one of these things, it seems to me that parameters 
are not expanded, like it is trying to open files with name 
/usr/src/redhat/%{buildroot} (this is an example I made up, the point
is that %buildroot is NOT expanded), I can see this by running strace. 
Or it makes path where it repeats 3 or 4 times
the Buildroot I gave in the spec file, and it puts a file in a
dir with 3 times the Buildroot but looks for it in dir with 2 times 
the Buildroot ...  

I am totaly, completely confused, but I can build rpm now.

PS. Same thing if I build rpm as root.

Comment 5 Jeff Johnson 2004-01-19 01:43:14 UTC
Adding --root to rpmbuild requires additional configuration
and does not have any simple (or useful to you) semantics.

What happens if you build w/o --root?

Comment 6 Andrea Pasquinucci 2004-01-19 08:28:25 UTC
As the root user giving the command

rpmbuild -vv -ba prps-0.spec

it works with my modified check-files script, otherwise it does not
(I attach the outcome of both cases), but it requires that I build from
the real tree of the machine, whereas I have the files in an private 
tree (non root owned) starting under my own home directory. If I build 
from the root directory as a normal user, it works as for root
(check-files must be modified), but only with the ~/.rpmmacros file I
posted. 

Comment 7 Andrea Pasquinucci 2004-01-19 08:29:38 UTC
Created attachment 97093 [details]
output of rpmbuild with original check-files script

Comment 8 Andrea Pasquinucci 2004-01-19 08:30:21 UTC
Created attachment 97094 [details]
rpmbuild output with modified check-files script

Comment 9 Jeff Johnson 2004-02-10 21:26:17 UTC
The broken pipe message is now addressed by
flushing the input pipe. rpm-4.2.2-0.8 and later.