<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:20:20 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>[CDRIVER-4233] error: implicit declaration of function &apos;arc4random_buf&apos; is invalid in C99</title>
                <link>https://jira.mongodb.org/browse/CDRIVER-4233</link>
                <project id="10030" key="CDRIVER">C Driver</project>
                    <description>&lt;p&gt;I can&apos;t build libbson from mongo-c-driver 1.20.0 on macOS Catalina 10.15.7 with Apple clang version 12.0.0 (clang-1200.0.32.29) from&#160;Xcode 12.4. The error is:&lt;/p&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;src/libbson/src/bson/bson-context.c:234:4: error: implicit declaration of function &apos;arc4random_buf&apos; is invalid in C99 [-Werror,-Wimplicit-function-declaration]&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; arc4random_buf (&amp;amp;result, sizeof (result));&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; ^&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; 1 error generated.&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;src/libbson/src/bson/bson-string.c:554:4: error: implicitly declaring library function &apos;strlcpy&apos; with type &apos;unsigned long (char *, const char *, unsigned long)&apos; [-Werror,-Wimplicit-function-declaration]&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; strlcpy (dst, src, size);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; ^&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;src/libbson/src/bson/bson-string.c:554:4: note: include the header &amp;lt;string.h&amp;gt; or explicitly provide a declaration for &apos;strlcpy&apos;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;1 error generated.&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;
&lt;p&gt;&lt;tt&gt;arc4random_buf&lt;/tt&gt; is only defined in stdlib.h if&#160;&lt;tt&gt;!defined(_ANSI_SOURCE) &amp;amp;&amp;amp; (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;Defining&#160;&lt;tt&gt;_DARWIN_C_SOURCE&lt;/tt&gt; works around the problem but I don&apos;t know if that&apos;s the best solution.&lt;/p&gt;</description>
                <environment></environment>
        <key id="1933738">CDRIVER-4233</key>
            <summary>error: implicit declaration of function &apos;arc4random_buf&apos; is invalid in C99</summary>
                <type id="1" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14703&amp;avatarType=issuetype">Bug</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="13201">Fixed</resolution>
                                        <assignee username="kevin.albertson@mongodb.com">Kevin Albertson</assignee>
                                    <reporter username="ryandesign">Ryan Schmidt</reporter>
                        <labels>
                    </labels>
                <created>Thu, 25 Nov 2021 16:36:48 +0000</created>
                <updated>Sat, 28 Oct 2023 11:28:16 +0000</updated>
                            <resolved>Mon, 13 Dec 2021 21:24:29 +0000</resolved>
                                                    <fixVersion>1.20.1</fixVersion>
                                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="4245311" author="xgen-internal-githook" created="Mon, 13 Dec 2021 21:24:18 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Kevin Albertson&apos;, &apos;email&apos;: &apos;kevin.albertson@mongodb.com&apos;, &apos;username&apos;: &apos;kevinAlbs&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-4233&quot; title=&quot;error: implicit declaration of function &amp;#39;arc4random_buf&amp;#39; is invalid in C99&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-4233&quot;&gt;&lt;del&gt;CDRIVER-4233&lt;/del&gt;&lt;/a&gt; fix implicit decl of arc4random and strlcpy on macOS (#910)&lt;br/&gt;
Branch: r1.20&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/a07dfec5142a90f256eaa746339cffe7a0abde4f&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/a07dfec5142a90f256eaa746339cffe7a0abde4f&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4245300" author="xgen-internal-githook" created="Mon, 13 Dec 2021 21:22:58 +0000"  >&lt;p&gt;Author:&lt;/p&gt;
{&apos;name&apos;: &apos;Kevin Albertson&apos;, &apos;email&apos;: &apos;kevin.albertson@mongodb.com&apos;, &apos;username&apos;: &apos;kevinAlbs&apos;}
&lt;p&gt;Message: &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-4233&quot; title=&quot;error: implicit declaration of function &amp;#39;arc4random_buf&amp;#39; is invalid in C99&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-4233&quot;&gt;&lt;del&gt;CDRIVER-4233&lt;/del&gt;&lt;/a&gt; fix implicit decl of arc4random and strlcpy on macOS (#910)&lt;br/&gt;
Branch: master&lt;br/&gt;
&lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/commit/1523c42b70e4cbb36c88c912c80ba9e38ebab8f9&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-c-driver/commit/1523c42b70e4cbb36c88c912c80ba9e38ebab8f9&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="4242325" author="kevin.albertson" created="Sat, 11 Dec 2021 17:53:43 +0000"  >&lt;p&gt;Thank you for the report &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=ryandesign&quot; class=&quot;user-hover&quot; rel=&quot;ryandesign&quot;&gt;ryandesign&lt;/a&gt;. I am able to reproduce this on my macOS 11.6.1 with Apple clang version 13.0.0 (clang-1300.0.29.3).&lt;/p&gt;

&lt;p&gt;I believe this is a regression introduced in 1.20.0 as part of &lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-4227&quot; title=&quot;Use a shared_mutex when locking in shared_ptr atomic operations &quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-4227&quot;&gt;&lt;del&gt;CDRIVER-4227&lt;/del&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/browse/CDRIVER-4227&quot; title=&quot;Use a shared_mutex when locking in shared_ptr atomic operations &quot; class=&quot;issue-link&quot; data-issue-key=&quot;CDRIVER-4227&quot;&gt;&lt;del&gt;CDRIVER-4227&lt;/del&gt;&lt;/a&gt; added &lt;tt&gt;-D_XOPEN_SOURCE=700&lt;/tt&gt; libbson in &lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/pull/895/files#diff-71a4c7cf57df62b3b3d8bb547bcf79c5fafb5accb4a6608d696ccdf43e17ad6aR37&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;src/libbson/CMakeLists.txt here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/apple-oss-distributions/xnu/blob/776661b72c2db9861865df68d309f6f35faccff4/bsd/sys/cdefs.h#L824-L836&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;cdefs.h&lt;/a&gt; on macOS defines &lt;tt&gt;_POSIX_C_SOURCE 200809L&lt;/tt&gt; if &lt;tt&gt;-D_XOPEN_SOURCE=700&lt;/tt&gt; is present.&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;_POSIX_C_SOURCE 200809L&lt;/tt&gt; causes &lt;tt&gt;arc4random&lt;/tt&gt; to be removed from &lt;a href=&quot;https://github.com/apple-oss-distributions/Libc/blob/Libc-1439.141.1/include/stdlib.h#L341-L349&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;stdlib.h here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;POSIX_C_SOURCE 200809L&lt;/tt&gt; causes &lt;tt&gt;__DARWIN_C_LEVEL&lt;/tt&gt; to be defined as &lt;tt&gt;POSIX_C_SOURCE&lt;/tt&gt; in &lt;a href=&quot;https://github.com/apple-oss-distributions/xnu/blob/776661b72c2db9861865df68d309f6f35faccff4/bsd/sys/cdefs.h#L866-L867&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;cdefs.h here&lt;/a&gt;. libbson&apos;s &lt;a href=&quot;https://github.com/mongodb/mongo-c-driver/blob/0756cbb4470a797be7d70841a7c922643dd30d55/src/libbson/CMakeLists.txt#L96&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;CHECK_SYMBOL_EXISTS&lt;/a&gt; for &lt;tt&gt;strlcpy&lt;/tt&gt; do not apply &lt;tt&gt;-D_XOPEN_SOURCE=700&lt;/tt&gt;. cmake defines &lt;tt&gt;BSON_HAVE_STRLCPY&lt;/tt&gt; thinking that strlcpy is defined, but compilation fails.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10520">
                    <name>Problem/Incident</name>
                                                                <inwardlinks description="is caused by">
                                        <issuelink>
            <issuekey id="1924357">CDRIVER-4227</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="1933780">CDRIVER-4234</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="1954055">PHPC-2019</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hzv23r:</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>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>