<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 01:29:09 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>Whamcloud Community JIRA</title>
    <link>https://jira.whamcloud.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.4.14</version>
        <build-number>940014</build-number>
        <build-date>05-12-2023</build-date>
    </build-info>


<item>
            <title>[LU-2897] the lbuild &quot;trap &apos;xxxx&apos; ERR&quot; must be unset before exit</title>
                <link>https://jira.whamcloud.com/browse/LU-2897</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;If not cleared, the backtrace and bug reporting function gets invoked.&lt;br/&gt;
Since calls to fatal() imply an error was detected, it is not&lt;br/&gt;
an &quot;uncaught error&quot; but a well-known error.&lt;/p&gt;

&lt;p&gt;Also a dinkleberry version of &quot;usage()&quot; was left in lbuild.&lt;/p&gt;</description>
                <environment></environment>
        <key id="17747">LU-2897</key>
            <summary>the lbuild &quot;trap &apos;xxxx&apos; ERR&quot; must be unset before exit</summary>
                <type id="1" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="4" iconUrl="https://jira.whamcloud.com/images/icons/priorities/minor.svg">Minor</priority>
                        <status id="5" iconUrl="https://jira.whamcloud.com/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="2">Won&apos;t Fix</resolution>
                                        <assignee username="wc-triage">WC Triage</assignee>
                                    <reporter username="bkorb">Bruce Korb</reporter>
                        <labels>
                    </labels>
                <created>Fri, 1 Mar 2013 15:47:40 +0000</created>
                <updated>Fri, 24 Apr 2015 00:36:37 +0000</updated>
                            <resolved>Fri, 24 Apr 2015 00:36:37 +0000</resolved>
                                                                        <due></due>
                            <votes>0</votes>
                                    <watches>3</watches>
                                                                            <comments>
                            <comment id="53223" author="bkorb" created="Fri, 1 Mar 2013 15:48:34 +0000"  >&lt;p&gt;Um, wrong web site.  Sorry. &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.whamcloud.com/images/icons/emoticons/sad.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                            <comment id="53232" author="morrone" created="Sat, 2 Mar 2013 16:31:28 +0000"  >&lt;p&gt;Even so, you are not wrong.  Even just running &quot;lbuild -h&quot; trips the trap, dumps backtrace, and tries to send email to whamcloud.  So I would say this site is a fine place to discuss and work on the problem.&lt;/p&gt;

&lt;p&gt;I&apos;m not sure which fatal() issue you are seeing, but I fixed one in &lt;a href=&quot;https://github.com/chaos/lustre/commit/dcce9cc80a220cd486305e2d7322a96b3dd3c0d1&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;a commit on github&lt;/a&gt;.  I have a patch in gerrit to relocate the lbuild files, so I waiting to submit other lbuild changes to gerrit until that one lands.&lt;/p&gt;

&lt;p&gt;That fix addresses a bug that makes fatal() throw an exception any time a message is not given as an option to fatal().  Perhaps that is the problem you are seeing?&lt;/p&gt;

&lt;p&gt;That commit and a couple of other lbuild cleanup changes are on my &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-1199&quot; title=&quot;lustre build system overhaul&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-1199&quot;&gt;&lt;del&gt;LU-1199&lt;/del&gt;&lt;/a&gt; work-in-progress branch here:&lt;/p&gt;

&lt;p&gt;  &lt;a href=&quot;https://github.com/chaos/lustre/commits/LU-1199-wip&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/chaos/lustre/commits/LU-1199-wip&lt;/a&gt;&lt;/p&gt;
</comment>
                            <comment id="53233" author="bkorb" created="Sat, 2 Mar 2013 17:29:17 +0000"  >&lt;p&gt;In that case, a patch is on its way.  I&apos;ve fixed it in the Xyratex sources and presumed that it was me and didn&apos;t test the original.  (I had made another change to make the configuring of lbuild comprehensible.)&lt;/p&gt;

&lt;p&gt;Given the utter incomprehensibility of lbuild, I&apos;m a bit surprised that it hasn&apos;t been seen before.&lt;/p&gt;

&lt;p&gt;Anyway, the fix is to have fatal() disarm the uncaught error trap:  trap &apos;&apos; ERR&lt;br/&gt;
and presto!  no problem.  And, yes, it is triggered by:  [ -n &apos;&apos; ]&lt;br/&gt;
resulting in a command failure.&lt;/p&gt;

&lt;p&gt;The fix I am preparing will also fix inconsistencies between the help text and the command line parsing, remove help text for the two no-op options and document the &quot;extra&quot; dozen configurables for which there are no command line options.  I also create this config file template:&lt;/p&gt;

&lt;p&gt; &amp;gt;# lbuild configuration file (template - rename to &apos;.lbuildrc&apos;)&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: -d ROOT | --root-dir=ROOT&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Specifies the SCM root directory to use when extracting files.&lt;br/&gt;
 &amp;gt;# ${SCMROOT:&lt;del&gt;${CVSROOT:&lt;/del&gt;${GITROOT}}} is used if this option is not&lt;br/&gt;
 &amp;gt;# present.&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# SCMROOT=${SCMROOT:&lt;del&gt;${CVSROOT:&lt;/del&gt;${GITROOT}}}&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: -l LOCALDIR | --localdir=LOCALDIR&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Specifies local directory with lustre sources.&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# LOCALDIR=&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --external-patches=PATCHES&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Directory similar to lustre/lustre/kernel_patches/ that lbuild should&lt;br/&gt;
 &amp;gt;# look for seres and config files in before looking in the lustre tree.&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# EXTERNAL_PATCHES=&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --extraversion=EXTRA&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Text to use for the rpm release and kernel extraversion.&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# EXTRA_VERSION=&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --timestamp=TIMESTAMP&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Date of building lustre in format YYYYMMDDhhmmss&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# TIMESTAMP=&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --reuserpm=DIR&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Try to reuse old kernel RPMs from DIR&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# REUSERPM=&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --reusebuild=DIR&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Try to reuse old kernel builds from DIR&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# REUSEBUILD=&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --kernelrpm=DIR&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Path to distro kernel RPM collection&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# KERNELRPMSBASE=&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --ccache&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Use ccache&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# CCACHE=&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --norpm&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Do not build RPMs (compile only mode)&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# NORPM=false&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --patchless&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Build lustre client only&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# PATCHLESS=false&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --distro=DISTRO&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Which distro using. Autodetect by default&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# DISTRO=&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --kernelurl=URL&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# URL for obtaining Linux source tarballs referenced by target files.&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# KERNELURL=&apos;http://downloads.lustre.org/public/kernels/$target/old&apos;&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --kerneldir=KERNELDIR&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Directory containing Linux source tarballs referenced by target&lt;br/&gt;
 &amp;gt;# files.&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# KERNELDIR=&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --kerneltree=KERNELTREE&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Directory containing dirs with Linux source tarballs referenced by&lt;br/&gt;
 &amp;gt;# target files. Dir names in format kernel version (&apos;2.6.9&apos;, etc.)&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# KERNELTREE=&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --linux=LINUX&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Directory of Linux kernel sources.  When this option is used, only&lt;br/&gt;
 &amp;gt;# Lustre modules and userspace are built.&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# LINUX=&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --lustre=LUSTRE&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Path to an existing lustre source tarball to use instead of&lt;br/&gt;
 &amp;gt;# pulling from a source code archive.&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# LUSTRE=&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --nodownload&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Do not try to download a kernel&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# DOWNLOAD=true&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --noiokit&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Do not build lustre-iokit RPM. Build by default&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# IOKITRPM=true&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --release&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Specifies that the files generated do not include timestamps,&lt;br/&gt;
 &amp;gt;# and that this is an official release.&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# RELEASE=false&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --src&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Build a .src.rpm, a full kernel patch, and a patched kernel tarball.&lt;br/&gt;
 &amp;gt;# some recent hacking has pretty much neutered this option.&lt;br/&gt;
 &amp;gt;# search through this file (and lbuild.old_school &amp;#8211; but that will&lt;br/&gt;
 &amp;gt;# be going away soon) for &quot;-bb&quot; and see how many places&lt;br/&gt;
 &amp;gt;# simply don&apos;t account for this option&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# DO_SRC=true&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --work=DIR&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Directory to store work files during build process.&lt;br/&gt;
 &amp;gt;# The current directory by default.&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# WORKDIR=$PWD&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --stage=DIR&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Directory used to stage packages for release.  RPMs will be placed more&lt;br/&gt;
 &amp;gt;# or less in DIR/&amp;lt;target&amp;gt;-&amp;lt;arch&amp;gt;, and the tarball will be placed in DIR.&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# STAGEDIR=$PWD&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --tag=TAG&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# An SCM branch/tag/reference specification name to build from.&lt;br/&gt;
 &amp;gt;# If &apos;TAG&apos; begins with &apos;refs/&apos; or &apos;HEAD:refs/&apos;, then it must be&lt;br/&gt;
 &amp;gt;# a GIT ref spec.&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# TAG=&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --target=TARGET&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# The name of the target to build.  The available targets are listed&lt;br/&gt;
 &amp;gt;# below.&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# TARGET=&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --target-arch=HOST_ARCH&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Force a local architecture to value&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# TARGET_ARCH=$(uname -m)&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --target-archs=TARGET_ARCHS&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# A (space delimited) list of architectures to build.  By default, all&lt;br/&gt;
 &amp;gt;# of the archs supported by the TARGET will be built, in addition to a&lt;br/&gt;
 &amp;gt;# .src.rpm.  This option can limit those, for machines that can only&lt;br/&gt;
 &amp;gt;# build certain archs or if you only want a certain arch built (for&lt;br/&gt;
 &amp;gt;# testing, or a one-off kernel).&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Also note that by using a non-base arch (eg, i386) only kernels&lt;br/&gt;
 &amp;gt;# will be built - there will be no lustre-lite-utils package.&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# TARGET_ARCHS=${TARGET_ARCH}&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --disable-datestamp&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Prevents the datestamp flag (-D) from being passed to cvs for&lt;br/&gt;
 &amp;gt;# checkouts. This is a workaround for a problem encountered when&lt;br/&gt;
 &amp;gt;# using lbuild with tinderbox.&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# USE_DATESTAMP=1&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --xen&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Builds a Xen domX kernel.&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# XEN=false&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --kvm&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Builds a kernel with additional KVM features.&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# KVM=false&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: -D DATE | --date=DATE&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Overrides the current date.&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# DATE=$(date)&lt;/p&gt;

&lt;p&gt; &amp;gt;# command line option: --ofed-version=VER&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Version for the Open Fabrics EDition ??&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# OFED_VERSION=&lt;/p&gt;


&lt;p&gt; &amp;gt;# other configurables:&lt;br/&gt;
 &amp;gt;#&lt;br/&gt;
 &amp;gt;# Top build directory &amp;#8211; the directory that contains &quot;lbuild&quot;.&lt;br/&gt;
 &amp;gt;# TOPDIR=$(cd $(dirname $0) &amp;gt;/dev/null &amp;amp;&amp;amp; pwd)&lt;br/&gt;
 &amp;gt;# &lt;br/&gt;
 &amp;gt;# Some distros have many names for essentially the same target.&lt;br/&gt;
 &amp;gt;# # used for staging directory names and download RPM selection&lt;br/&gt;
 &amp;gt;# CANONICAL_TARGET=&lt;br/&gt;
 &amp;gt;# &lt;br/&gt;
 &amp;gt;# change default behavior to only build for the current arch&lt;br/&gt;
 &amp;gt;# TARGET_ARCHS_ALL=&quot;$TARGET_ARCH&quot;&lt;br/&gt;
 &amp;gt;# [ &quot;$TARGET_ARCH&quot; = &quot;i686&quot; ] &amp;amp;&amp;amp; TARGET_ARCHS_ALL=&quot;i686 i586 i386&quot;&lt;br/&gt;
 &amp;gt;# &lt;br/&gt;
 &amp;gt;# Directory for finding old build products&lt;br/&gt;
 &amp;gt;# REUSEDIR=&quot;${WORKDIR}&quot;&lt;br/&gt;
 &amp;gt;# &lt;br/&gt;
 &amp;gt;# Temporary directory&lt;br/&gt;
 &amp;gt;# TMPDIR=${TMPDIR:-&quot;/var/tmp&quot;}&lt;br/&gt;
 &amp;gt;# &lt;br/&gt;
 &amp;gt;# should cached products be used or force rebuilding?&lt;br/&gt;
 &amp;gt;# USE_BUILD_CACHE=true&lt;br/&gt;
 &amp;gt;# &lt;br/&gt;
 &amp;gt;# Pattern used to decide when to skip the diskfs RPM&lt;br/&gt;
 &amp;gt;# SKIPLDISKFSRPM=&quot;v1_4_* b1_4&quot;&lt;br/&gt;
 &amp;gt;# &lt;br/&gt;
 &amp;gt;# linux kernel &quot;object&quot; (executable)&lt;br/&gt;
 &amp;gt;# LINUXOBJ=&lt;br/&gt;
 &amp;gt;# &lt;br/&gt;
 &amp;gt;# default to not adding &lt;del&gt;lustre&lt;/del&gt; into the kernel RPM package names&lt;br/&gt;
 &amp;gt;# KERNEL_LUSTRE_NAMING=false&lt;br/&gt;
 &amp;gt;# &lt;br/&gt;
 &amp;gt;# default not use kabi check.&lt;br/&gt;
 &amp;gt;# USE_KABI=false&lt;br/&gt;
 &amp;gt;# &lt;br/&gt;
 &amp;gt;# patchless build&lt;br/&gt;
 &amp;gt;# RPMSMPTYPE=&lt;br/&gt;
 &amp;gt;# &lt;br/&gt;
 &amp;gt;# names of patch series which must be available&lt;br/&gt;
 &amp;gt;# SERIES=&lt;br/&gt;
 &amp;gt;# &lt;br/&gt;
 &amp;gt;# Extra architectures, from target file&lt;br/&gt;
 &amp;gt;# BASE_ARCHS=&lt;br/&gt;
 &amp;gt;# BIGMEM_ARCHS=&lt;br/&gt;
 &amp;gt;# BOOT_ARCHS=&lt;br/&gt;
 &amp;gt;# JENSEN_ARCHS=&lt;br/&gt;
 &amp;gt;# SMP_ARCHS=&lt;br/&gt;
 &amp;gt;# BIGSMP_ARCHS=&lt;br/&gt;
 &amp;gt;# PSERIES64_ARCHS=&lt;br/&gt;
 &amp;gt;# UP_ARCHS=&lt;br/&gt;
 &amp;gt;# &lt;br/&gt;
 &amp;gt;# build the lustre-tests rpm?&lt;br/&gt;
 &amp;gt;# LUSTRE_TESTS=true&lt;br/&gt;
 &amp;gt;# &lt;br/&gt;
 &amp;gt;# CC=${CC:-gcc} # C-compiler&lt;/p&gt;</comment>
                            <comment id="53234" author="morrone" created="Sat, 2 Mar 2013 17:57:57 +0000"  >&lt;p&gt;I don&apos;t think you need to disable the trap.  They just need to stop using comparison (&amp;amp;&amp;amp;) as control flow in that function.  Unless, perhaps your bug is different then mine.&lt;/p&gt;

&lt;p&gt;I can&apos;t argue with your characterization of lbuild. &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.whamcloud.com/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;

&lt;p&gt;I think it has gone this long without being fixed because those who do the most work on Lustre outside of Intel probably don&apos;t use lbuild.  At LLNL we put together a whole Linux distro based on RHEL, which means that we build our own kernel, our own IB drivers, etc.  The lbuild view of the world, i.e. Lustre owns and builds everything, just doesn&apos;t jive with a world view where Lustre is just one component of an overall system.&lt;/p&gt;

&lt;p&gt;I am only working on lbuild at all because I am overhauling the spec files in &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-1199&quot; title=&quot;lustre build system overhaul&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-1199&quot;&gt;&lt;del&gt;LU-1199&lt;/del&gt;&lt;/a&gt;, and I can&apos;t get any of my work landed until I make lbuild work with it and make the Intel build farm happy.&lt;/p&gt;</comment>
                            <comment id="53235" author="bkorb" created="Sat, 2 Mar 2013 18:44:44 +0000"  >&lt;p&gt;No, you don&apos;t &lt;em&gt;need&lt;/em&gt; to disable the trap, as long as you are careful to not have any commands &quot;accidentally&quot; finishing with a non-zero exit code.  Still, if you have entered a function that is fail-exiting due to a discovered issue (beit just a request for &quot;help&quot; or misuse of options), it makes logical sense to me to disable the trap.&lt;/p&gt;

&lt;p&gt;I&apos;m futzing with the thing because Xyratex has a setup similar to Intel in having automated builds get kicked off upon review submissions.  You&apos;ll be surprised to learn that we&apos;ve had to adapt it.  Much of the adaptation we plan on pushing back to WC/Intel since the changes ought to work there as well.&lt;/p&gt;</comment>
                            <comment id="53301" author="bkorb" created="Mon, 4 Mar 2013 18:45:44 +0000"  >&lt;p&gt;Yes, you &lt;em&gt;do&lt;/em&gt; need to disable the trap.  lbuild is full of constructs like:  str_val=$(myfunc ...)&lt;br/&gt;
If &quot;myfunc&quot; can fail, you will &lt;b&gt;ALWAYS&lt;/b&gt; get a back trace, along with the error message.&lt;br/&gt;
The correct fix is to eliminate that construct and return strings in variables.  Not today.&lt;br/&gt;
The short term fix is to set up a SIGUSR1 signal handler that disables the ERR trap.  e.g.:&lt;br/&gt;
  trap &apos;trap &quot;&quot; ERR ; sleep 1 ; exit 1&apos; USR1&lt;br/&gt;
and then &quot;kill -USR1 $$&quot; from the subshells.  That will disable the &quot;unhandled error&quot; trap and still have the parent process exit non-zero on subshell errors.  Uglier than all get-out, but:&lt;/p&gt;

&lt;p&gt; cleanup() {&lt;br/&gt;
    set -x +e +E&lt;/p&gt;

&lt;p&gt;    &amp;#35; cleanup of uncaught error trap&lt;br/&gt;
    &amp;#35;&lt;br/&gt;
    trap &apos;&apos; ERR TERM&lt;/p&gt;

&lt;p&gt;    &amp;#35; force cleanup of uncaught error trap in parent process&lt;br/&gt;
    &amp;#35;&lt;br/&gt;
    local v=${BASH_VERSION%%.*}&lt;br/&gt;
    if test ${v:-0} -gt 3&lt;br/&gt;
    then v=${BASHPID}&lt;br/&gt;
    else v=$(bash -c &apos;echo $PPID&apos;)&lt;br/&gt;
    fi&lt;br/&gt;
    test ${progpid} -eq ${v} || kill -USR1 ${progpid}&lt;br/&gt;
 }&lt;/p&gt;</comment>
                            <comment id="53307" author="brian" created="Mon, 4 Mar 2013 23:14:12 +0000"  >&lt;blockquote&gt;
&lt;p&gt;Yes, you do need to disable the trap.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;No you don&apos;t.  You need to do error checking.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;lbuild is full of constructs like: str_val=$(myfunc ...)&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Which should be error checked if &lt;tt&gt;myfunc()&lt;/tt&gt; can return an error.  If they it is not, it is an unexpected error and a stacktrace &lt;b&gt;should&lt;/b&gt; be generated.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If &quot;myfunc&quot; can fail, you will ALWAYS get a back trace, along with the error message.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Not if you trap (i.e. error check) the return.  If &lt;tt&gt;myfunc()&lt;/tt&gt; can fail then the caller must check it&apos;s status in order to avoid the stacktracing error function.  That the caller did not check the error return is &lt;em&gt;exactly&lt;/em&gt; what that function is supposed to call attention to.&lt;/p&gt;

&lt;p&gt;So yes:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;str_val=$(myfunc ...)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;will cause the trap to trigger if &lt;tt&gt;myfunc()&lt;/tt&gt; returns an error, however:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;&lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ! str_val=$(myfunc ...); then
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Will not cause a stacktrace because the error condition is checked.&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;$ myfunc(){
&amp;gt; echo &lt;span class=&quot;code-quote&quot;&gt;&quot;&lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; value&quot;&lt;/span&gt;
&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
&amp;gt; }
$ trap &lt;span class=&quot;code-quote&quot;&gt;&apos;echo &lt;span class=&quot;code-quote&quot;&gt;&quot;trapped an error&quot;&lt;/span&gt;&apos;&lt;/span&gt; ERR
$ &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;
trapped an error
$ str_val=$(myfunc)
trapped an error
$ &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; ! str_val=$(myfunc); then
&amp;gt; echo &lt;span class=&quot;code-quote&quot;&gt;&quot;no error trap&quot;&lt;/span&gt;
&amp;gt; fi
no error trap
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="53329" author="bkorb" created="Tue, 5 Mar 2013 10:31:03 +0000"  >&lt;p&gt;str_val=$(myfunc) || exit 1&lt;/p&gt;

&lt;p&gt;I think we both know how to write code that does not trap on errors.&lt;br/&gt;
The question is not so much, &quot;Can we make it work?&quot; but rather&lt;br/&gt;
&quot;What constructs are least prone to mistakes?&quot;  Given that the&lt;br/&gt;
lbuild code is liberally laced with val=$(myfunc) stuff that&lt;br/&gt;
trigger stack traces and email to home whenever someone&apos;s environment&lt;br/&gt;
causes &quot;myfunc()&quot; to fail, I think the &quot;fail()&quot; function should&lt;br/&gt;
pretty clearly take the responsibility for:&lt;/p&gt;

&lt;p&gt; 1. report the error (as it does now)&lt;br/&gt;
 2. disarm the &quot;you have an error that I don&apos;t know about&quot; trap&lt;/p&gt;

&lt;p&gt;the reasons being several fold:&lt;/p&gt;

&lt;p&gt; 1. &quot;fatal()&quot; is reporting the error, so it cannot be considered &quot;unknown&quot;&lt;br/&gt;
 2. When &quot;fatal()&quot; is called from the parent process level, no stack&lt;br/&gt;
     trace is triggered, but it &lt;em&gt;is&lt;/em&gt; triggered from subshells.&lt;br/&gt;
     This is a discrepancy that does not have a good reason.&lt;br/&gt;
 3. fixing all the places where subshells can exit non-zero is&lt;br/&gt;
    laborious and error prone.&lt;/p&gt;

&lt;p&gt;The real solution is to not use subshells, except when genuinely needed.&lt;br/&gt;
Return text results should be in myfunc_result type variables.&lt;br/&gt;
That won&apos;t happen today.  That is even more laborious and error prone,&lt;br/&gt;
unless you are starting a new project.  Subshells ought to be constrained&lt;br/&gt;
to mostly co-processes and invoking a simple command where you need&lt;br/&gt;
to capture stdout.  Not today.&lt;/p&gt;</comment>
                            <comment id="59782" author="morrone" created="Fri, 31 May 2013 18:29:50 +0000"  >&lt;p&gt;My changes to fix the error() function and to remove the code to send email on any trapped error landed in commit 05403115a680adf51990bc9439d78947e8a7beba, &quot;&lt;a href=&quot;https://jira.whamcloud.com/browse/LU-1199&quot; title=&quot;lustre build system overhaul&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-1199&quot;&gt;&lt;del&gt;LU-1199&lt;/del&gt;&lt;/a&gt; lbuild: Fix error handling&quot;.&lt;/p&gt;

&lt;p&gt;Bruce, I would not suspect that there is something special about subshells that makes fatal() trigger a trap.  I think the problem was that there was a bug in error() that caused a trap any time fatal() was called without a message.  My commit fixes that.&lt;/p&gt;

&lt;p&gt;While I&apos;m not necessarily opposed to turning off the trap in fatal(), I don&apos;t think there is any need to do so now.&lt;/p&gt;

&lt;p&gt;Furthermore, if I understand you correctly, you are complaining that &quot;val=$(myfunc)&quot;, where &quot;myfunc&quot; decides to call fatal(), results in a trap and stack dump.  I don&apos;t think that can be fixed by disabling the trap inside of fatal().  The &lt;em&gt;subshell&lt;/em&gt; called fatal(), so the trap is only disabled in the subshell.  When the parent shell sees the error code that is unhandled, it will still have its trap enabled.&lt;/p&gt;

&lt;p&gt;I agree that the use of subshells is less than optimal in lbuild.  But as you say, that requires more of a rewrite than folks probably want to do at the moment.&lt;/p&gt;

&lt;p&gt;So unless I have missed something, I would say that the issue stated in the title of this ticket no longer applies, and this ticket can be closed.&lt;/p&gt;
</comment>
                            <comment id="59795" author="bkorb" created="Fri, 31 May 2013 20:03:45 +0000"  >&lt;p&gt;fatal exits non-zero, triggering the ERR trap.&lt;/p&gt;

&lt;p&gt;I tend to make submissions and not reverify their applicability after new checkins.&lt;br/&gt;
So I have not looked at your &quot;Fix error handling&quot; fix.&lt;/p&gt;

&lt;p&gt;&amp;gt; Furthermore, if I understand you correctly, you are complaining that &quot;val=$(myfunc)&quot;,&lt;br/&gt;
&amp;gt; where &quot;myfunc&quot; decides to call fatal(), results in a trap and stack dump.&lt;br/&gt;
&amp;gt; I don&apos;t think that can be fixed by disabling the trap inside of fatal().&lt;/p&gt;

&lt;p&gt;Hmm.  Child to parent communication is a nuisance.  So there needs to be some sort of&lt;br/&gt;
temp file lock.  Create the thing and remove it when reporting an error and when&lt;br/&gt;
exiting cleanly.  If it exists inside the error trap, &lt;b&gt;THEN&lt;/b&gt; create the stack dump.&lt;br/&gt;
Probably best to leave off automated email, instead of fixing it and leaving it&lt;br/&gt;
off makes the stack trace suppression less crucial, but still should be done.&lt;br/&gt;
The &quot;correct&quot; way to do it is to put &lt;b&gt;all&lt;/b&gt; the coding into a function and:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;    exit_flag_file=$(mktemp ${TMPDIR:-/tmp}/err-exit-XXXXXX)
    unknown_err_handler() {
      test -f ${exit_flag_file} || return 0
      rm -f ${exit_flag_file}
      &amp;lt;&amp;lt;stack trace&amp;gt;&amp;gt;
    }
    trap &apos;srcfile=${BASH_SOURCE} srcline=${BASH_LINENO] unknown_err_handler&apos; ERR
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;That &lt;b&gt;eliminates&lt;/b&gt; the need to mess with this:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;        if [ $n = 1 ]; then
            let lineno-=11
        fi
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;In any event, there were other fixes in my patch, too.  viz. corrections in usage text&lt;br/&gt;
and consistency in handling various options and environment variable parameter&lt;br/&gt;
passing.  (Never ever use one name as a long option name and a completely&lt;br/&gt;
different name as the environment variable version, and usage text really ought to&lt;br/&gt;
match what gets parsed.)&lt;/p&gt;</comment>
                            <comment id="59817" author="morrone" created="Fri, 31 May 2013 22:24:11 +0000"  >&lt;blockquote&gt;&lt;p&gt;fatal exits non-zero, triggering the ERR trap.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;I&apos;m sorry, but I&apos;m pretty sure you have that wrong.  For example:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;$cat exit.sh
#!/bin/bash

hello () {
  echo hello
}

trap hello ERR

fatal () {
  exit 1
}

fatal
$cat return.sh
#!/bin/bash

hello () {
  echo hello
}

trap hello ERR

fatal () {
  return 1
}

fatal
$./exit.sh
$./return.sh
hello
$
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;As you can see, the ERR trap is only triggered when a simple command has a non-zero exit status (see bash man page for more details).  &quot;exit&quot; is &lt;em&gt;not&lt;/em&gt; a &quot;simple command&quot;, it is a special command that terminates the entire process.  exit has no return code within the script, because it never returns.&lt;/p&gt;</comment>
                            <comment id="59846" author="bkorb" created="Sun, 2 Jun 2013 15:46:11 +0000"  >&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;#! /bin/bash

typeset -r prog=$(basename &quot;$0&quot; .sh)
typeset -r program=$(basename &quot;$0&quot;)
typeset -r progdir=$(\cd $(dirname &quot;$0&quot;) &amp;amp;&amp;amp; pwd -P)
typeset -r progpid=$$
typeset -r fflag=$(mktemp ${TMPDIR:-/tmp}/${prog}-fail-XXXXXX)

die() {
    test -f $fflag || return 1
    rm -f $fflag
    echo &quot;${prog} error:  $*&quot; &amp;gt;&amp;amp;2
    kill -TERM ${progpid}
    exit 1
}

bad_copy() {
    echo BROKEN 1&amp;gt;&amp;amp;2
    rm -f $fflag
    exit 1
}

trap &apos;die &quot;trap on ERR&quot;&apos; ERR

set -e

txt=$(bad_copy)

echo WE SHOULD HAVE FAILED
rm -f $fflag&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;and when run:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;$ bash fail.sh 
BROKEN
$ echo $?
1&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;I presume we were misunderstanding each other since I am guessing we both know how to write shell scripts.&lt;/p&gt;</comment>
                            <comment id="59909" author="morrone" created="Mon, 3 Jun 2013 18:01:02 +0000"  >&lt;p&gt;I&apos;d argue that you&apos;re on the path to violating the KISS principle.  But frankly, I don&apos;t care that much about lbuild.  I&apos;m going to drop off this ticket.&lt;/p&gt;</comment>
                            <comment id="113277" author="adilger" created="Fri, 24 Apr 2015 00:36:37 +0000"  >&lt;p&gt;No more interested parties for this issue.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                            <customfield id="customfield_10890" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10390" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hzvk47:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10090" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>6983</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10060" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Severity</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10022"><![CDATA[3]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        </customfields>
    </item>
</channel>
</rss>