This service will be undergoing maintenance at 00:00 UTC, 2016-09-28. It is expected to last about 1 hours
Bug 26517 - build scripts that fail inside parentheses don't cause rpm building to fail
build scripts that fail inside parentheses don't cause rpm building to fail
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: rpm (Show other bugs)
6.2
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Johnson
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-02-07 14:04 EST by Need Real Name
Modified: 2007-04-18 12:31 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-02-07 14:25:02 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
Here is a source rpm that improperly continues after the build. (1.69 KB, application/x-rpm)
2001-02-07 14:22 EST, Need Real Name
no flags Details
And here is the rpm with the spec fixed. But rpm -bb should behave the same for both (1.69 KB, application/x-rpm)
2001-02-07 14:24 EST, Need Real Name
no flags Details

  None (edit)
Description Need Real Name 2001-02-07 14:04:32 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.61 [en] (X11; I; Linux 2.2.12-20 i686)


In an rpm spec, if you have

%build
(cd foo;make foo)

and the make fails, then rpm goes ahead and tries to finish making the
rpms.  If you do this instead

%build
cd foo;make foo

then a failure in the make causes the whole rpm --bb to stop.

The presence of parentheses should not change the behavior.  I've seen this
in RPM 3.0.5-9.6x
The correct behavior is that when the make fails, the rpm should not be
built.

Reproducible: Always
Steps to Reproduce:
Make an rpm out of a makefile that fails.  (I built a foo.tar.gz that
contained a file foo/foo.c which doesn't compile) and then have the %build
step be
 (cd foo; make foo)
the make fails, but the rpm system will continue by running the %install
script.

This is the bad behavior in which the problem isn't noticed until the
install script runs.

$ rpm -bb foo.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.89140
+ umask 022
+ cd /u0/bradley/redhat/BUILD
+ cd /u0/bradley/redhat/BUILD
+ rm -rf foo
+ /bin/mkdir -p foo
+ cd foo
+ /bin/gzip -dc /u0/bradley/redhat/SOURCES/foo.tar.gz
+ tar -xvvf -
drwxrwxr-x bradley/users     0 2001-02-07 10:01:47 foo/
-rw-rw-r-- bradley/users    17 2001-02-07 10:01:47 foo/foo.c
-rw-rw-r-- bradley/users     0 2001-02-07 10:01:34 foo/foo.c.~1~
+ STATUS=0
+ [ 0 -ne 0 ]
++ /usr/bin/id -u
+ [ 20202 = 0 ]
++ /usr/bin/id -u
+ [ 20202 = 0 ]
+ /bin/chmod -Rf a+rX,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.89140
+ umask 022
+ cd /u0/bradley/redhat/BUILD
+ cd foo
+ cd foo
+ make foo
gcc -g -O2    foo.c   -o foo
foo.c:1: parse error before `)'
make: *** [foo] Error 1
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.89140
+ umask 022
+ cd /u0/bradley/redhat/BUILD
+ cd foo
+ rm -rf /u0/bradley/redhat/buildroot
+ mkdir --parents /u0/bradley/redhat/buildroot/usr/local
+ cp foo /u0/bradley/redhat/buildroot/usr/local/foo
cp: foo: omitting directory
Bad exit status from /var/tmp/rpm-tmp.89140 (%install)

This is the good behavior
$ rpm -bb foo.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.3115
+ umask 022
+ cd /u0/bradley/redhat/BUILD
+ cd /u0/bradley/redhat/BUILD
+ rm -rf foo
+ /bin/mkdir -p foo
+ cd foo
+ /bin/gzip -dc /u0/bradley/redhat/SOURCES/foo.tar.gz
+ tar -xvvf -
drwxrwxr-x bradley/users     0 2001-02-07 10:01:47 foo/
-rw-rw-r-- bradley/users    17 2001-02-07 10:01:47 foo/foo.c
-rw-rw-r-- bradley/users     0 2001-02-07 10:01:34 foo/foo.c.~1~
+ STATUS=0
+ [ 0 -ne 0 ]
++ /usr/bin/id -u
+ [ 20202 = 0 ]
++ /usr/bin/id -u
+ [ 20202 = 0 ]
+ /bin/chmod -Rf a+rX,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.3115
+ umask 022
+ cd /u0/bradley/redhat/BUILD
+ cd foo
+ cd foo
+ make foo
gcc -g -O2    foo.c   -o foo
foo.c:1: parse error before `)'
make: *** [foo] Error 1
Bad exit status from /var/tmp/rpm-tmp.3115 (%build)
Comment 1 Need Real Name 2001-02-07 14:22:19 EST
Created attachment 9280 [details]
Here is a source rpm that improperly continues after the build.
Comment 2 Need Real Name 2001-02-07 14:24:58 EST
Created attachment 9281 [details]
And here is the rpm with the spec fixed.  But rpm -bb should behave the same for both
Comment 3 Jeff Johnson 2001-02-07 14:36:19 EST
This is a packaging problem, not an rpm problem, and has to do with passing
a -e option from parent shell to sub-shell. Try

	(cd foo && exit 1
	make foo && exit 1
	)

and other variant shell scripts to fix.

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