<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>10644</bug_id>
          
          <creation_ts>2016-11-11 11:11:34 +0000</creation_ts>
          <short_desc>Libnss uses deprecated function readdir_r()</short_desc>
          <delta_ts>2017-06-29 15:45:25 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>connectivity</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.1.3</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Zeeshan Ali">zeeshan.ali</reporter>
          <assigned_to name="Jussi Kukkonen">jku</assigned_to>
          <cc>bugzilla.ga</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>ross.burton</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>68235</commentid>
    <comment_count>0</comment_count>
    <who name="Zeeshan Ali">zeeshan.ali</who>
    <bug_when>2016-11-11 11:11:34 +0000</bug_when>
    <thetext>libnss in krogoth branch is version 3.21 and it fails to build against glibc 2.24 if warnings are treated as errors, since it uses the deprecated readdir_r. Suggest either patching nss on krogoth or updating it to &gt;= 3.24.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68236</commentid>
    <comment_count>1</comment_count>
    <who name="Zeeshan Ali">zeeshan.ali</who>
    <bug_when>2016-11-11 11:12:29 +0000</bug_when>
    <thetext>Downstream bug: https://at.projects.genivi.org/jira/browse/GDP-442</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68237</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-11-11 11:13:44 +0000</bug_when>
    <thetext>Are warnings treated as errors by default?  There&apos;s a reason we do our best to stop any recipe that does this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68238</commentid>
    <comment_count>3</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-11-11 11:15:37 +0000</bug_when>
    <thetext>Oh I see, genivi adds -Werror flags back and then is surprised when stuff stops working.

Looks like a simple fix Zeeshan, and you have a test environment.  Can you send a patch?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68239</commentid>
    <comment_count>4</comment_count>
    <who name="Jussi Kukkonen">jku</who>
    <bug_when>2016-11-11 11:28:30 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; Are warnings treated as errors by default?  There&apos;s a reason we do our best
&gt; to stop any recipe that does this.

&quot;-Werror=deprecated-declarations&quot; specifically seems like a bad idea. I don&apos;t object to fixing specific cases depending on the situation but the idea that we would make a promise to never use deprecated APIs in the build is not realistic.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68241</commentid>
    <comment_count>5</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-11-11 11:33:39 +0000</bug_when>
    <thetext>Absolutely, out of all the warnings to make critical that is one I wouldn&apos;t have picked...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68242</commentid>
    <comment_count>6</comment_count>
    <who name="Gunnar A / gunnarx">bugzilla.ga</who>
    <bug_when>2016-11-11 11:48:10 +0000</bug_when>
    <thetext>&gt; Oh I see, genivi adds -Werror flags back and then is surprised when stuff stops working.

I see nothing in the bug report that indicates that anyone is &quot;surprised&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68243</commentid>
    <comment_count>7</comment_count>
    <who name="Gunnar A / gunnarx">bugzilla.ga</who>
    <bug_when>2016-11-11 11:53:44 +0000</bug_when>
    <thetext>&gt; I don&apos;t object to fixing specific cases depending on the situation

That&apos;s all anyone can ask for - that you (we, together) evaluate this case.  The deprecation in glibc seems to be due to the implementation of readlink_r being buggy and not thread safe.  Some references in the downstream bug Zeeshan linked to as well as which NSS versions have it fixed.

&gt;the idea that we would make a promise to never use deprecated APIs in the build is not realistic.

Agreed and I don&apos;t think anyone is asking for that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68244</commentid>
    <comment_count>8</comment_count>
    <who name="Zeeshan Ali">zeeshan.ali</who>
    <bug_when>2016-11-11 12:05:47 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; Oh I see, genivi adds -Werror flags back and then is surprised when stuff
&gt; stops working.
&gt; 
&gt; Looks like a simple fix Zeeshan, and you have a test environment.  Can you
&gt; send a patch?

Yeah, I&apos;m on it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68245</commentid>
    <comment_count>9</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-11-11 12:08:19 +0000</bug_when>
    <thetext>Patch policy says that fixes go into master and are then backported, so can you verify what releases the upstream fix is integrated into as well please.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68246</commentid>
    <comment_count>10</comment_count>
    <who name="Zeeshan Ali">zeeshan.ali</who>
    <bug_when>2016-11-11 12:10:33 +0000</bug_when>
    <thetext>(In reply to comment #9)
&gt; Patch policy says that fixes go into master and are then backported, so can
&gt; you verify what releases the upstream fix is integrated into as well please.

IIRC neither master nor morty needs a fix since they use nss 3.24.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68247</commentid>
    <comment_count>11</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2016-11-11 12:11:27 +0000</bug_when>
    <thetext>Great, please mention that in the patch to krogoth.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68248</commentid>
    <comment_count>12</comment_count>
    <who name="Jussi Kukkonen">jku</who>
    <bug_when>2016-11-11 12:17:55 +0000</bug_when>
    <thetext>Thanks zeenix.

(In reply to comment #7)
&gt; The deprecation in glibc seems to be due to the implementation of readlink_r
&gt; being buggy and not thread safe.

I think there&apos;s a mistake here though (in addition to the /readdir_r/readlink_r/ typo): readdir() itself is _not_ thread safe by spec. 

You may be right about the bugs though.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68250</commentid>
    <comment_count>13</comment_count>
    <who name="Zeeshan Ali">zeeshan.ali</who>
    <bug_when>2016-11-11 13:33:37 +0000</bug_when>
    <thetext>Turns out that Werror is actually being set by the nss package itself for GCC versions &gt;= 4.8:

coreconf/Werror.mk:

  ifndef NSS_ENABLE_WERROR
    ifeq ($(OS_TARGET),Android)
      # Android lollipop generates the following warning:
      # error: call to &apos;sprintf&apos; declared with attribute warning:
      #   sprintf is often misused; please use snprintf [-Werror]
      # So, just suppress -Werror entirely on Android
      NSS_ENABLE_WERROR = 0
      $(warning OS_TARGET is Android, disabling -Werror)
    else
      ifeq ($(CC_NAME),clang)
        # Clang reports its version as an older gcc, but it&apos;s OK
        NSS_ENABLE_WERROR = 1
      else
        CC_VERSION := $(subst ., ,$(shell $(CC) -dumpversion))
        ifneq (,$(filter 4.8 4.9,$(word 1,$(CC_VERSION)).$(word 2,$(CC_VERSION))))
          NSS_ENABLE_WERROR = 1
        endif
        ifeq (,$(filter 0 1 2 3 4,$(word 1,$(CC_VERSION))))
          NSS_ENABLE_WERROR = 1
        endif
        ifndef NSS_ENABLE_WERROR
          $(warning Unable to find gcc 4.8 or greater, disabling -Werror)
          NSS_ENABLE_WERROR = 0
        endif
      endif                                                                                                                                 
    endif
  endif #ndef NSS_ENABLE_WERROR</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68252</commentid>
    <comment_count>14</comment_count>
    <who name="Zeeshan Ali">zeeshan.ali</who>
    <bug_when>2016-11-11 14:27:31 +0000</bug_when>
    <thetext>Patch sent to list.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>68893</commentid>
    <comment_count>15</comment_count>
    <who name="Jussi Kukkonen">jku</who>
    <bug_when>2016-12-07 09:59:50 +0000</bug_when>
    <thetext>Commit is in akuster/krogoth-next.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>74647</commentid>
    <comment_count>16</comment_count>
    <who name="Jussi Kukkonen">jku</who>
    <bug_when>2017-06-29 15:45:25 +0000</bug_when>
    <thetext>Commit is in krogoth branch (probably has been for some time), closing this.

commit cef5f86f43415ce8ca720d62c3d3bb1cb8fadb74
Author: Zeeshan Ali &lt;zeeshanak@gnome.org&gt;
Date:   Mon Nov 14 10:40:54 2016 +0100

    nss: Disable warning on deprecated API usage
    
    nss itself enables Werror if gcc is version 4.8 of greater, which fails
    the build against new glibc (2.24) because of use of readdir_r(), which
    is now deprecated. Let&apos;s just disable warnings on deprecated API usage.
    
    https://bugzilla.yoctoproject.org/show_bug.cgi?id=10644
    
    (From OE-Core rev: 6df5997bc0a7f7af73f625b172f99964cfed9f6e)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>