From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f194.google.com (mail-pf0-f194.google.com [209.85.192.194]) by mail.openembedded.org (Postfix) with ESMTP id 3404371B8A for ; Tue, 1 Nov 2016 14:46:21 +0000 (UTC) Received: by mail-pf0-f194.google.com with SMTP id i88so528889pfk.2 for ; Tue, 01 Nov 2016 07:46:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=PqxPjoCAEnhi/GFBVgLVT5+Y1STLAQOSrE1bWy7ahlk=; b=Af83ALDTCZ3SLLPrdABDLKtMhY1CUYespz6tNjoa7pGTlJ7lc+lVnyR2uXfSNdiRyn RqiDeMN/WBv6GQysLxmKdpoO/2qweQh1YQWwniZ9ysLIsh8mSc7YWog1Ou1PejscmRQq jwiBiG6L/QJXLecOhBuGHBYyWEH5M5BNvrtjL0/Gg2itJWi8CoR/MxUEzpRIZVC4W+zw xi1S5cHYeb+HkpQ7LgdOZ5xwG2HeexccER58SNtVOE5KKOGxpu+9fywnmy31G5atyIcq mqP/e60GEwtBxbDp2Wb/00f5heAcbn8gdtDgMfT9gIpNi/Kv++/CHUget/SqvxZQAKfK 7VfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=PqxPjoCAEnhi/GFBVgLVT5+Y1STLAQOSrE1bWy7ahlk=; b=eI+ojJcV+BTxGto1Y6jjRPU3qwvQVDGkagpkP3WtWVSAFxEal7U6bwXCVYQ1apO444 UIdGEauW+HpqTmScPhxmtILznSfPM2bWqCh9eubew4taWoAYCRiuImZZp7Z92pl3DuOw B/Oxr4+dpRbOPDDFOSDBdbVX37oMCLWCVaR1gRp1dSMZsmFGo0wOz7S8UAotyli+xJE+ tfpIEURovUtgDCYvoGqrtp2dBxWDi86Tjzs24RHvB4WH44sO1Tui3fzTDzFiBf8Oa4qw YVpSRCUMqnpo6nSCN0nSszOwM3oiE2GKVQej1OnxkShk8Qn1hWdbY5hLAqJS1RSuPEa6 qzYg== X-Gm-Message-State: ABUngveC8WJB1BALHcU6A9ONezn5e+J6JD9Tu9CoLMEAgFLQdGWjGtrC1XxspIlucaVOWg== X-Received: by 10.98.135.13 with SMTP id i13mr33533119pfe.138.1478011582866; Tue, 01 Nov 2016 07:46:22 -0700 (PDT) Received: from ?IPv6:2601:202:4001:9ea0:bddd:dc37:37:9aa? ([2601:202:4001:9ea0:bddd:dc37:37:9aa]) by smtp.gmail.com with ESMTPSA id yx8sm42872315pac.29.2016.11.01.07.46.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Nov 2016 07:46:22 -0700 (PDT) To: Enrico Jorns , openembedded-core@lists.openembedded.org References: <20161028060629.32357-1-ejo@pengutronix.de> From: akuster808 Message-ID: <4b9e1364-53da-c237-276e-e2e011e13505@gmail.com> Date: Tue, 1 Nov 2016 07:46:21 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161028060629.32357-1-ejo@pengutronix.de> Subject: Re: [PATCH][krogoth] nss: fix compilation with glibc-2.24 X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Nov 2016 14:46:24 -0000 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Enrico, On 10/27/2016 11:06 PM, Enrico Jorns wrote: > `readdir_r` is deprecated as of glibc-2.24 and leads to a compilation > error: > > | In file included from sysrand.c:16:0: > | unix_rand.c: In function 'ReadOneFile': > | unix_rand.c:1090:6: error: 'readdir_r' is deprecated [-Werror=deprecated-declarations] > | error = readdir_r(fd, &entry_dir, &result); > | ^~~~~ > | In file included from unix_rand.c:1032:0, > | from sysrand.c:16: > | /usr/include/dirent.h:183:12: note: declared here > | extern int readdir_r (DIR *__restrict __dirp, > | ^~~~~~~~~ > | cc1: all warnings being treated as errors > > The issue is reported in nss bug tracker > (https://bugzilla.mozilla.org/show_bug.cgi?id=1254334) and fixed in nss > mainline. > The fixing patch is extracted from the nss source code repository. > > Signed-off-by: Enrico Jorns > --- > .../nss/nss/use-readdir-instead-of-readdir_r.patch | 95 ++++++++++++++++++++++ > meta/recipes-support/nss/nss_3.21.bb | 1 + > 2 files changed, 96 insertions(+) > create mode 100644 meta/recipes-support/nss/nss/use-readdir-instead-of-readdir_r.patch > > diff --git a/meta/recipes-support/nss/nss/use-readdir-instead-of-readdir_r.patch b/meta/recipes-support/nss/nss/use-readdir-instead-of-readdir_r.patch > new file mode 100644 > index 0000000..00f671f > --- /dev/null > +++ b/meta/recipes-support/nss/nss/use-readdir-instead-of-readdir_r.patch > @@ -0,0 +1,95 @@ > +# HG changeset patch > +# User Martin Thomson > +# Date 1457600884 -39600 > +# Thu Mar 10 20:08:04 2016 +1100 > +# Node ID 7309fcbce2eceae1e4e3c687348e540905ae286a > +# Parent e7b6fca4f01427cafb4328f6e279af62290a2f34 > +Bug 1254334 - Use readdir instead of readdir_r, r=emaldona, sr=rrelyea The patch is missing the appropriate patch formating. I am expecting "Upstream-Status: blah" etc http://www.openembedded.org/wiki/Commit_Patch_Message_Guidelines - Armin > + > +diff -r e7b6fca4f014 -r 7309fcbce2ec lib/freebl/unix_rand.c > +--- a/nss/lib/freebl/unix_rand.c Wed Apr 20 15:22:46 2016 +0200 > ++++ b/nss/lib/freebl/unix_rand.c Thu Mar 10 20:08:04 2016 +1100 > +@@ -1054,26 +1054,16 @@ > + * > + * return 1 if it's time to reset the fileToRead (no more files to read). > + */ > +-int ReadOneFile(int fileToRead) > ++static int > ++ReadOneFile(int fileToRead) > + { > + char *dir = "/etc"; > + DIR *fd = opendir(dir); > + int resetCount = 0; > +-#ifdef SOLARIS > +- /* grumble, Solaris does not define struct dirent to be the full length */ > +- typedef union { > +- unsigned char space[sizeof(struct dirent) + MAXNAMELEN]; > +- struct dirent dir; > +- } dirent_hack; > +- dirent_hack entry, firstEntry; > +- > +-#define entry_dir entry.dir > +-#else > +- struct dirent entry, firstEntry; > +-#define entry_dir entry > +-#endif > +- > +- int i, error = -1; > ++ struct dirent *entry; > ++ char firstName[NAME_MAX + 1]; > ++ const char *name = NULL; > ++ int i; > + > + if (fd == NULL) { > + dir = PR_GetEnvSecure("HOME"); > +@@ -1085,33 +1075,34 @@ > + return 1; > + } > + > ++ firstName[0] = '\0'; > + for (i=0; i <= fileToRead; i++) { > +- struct dirent *result = NULL; > + do { > +- error = readdir_r(fd, &entry_dir, &result); > +- } while (error == 0 && result != NULL && > +- !ReadFileOK(dir,&result->d_name[0])); > +- if (error != 0 || result == NULL) { > ++ /* readdir() isn't guaranteed to be thread safe on every platform; > ++ * this code assumes the same directory isn't read concurrently. > ++ * This usage is confirmed safe on Linux, see bug 1254334. */ > ++ entry = readdir(fd); > ++ } while (entry != NULL && !ReadFileOK(dir, &entry->d_name[0])); > ++ if (entry == NULL) { > + resetCount = 1; /* read to the end, start again at the beginning */ > +- if (i != 0) { > ++ if (firstName[0]) { > + /* ran out of entries in the directory, use the first one */ > +- entry = firstEntry; > +- error = 0; > +- break; > ++ name = firstName; > + } > +- /* if i== 0, there were no readable entries in the directory */ > + break; > + } > +- if (i==0) { > +- /* save the first entry in case we run out of entries */ > +- firstEntry = entry; > ++ name = entry->d_name; > ++ if (i == 0) { > ++ /* copy the name of the first in case we run out of entries */ > ++ PORT_Assert(PORT_Strlen(name) <= NAME_MAX); > ++ PORT_Strncpy(firstName, name, NAME_MAX); > ++ firstName[NAME_MAX] = '\0'; > + } > + } > + > +- if (error == 0) { > ++ if (name) { > + char filename[PATH_MAX]; > +- int count = snprintf(filename, sizeof filename, > +- "%s/%s",dir, &entry_dir.d_name[0]); > ++ int count = snprintf(filename, sizeof(filename), "%s/%s",dir, name); > + if (count >= 1) { > + ReadSingleFile(filename); > + } > diff --git a/meta/recipes-support/nss/nss_3.21.bb b/meta/recipes-support/nss/nss_3.21.bb > index 05d81c2..39b0994 100644 > --- a/meta/recipes-support/nss/nss_3.21.bb > +++ b/meta/recipes-support/nss/nss_3.21.bb > @@ -21,6 +21,7 @@ SRC_URI = "\ > file://nss-fix-incorrect-shebang-of-perl.patch \ > file://nss-fix-nsinstall-build.patch \ > file://0001-Fix-build-failure-on-opensuse-13.1.patch \ > + file://use-readdir-instead-of-readdir_r.patch \ > file://nss-gcc6-fix.patch \ > file://nss.pc.in \ > file://signlibs.sh \