<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 01:56:50 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-6056] sanity-hsm uses bash&apos;s local built-in incorrectly</title>
                <link>https://jira.whamcloud.com/browse/LU-6056</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;sanity-hsm (and probably all test scripts) contains several instances of the following&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;    local fid=$(make_large_for_striping $f)
    [ $? != 0 ] &amp;amp;&amp;amp; skip &lt;span class=&quot;code-quote&quot;&gt;&quot;not enough free space&quot;&lt;/span&gt; &amp;amp;&amp;amp; &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;This is wrong since the exit status of make_large_for_striping gets discarded when used with the local built-in.&lt;/p&gt;

&lt;p&gt;If this is rewritten as&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;    local fid

    fid=$(make_large_for_striping $f)
    [ $? != 0 ] &amp;amp;&amp;amp; skip &lt;span class=&quot;code-quote&quot;&gt;&quot;not enough free space&quot;&lt;/span&gt; &amp;amp;&amp;amp; &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;then it will work as intended.&lt;/p&gt;

&lt;p&gt;From the Google Bash Style Guide &quot;Declaration and assignment must be separate statements when the assignment value is provided by a command substitution; as the &apos;local&apos; builtin does not propagate the exit code from the command substitution.&quot;&lt;/p&gt;</description>
                <environment></environment>
        <key id="27986">LU-6056</key>
            <summary>sanity-hsm uses bash&apos;s local built-in incorrectly</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="1">Fixed</resolution>
                                        <assignee username="bfaccini">Bruno Faccini</assignee>
                                    <reporter username="jhammond">John Hammond</reporter>
                        <labels>
                            <label>hsm</label>
                            <label>tests</label>
                    </labels>
                <created>Fri, 19 Dec 2014 17:13:06 +0000</created>
                <updated>Fri, 5 Jun 2015 00:33:06 +0000</updated>
                            <resolved>Fri, 16 Jan 2015 18:29:21 +0000</resolved>
                                    <version>Lustre 2.7.0</version>
                                    <fixVersion>Lustre 2.7.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>5</watches>
                                                                            <comments>
                            <comment id="102119" author="gerrit" created="Fri, 19 Dec 2014 22:56:53 +0000"  >&lt;p&gt;Faccini Bruno (bruno.faccini@intel.com) uploaded a new patch: &lt;a href=&quot;http://review.whamcloud.com/13159&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/13159&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-6056&quot; title=&quot;sanity-hsm uses bash&amp;#39;s local built-in incorrectly&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-6056&quot;&gt;&lt;del&gt;LU-6056&lt;/del&gt;&lt;/a&gt; tests: fix -hsm wrong usage of bash&apos;s local built-in&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 7e729e909e24b77dfc5e8dc1ef4a9dabd34cccc7&lt;/p&gt;</comment>
                            <comment id="102120" author="bfaccini" created="Fri, 19 Dec 2014 22:57:18 +0000"  >&lt;p&gt;Wow, thanks to have found this John!&lt;br/&gt;
Since I am guilty to have written the specific code snippet shown in your submission text, with my recent patch for &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-3852&quot; title=&quot;sanity-hsm test_251: client26-vm &amp;quot;dd: no space left on device&amp;quot;&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-3852&quot;&gt;&lt;del&gt;LU-3852&lt;/del&gt;&lt;/a&gt;, I have just pushed patch at &lt;a href=&quot;http://review.whamcloud.com/13159&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/13159&lt;/a&gt; to fix this, as you have indicated, in sanity-hsm script where I have found a few more occurrences (only by searching for the &apos;$?&apos; pattern and identifying if associated command was used in a &apos;local&apos; assignment) in addition to mine.&lt;br/&gt;
Concerning the other possible occurrences of such bug in our other scripts and since it does not look really easy to be automatically detected, I have a question, did you find it just by reading the script or have used some code browser/tool that could also be widely run on all our scripts?&lt;/p&gt;</comment>
                            <comment id="102145" author="jhammond" created="Sat, 20 Dec 2014 15:39:29 +0000"  >&lt;p&gt;&amp;gt; Concerning the other possible occurrences of such bug in our other scripts and since it does not look really easy to be automatically detected, I have a question, did you find it just by reading the script or have used some code browser/tool that could also be widely run on all our scripts?&lt;/p&gt;

&lt;p&gt;I only noticed because (while running locally) I could see that make_large_for_cancel() was failing but that the [ $? != 0 ] test was not detecting the failure. This reminded me of the strange behavior of local.&lt;/p&gt;

&lt;p&gt;About auditing the other scripts, maybe something like the following could be used:&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;awk &apos;
/local/ {
    last_local_nr = NR;
    last_local_line = $0;
}
/\$\?/ {
    &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (last_local_nr == NR - 1) {
        printf &lt;span class=&quot;code-quote&quot;&gt;&quot;%4d:%s\n&quot;&lt;/span&gt;, last_local_nr, last_local_line
        printf &lt;span class=&quot;code-quote&quot;&gt;&quot;%4d:%s\n&quot;&lt;/span&gt;, NR, $0;
        printf &lt;span class=&quot;code-quote&quot;&gt;&quot;----\n&quot;&lt;/span&gt;
    }
}
&apos; lustre/tests/sanity-hsm.sh
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Obviously it doesn&apos;t catch everything.&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; 535:	local st=$($LFS hsm_state $f)
 536:	[[ $? == 0 ]] || error &quot;$LFS hsm_state $f failed&quot;
----
1155:	local fid=$(make_large_for_striping $f)
1156:	[ $? != 0 ] &amp;amp;&amp;amp; skip &quot;not enough free space&quot; &amp;amp;&amp;amp; return
----
2032:	local fid=$(make_large_for_progress $f)
2033:	[ $? != 0 ] &amp;amp;&amp;amp; skip &quot;not enough free space&quot; &amp;amp;&amp;amp; return
----
2071:	local fid=$(make_large_for_progress $f)
2072:	[ $? != 0 ] &amp;amp;&amp;amp; skip &quot;not enough free space&quot; &amp;amp;&amp;amp; return
----
2092:	local fid=$(make_large_for_progress $f)
2093:	[ $? != 0 ] &amp;amp;&amp;amp; skip &quot;not enough free space&quot; &amp;amp;&amp;amp; return
----
2272:	local fid=$(make_large_for_progress $f)
2273:	[ $? != 0 ] &amp;amp;&amp;amp; skip &quot;not enough free space&quot; &amp;amp;&amp;amp; return
----
2295:	local fid=$(make_large_for_progress_aligned $f)
2296:	[ $? != 0 ] &amp;amp;&amp;amp; skip &quot;not enough free space&quot; &amp;amp;&amp;amp; return
----
2318:	local fid=$(make_large_for_progress $f)
2319:	[ $? != 0 ] &amp;amp;&amp;amp; skip &quot;not enough free space&quot; &amp;amp;&amp;amp; return
----
2384:	local fid=$(make_large_for_progress $f)
2385:	[ $? != 0 ] &amp;amp;&amp;amp; skip &quot;not enough free space&quot; &amp;amp;&amp;amp; return
----
2419:	local fid=$(make_large_for_progress $f)
2420:	[ $? != 0 ] &amp;amp;&amp;amp; skip &quot;not enough free space&quot; &amp;amp;&amp;amp; return
----
2457:	local fid=$(make_large_for_progress $f)
2458:	[ $? != 0 ] &amp;amp;&amp;amp; skip &quot;not enough free space&quot; &amp;amp;&amp;amp; return
----
2652:	local fid=$(make_large_for_progress $f)
2653:	[ $? != 0 ] &amp;amp;&amp;amp; skip &quot;not enough free space&quot; &amp;amp;&amp;amp; return
----
2775:	local fid=$(make_large_for_progress $f)
2776:	[ $? != 0 ] &amp;amp;&amp;amp; skip &quot;not enough free space&quot; &amp;amp;&amp;amp; return
----
2883:	local fid=$(make_large_for_progress $f)
2884:	[ $? != 0 ] &amp;amp;&amp;amp; skip &quot;not enough free space&quot; &amp;amp;&amp;amp; return
----
3160:	local fid=$(make_large_for_progress $f)
3161:	[ $? != 0 ] &amp;amp;&amp;amp; skip &quot;not enough free space&quot; &amp;amp;&amp;amp; return
----
3473:	local fid=$(make_large_for_cancel $f)
3474:	[ $? != 0 ] &amp;amp;&amp;amp; skip &quot;not enough free space&quot; &amp;amp;&amp;amp; return
----
3516:	local fid=$(make_large_for_progress $f)
3517:	[ $? != 0 ] &amp;amp;&amp;amp; skip &quot;not enough free space&quot; &amp;amp;&amp;amp; return
----
3563:	local fid=$(make_large_for_cancel $f)
3564:	[ $? != 0 ] &amp;amp;&amp;amp; skip &quot;not enough free space&quot; &amp;amp;&amp;amp; return
----
3671:	local fid=$(make_large_for_progress $f)
3672:	[ $? != 0 ] &amp;amp;&amp;amp; skip &quot;not enough free space&quot; &amp;amp;&amp;amp; return
----
3732:	local fid=$(make_large_for_progress $f)
3733:	[ $? != 0 ] &amp;amp;&amp;amp; skip &quot;not enough free space&quot; &amp;amp;&amp;amp; return
----
3936:	local fid=$(make_large_for_cancel $f)
3937:	[ $? != 0 ] &amp;amp;&amp;amp; skip &quot;not enough free space&quot; &amp;amp;&amp;amp; return
----
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="102561" author="gerrit" created="Mon, 5 Jan 2015 18:59:08 +0000"  >&lt;p&gt;Oleg Drokin (oleg.drokin@intel.com) merged in patch &lt;a href=&quot;http://review.whamcloud.com/13159/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/13159/&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-6056&quot; title=&quot;sanity-hsm uses bash&amp;#39;s local built-in incorrectly&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-6056&quot;&gt;&lt;del&gt;LU-6056&lt;/del&gt;&lt;/a&gt; tests: fix -hsm wrong usage of bash&apos;s local built-in&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: &lt;br/&gt;
Commit: 37145b39ecc2bd78e669f962ec6cfe7cebb06c5c&lt;/p&gt;</comment>
                            <comment id="103146" author="bfaccini" created="Sat, 10 Jan 2015 22:53:48 +0000"  >&lt;p&gt;Oops, just discovered that my change title had a typo, missing the &quot;sanity&quot; pattern in front of &quot;-hsm&quot; ...&lt;br/&gt;
John, do you agree that we can close this ticket now?&lt;/p&gt;</comment>
                            <comment id="103180" author="jhammond" created="Mon, 12 Jan 2015 13:56:16 +0000"  >&lt;p&gt;&amp;gt;  John, do you agree that we can close this ticket now?&lt;/p&gt;

&lt;p&gt;Yes.&lt;/p&gt;</comment>
                            <comment id="103764" author="jlevi" created="Fri, 16 Jan 2015 18:29:21 +0000"  >&lt;p&gt;Patch landed to Master.&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|hzx2wf:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10090" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>16868</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>