<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 06:13:55 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>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[SERVER-69612] Audit the codebase for signed use of char types</title>
                <link>https://jira.mongodb.org/browse/SERVER-69612</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;Signedness of &quot;char&quot; is platform-specific, e.g. it is signed on x86-linux, it is typically unsigned on ARM. For portability we should stick to using an unsigned type.&lt;/p&gt;</description>
                <environment></environment>
        <key id="2134757">SERVER-69612</key>
            <summary>Audit the codebase for signed use of char types</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="13202">Works as Designed</resolution>
                                        <assignee username="jordi.olivares-provencio@mongodb.com">Jordi Olivares Provencio</assignee>
                                    <reporter username="josef.ahmad@mongodb.com">Josef Ahmad</reporter>
                        <labels>
                    </labels>
                <created>Tue, 13 Sep 2022 07:20:56 +0000</created>
                <updated>Fri, 27 Oct 2023 13:51:53 +0000</updated>
                            <resolved>Thu, 15 Sep 2022 13:43:08 +0000</resolved>
                                                                                        <votes>0</votes>
                                    <watches>11</watches>
                                                                                                                <comments>
                            <comment id="4830290" author="JIRAUSER1264163" created="Thu, 15 Sep 2022 13:42:44 +0000"  >&lt;p&gt;In cases where char is used to contain a number it is always below 128, so uses of it are correct. The other uses for a char are to treat it as a byte (uses of which could be replaced by &lt;tt&gt;std::byte&lt;/tt&gt;).&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=geert.bosch%40mongodb.com&quot; class=&quot;user-hover&quot; rel=&quot;geert.bosch@mongodb.com&quot;&gt;geert.bosch@mongodb.com&lt;/a&gt; I haven&apos;t found a problem other than potential confusion by casting the char as a byte so I&apos;ll close the ticket.&lt;/p&gt;

&lt;p&gt;I&apos;ve opened &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-69729&quot; title=&quot;Enable clang-tidy check for signed char misuse&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-69729&quot;&gt;&lt;del&gt;SERVER-69729&lt;/del&gt;&lt;/a&gt; and &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-69728&quot; title=&quot;Remove BufBuilder::appendChar in favour of BufBuilder::appendByte&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-69728&quot;&gt;&lt;del&gt;SERVER-69728&lt;/del&gt;&lt;/a&gt; to help avoid potential errors in the future.&lt;/p&gt;</comment>
                            <comment id="4829848" author="JIRAUSER1264163" created="Thu, 15 Sep 2022 11:08:53 +0000"  >&lt;p&gt;Looking at other branches with the same patterns leads to the same conclusion: Only the Enum handling worries me, but it seems to be correctly used as they are interpreted as a single raw byte when used.&lt;/p&gt;

&lt;p&gt;Something that could be improved is the single byte handling of the &lt;a href=&quot;https://github.com/mongodb/mongo/blob/1b942407096c139fdb69b1d61cfe20e4e5c0f1eb/src/mongo/bson/util/builder.h#L340&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;BSON BufBuilder&lt;/a&gt;. There&apos;s various methods used for handling a char but conceptually we&apos;re using them to append a single byte. Refactoring the code so that the 3 char methods are replaced by a method called &lt;tt&gt;appendByte(std::byte)&lt;/tt&gt; would help clarify the intent.&lt;/p&gt;</comment>
                            <comment id="4825477" author="JIRAUSER1264163" created="Wed, 14 Sep 2022 12:50:25 +0000"  >&lt;p&gt;Searching for the following:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;static_cast&amp;lt;char&amp;gt;&lt;/li&gt;
	&lt;li&gt;(char) casting&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Points largely to the BSONType and BSONBinData enum handling. In particular two key values can be affected by the signedness of char: &lt;tt&gt;BSONType::MinKey&lt;/tt&gt; and &lt;tt&gt;BSONBinData::bdtCustom&lt;/tt&gt; as they are -1 and 128 respectively.&lt;/p&gt;

&lt;p&gt;The latter gets used in GeoHash &lt;a href=&quot;https://github.com/mongodb/mongo/blob/40e9c7198a7f0742a2347232166695aae7312286/src/mongo/db/geo/hash.cpp#L517&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;https://github.com/mongodb/mongo/blob/40e9c7198a7f0742a2347232166695aae7312286/src/mongo/db/geo/hash.cpp#L533&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;</comment>
                            <comment id="4822122" author="gregory.noma" created="Tue, 13 Sep 2022 13:23:50 +0000"  >&lt;p&gt;&lt;a href=&quot;https://en.cppreference.com/w/cpp/types/byte&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;&lt;tt&gt;std::byte&lt;/tt&gt;&lt;/a&gt; might be useful&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="2135383">WT-9857</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="2139365">SERVER-69784</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="2137707">SERVER-69728</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="2137715">SERVER-69729</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18555" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname># of Sprints</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1.0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Tue, 13 Sep 2022 13:23:50 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        1 year, 20 weeks, 6 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>luke.bonanomi@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            1 year, 20 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>gregory.noma@mongodb.com</customfieldvalue>
            <customfieldvalue>jordi.olivares-provencio@mongodb.com</customfieldvalue>
            <customfieldvalue>josef.ahmad@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i19wlr:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|i0smo0:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="6330">Execution Team 2022-09-19</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|i19ir3:</customfieldvalue>

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