rpm and [error] logging #103

Closed
reikje opened this Issue Dec 9, 2013 · 13 comments

Projects

None yet

4 participants

@reikje
reikje commented Dec 9, 2013

When running rpm:package-bin, some output is logged on [error] for some reason. Example:

[info] Building for target noarch-vendor-Linux
[info] Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.48357
[error] + umask 022
[error] + cd /vagrant_data/foo/target/rpm/BUILD
[error] + LANG=C

When I execute the script manually the output looks like:

[root@centos58 foo]# sh -e /var/tmp/rpm-tmp.38734
+ umask 022
+ cd /vagrant_data/strand/target/rpm/BUILD
+ LANG=C
+ export LANG

The problem with the [error] logging is that this will fail some build (CI) servers which use the logs to determine if a build has failed (i.e. Bamboo).

@jsuereth
Member
jsuereth commented Dec 9, 2013

SO, one of two things:

  1. I'm using the error logger to dump the output of the rpm task.
  2. rpm is dumping its output on STDERR rather than STDOUT and so it's showing up on the error logger.

If it's the first I'll fix it :)

@reikje
reikje commented Dec 9, 2013

Gut feeling - it's the second but crossing fingers :)

@jsuereth
Member
jsuereth commented Dec 9, 2013

Don't underestimate my lazyness. We're just using vanilla sbt logging:

https://github.com/sbt/sbt-native-packager/blob/master/src/main/scala/com/typesafe/sbt/packager/rpm/RpmHelper.scala#L75-L89

This, by default, puts the stdout on INFO and stderr on ERROR.

We have two options:

  1. Customize the ProcessIO used for this fork so stderr goes to INFO.
  2. Try to find an appropriate silence command to rpmbuild.

Do you know any answer to 2?

@reikje
reikje commented Dec 9, 2013

There is --quiet but the manual says it will display errors (http://www.rpm.org/max-rpm-snapshot/rpmbuild.8.html). Sending it to dev/null isn't nice either I guess. So you are saying it logs to stderr?

@jsuereth
Member
jsuereth commented Dec 9, 2013

It appears to be the case....
On Dec 9, 2013 11:17 AM, "Reik Schatz" notifications@github.com wrote:

There is --quiet but the manual says it will display errors (
http://www.rpm.org/max-rpm-snapshot/rpmbuild.8.html). Sending it to
dev/null isn't nice either I guess. So you are saying it logs to stderr?


Reply to this email directly or view it on GitHubhttps://github.com/sbt/sbt-native-packager/issues/103#issuecomment-30145563
.

@reikje
reikje commented Dec 9, 2013

In the tmp scripts that get generated and run, i.e. /var/tmp/rpm-tmp.38734, there is the line:

set -x

which will output all the commands that follow. Do you know why this is there? It would be better to use echo instead if this is for debugging. If the set -x is removed this should fix it.

@jsuereth
Member
jsuereth commented Dec 9, 2013

No, I'm not sure. Probably an artifact of earlier debugging :) We can remove that, thanks for the analysis!

@reikje
reikje commented Dec 9, 2013

No prob. Josh sorry for abusing this issue now but if you have time and some comments on: http://stackoverflow.com/questions/20429906/building-paths-in-sbt-for-the-packagemappings-of-the-sbt-native-packager I'd be more than thankful :P

@jon-shanks

Hey just wondering about this as i am hitting the same issue and wondering if there is a fix for it?

@muuki88
Contributor
muuki88 commented Feb 26, 2014

The set -x got removed, but this didn't fix the issue.

@jon-shanks

I don't think it is, rpmbuild is responsible for creating the scripts from the corresponding sections, %install on mine doesn't have a set -x option within it and checking the code i don't see that either in the metadata scala file. Plus set -x is just bash debug, which just is for debugging and it goes to stdout as oppose stderr. By default as well rpmbuild does a sh -e to the actual tmp script it creates for the sections, so that it will bomb out and stop on any error.

So this has to be something to do with it thinking stdout is infact stderr or something else?

@jsuereth
Member

No, rpmbuild is dumping to stderr (at least on my machines). I'm debating putting --quiet, but worried that will just make errors more confusing.... WDYT?

@muuki88
Contributor
muuki88 commented Feb 27, 2014

IMHO a warning message before the rpm build starts like Some error messages occur due to rpm output to stderr is better than silencing the whole thing.

@muuki88 muuki88 closed this Sep 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment