Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.15 Regression: #728

Closed
ignatenkobrain opened this issue Jun 2, 2019 · 5 comments · Fixed by #730
Closed

4.15 Regression: #728

ignatenkobrain opened this issue Jun 2, 2019 · 5 comments · Fixed by #730
Milestone

Comments

@ignatenkobrain
Copy link
Contributor

76c429c is the first bad commit

commit 76c429c3178c965c6517629957a633768132904c
Author: Andreas Scherer <andreas_github@freenet.de>
Date:   Mon Nov 26 15:50:15 2018 +0200

    Handle %setup archive unpack exit code centrally and consistently
    
    Previously the exit code handling was missing from uncompressed tar-case.

 build/parsePrep.c | 25 +++++++++----------------
 1 file changed, 9 insertions(+), 16 deletions(-)

Before

⋊> ~/t/p/rust-heck on master ⨯ ~/Projects/upstream/rpm/rpmbuild -ba ./rust-heck.spec -D "_sourcedir $PWD"                                                                   17:05:06
error: Bad source: /home/brain/tmp/playground/rust-heck/heck-0.3.1x1.crate: No such file or directory

After

⋊> ~/t/p/rust-heck on master ⨯ ~/Projects/upstream/rpm/rpmbuild -ba ./rust-heck.spec -D "_sourcedir $PWD"                                                                   17:05:42
error: Bad source: /home/brain/tmp/playground/rust-heck/heck-0.3.1x1.crate: No such file or directory
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.KIKFls
+ umask 022
+ cd /home/brain/rpmbuild/BUILD
+ cd /home/brain/rpmbuild/BUILD
+ rm -rf heck-0.3.1x1
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd heck-0.3.1x1
/var/tmp/rpm-tmp.KIKFls: line 38: cd: heck-0.3.1x1: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.KIKFls (%prep)


RPM build errors:
    Bad source: /home/brain/tmp/playground/rust-heck/heck-0.3.1x1.crate: No such file or directory
    Bad exit status from /var/tmp/rpm-tmp.KIKFls (%prep)
@ignatenkobrain ignatenkobrain added this to the 4.15.0 milestone Jun 2, 2019
@ignatenkobrain
Copy link
Contributor Author

/cc @ascherer FYI

@ignatenkobrain
Copy link
Contributor Author

Also, @pmatilai change made it worse, it continues to execute other sections even if %prep failed.

18e8f4e

⋊> ~/t/p/rust-heck on master ⨯ ~/Projects/upstream/rpm/rpmbuild -ba ./rust-heck.spec -D "_sourcedir $PWD"                                                                   17:23:48
error: Bad source: /home/brain/tmp/playground/rust-heck/heck-0.3.1x1.crate: No such file or directory
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.rzlT5p
+ umask 022
+ cd /home/brain/rpmbuild/BUILD
+ cd /home/brain/rpmbuild/BUILD
+ rm -rf heck-0.3.1x1
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd heck-0.3.1x1
/var/tmp/rpm-tmp.rzlT5p: line 38: cd: heck-0.3.1x1: No such file or directory
error: /bin/sh failed: 100
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.p6LTus
+ umask 022
+ cd /home/brain/rpmbuild/BUILD
+ cd heck-0.3.1x1
/var/tmp/rpm-tmp.p6LTus: line 30: cd: heck-0.3.1x1: No such file or directory
error: /bin/sh failed: 100
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.1kzKtp
+ umask 022
+ cd /home/brain/rpmbuild/BUILD
+ '[' /home/brain/rpmbuild/BUILDROOT/rust-heck-0.3.1x1-1.fc31.x86_64 '!=' / ']'
+ rm -rf /home/brain/rpmbuild/BUILDROOT/rust-heck-0.3.1x1-1.fc31.x86_64
++ dirname /home/brain/rpmbuild/BUILDROOT/rust-heck-0.3.1x1-1.fc31.x86_64
+ mkdir -p /home/brain/rpmbuild/BUILDROOT
+ mkdir /home/brain/rpmbuild/BUILDROOT/rust-heck-0.3.1x1-1.fc31.x86_64
+ cd heck-0.3.1x1
/var/tmp/rpm-tmp.1kzKtp: line 34: cd: heck-0.3.1x1: No such file or directory
error: /bin/sh failed: 100
Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.e4WuKq
+ umask 022
+ cd /home/brain/rpmbuild/BUILD
+ cd heck-0.3.1x1
/var/tmp/rpm-tmp.e4WuKq: line 30: cd: heck-0.3.1x1: No such file or directory
error: /bin/sh failed: 100
error: Bad file: /home/brain/tmp/playground/rust-heck/heck-0.3.1x1.crate: No such file or directory


RPM build errors:
    Bad source: /home/brain/tmp/playground/rust-heck/heck-0.3.1x1.crate: No such file or directory
    /bin/sh failed: 100
    /bin/sh failed: 100
    /bin/sh failed: 100
    /bin/sh failed: 100
    Bad file: /home/brain/tmp/playground/rust-heck/heck-0.3.1x1.crate: No such file or directory

@ignatenkobrain
Copy link
Contributor Author

Looking at original cause of error 100, it seems to be here:

D: 	waitpid(31325) rc 31325 status 100
error: /bin/sh failed: 100

@ignatenkobrain
Copy link
Contributor Author

diff --git a/build/rpmfc.c b/build/rpmfc.c
index 5f3f56872..6e88c9359 100644
--- a/build/rpmfc.c
+++ b/build/rpmfc.c
@@ -446,6 +446,7 @@ int rpmfcExec(ARGV_const_t av, StringBuf sb_stdin, StringBuf * sb_stdoutp,
                       failnonzero, buildRoot, dup);
     if (ec) {
        sb = freeStringBuf(sb);
+       goto exit;
     }
 
     if (sb_stdoutp != NULL) {
@@ -453,8 +454,6 @@ int rpmfcExec(ARGV_const_t av, StringBuf sb_stdin, StringBuf * sb_stdoutp,
        sb = NULL;      /* XXX don't free */
     }
 
-    ec = 0;
-
 exit:
     freeStringBuf(sb);
     argvFree(xav);

With patch above, I see following:

  • rpmlog(RPMLOG_ERR, _("%s failed: %x\n"), argv[0], status); is not showing return code, it returns status without WEXITSTATUS, so it is not helpful to user.
  • In build/build.c, rpmlog(RPMLOG_ERR, _("Exec of %s failed (%s): %s\n") uses strerror(errno), but there is nothing what sets errno at that time because process went much further.
  • %__build_post does not actually getting executed if somebody runs yes &; exit 1 , so it is not getting killed

ignatenkobrain added a commit to ignatenkobrain/rpm that referenced this issue Jun 2, 2019
Also, emptying stdout if it was requested does not make sense when
command fails. Usually, if command fails, you still might want to see
the output and use it somehow.

References: rpm-software-management#728
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
ignatenkobrain added a commit to ignatenkobrain/rpm that referenced this issue Jun 2, 2019
First issue is that doUntar() when encounters an issue related to the
spec file, returns non-NULL which indicates that no error has happened.
Second is that even if it would return that, parsePrep() is simply
ignores return code.

Also be more consistent with "goto exit;".

Fixes: 76c429c
Fixes: c7a8c1e
Fixes: rpm-software-management#728
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
ignatenkobrain added a commit to ignatenkobrain/rpm that referenced this issue Jun 2, 2019
First issue is that doUntar() when encounters an issue related to the
spec file, returns non-NULL which indicates that no error has happened.
Second is that even if it would return that, parsePrep() is simply
ignores return code.

Also be more consistent with "goto exit;".

Fixes: 76c429c
Fixes: c7a8c1e
Fixes: rpm-software-management#728
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
ignatenkobrain added a commit to ignatenkobrain/rpm that referenced this issue Jun 2, 2019
First issue is that doUntar() when encounters an issue related to the
spec file, returns non-NULL which indicates that no error has happened.
Second is that even if it would return that, parsePrep() is simply
ignores return code.

Also be more consistent with "goto exit;".

Fixes: 76c429c
Fixes: c7a8c1e
Fixes: rpm-software-management#728
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
ignatenkobrain added a commit to ignatenkobrain/rpm that referenced this issue Jun 2, 2019
When getOutputFrom() is set to fail with non-zero return code, it should
not dump non user-friendly (no context, no user return code) message
into a terminal.

error: /bin/sh failed: 100

References: rpm-software-management#728
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
ignatenkobrain added a commit to ignatenkobrain/rpm that referenced this issue Jun 2, 2019
Also, emptying stdout if it was requested does not make sense when
command fails. Usually, if command fails, you still might want to see
the output and use it somehow.

References: rpm-software-management#728
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
ignatenkobrain added a commit to ignatenkobrain/rpm that referenced this issue Jun 2, 2019
Following snippet from buildlog is not helpful to user:

[…]
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.FqlMc8
[…]
+ exit 1
error: Exec of /var/tmp/rpm-tmp.FqlMc8 failed (%prep): No such file or directory

Previous rpmbuild versions returned:

[…]
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.epLFi2
[…]
+ exit 1
error: Bad exit status from /var/tmp/rpm-tmp.epLFi2 (%prep)

So let's restore good old version of a message.

References: rpm-software-management#728
Fixes: 18e8f4e
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
@ignatenkobrain
Copy link
Contributor Author

2 separate patchsets has been sent for this issue (they are somewhat unrelated): #729 #730

pmatilai pushed a commit that referenced this issue Jun 3, 2019
First issue is that doUntar() when encounters an issue related to the
spec file, returns non-NULL which indicates that no error has happened.
Second is that even if it would return that, parsePrep() is simply
ignores return code.

Also be more consistent with "goto exit;".

Fixes: 76c429c
Fixes: c7a8c1e
Fixes: #728
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
ignatenkobrain added a commit to ignatenkobrain/rpm that referenced this issue Jun 3, 2019
When getOutputFrom() is set to fail with non-zero return code, it should
not dump non user-friendly (no context, no user return code) message
into a terminal.

error: /bin/sh failed: 100

References: rpm-software-management#728
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
ignatenkobrain added a commit to ignatenkobrain/rpm that referenced this issue Jun 3, 2019
Also, emptying stdout if it was requested does not make sense when
command fails. Usually, if command fails, you still might want to see
the output and use it somehow.

References: rpm-software-management#728
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
ignatenkobrain added a commit to ignatenkobrain/rpm that referenced this issue Jun 3, 2019
Following snippet from buildlog is not helpful to user:

[…]
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.FqlMc8
[…]
+ exit 1
error: Exec of /var/tmp/rpm-tmp.FqlMc8 failed (%prep): No such file or directory

Previous rpmbuild versions returned:

[…]
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.epLFi2
[…]
+ exit 1
error: Bad exit status from /var/tmp/rpm-tmp.epLFi2 (%prep)

So let's restore good old version of a message.

References: rpm-software-management#728
Fixes: 18e8f4e
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
pmatilai pushed a commit that referenced this issue Jun 3, 2019
When getOutputFrom() is set to fail with non-zero return code, it should
not dump non user-friendly (no context, no user return code) message
into a terminal.

error: /bin/sh failed: 100

References: #728
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
pmatilai pushed a commit that referenced this issue Jun 3, 2019
Also, emptying stdout if it was requested does not make sense when
command fails. Usually, if command fails, you still might want to see
the output and use it somehow.

References: #728
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
pmatilai pushed a commit that referenced this issue Jun 3, 2019
Following snippet from buildlog is not helpful to user:

[…]
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.FqlMc8
[…]
+ exit 1
error: Exec of /var/tmp/rpm-tmp.FqlMc8 failed (%prep): No such file or directory

Previous rpmbuild versions returned:

[…]
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.epLFi2
[…]
+ exit 1
error: Bad exit status from /var/tmp/rpm-tmp.epLFi2 (%prep)

So let's restore good old version of a message.

References: #728
Fixes: 18e8f4e
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant