diff --git a/Suppress-Wcast-qual-warnings-in-bsearch.patch b/Suppress-Wcast-qual-warnings-in-bsearch.patch new file mode 100644 index 0000000000000000000000000000000000000000..3709051da9b3ac9a2919af8c2a0651c42cd47541 --- /dev/null +++ b/Suppress-Wcast-qual-warnings-in-bsearch.patch @@ -0,0 +1,47 @@ +From 80a009119ba2330768120476aaad63767b81d543 Mon Sep 17 00:00:00 2001 +From: Jonathan Wakely +Date: Wed, 19 May 2021 16:48:19 +0100 +Subject: [PATCH] Suppress -Wcast-qual warnings in bsearch + +The first cast to (void *) is redundant but should be (const void *) +anyway, because that's the type of the lvalue being assigned to. + +The second cast is necessary and intentionally not const-correct, so +tell the compiler not to warn about it. + +Reviewed-by: Florian Weimer +(cherry picked from commit a725ff1de965f4cc4f36a7e8ae795d40ca0350d7) +--- + bits/stdlib-bsearch.h | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/bits/stdlib-bsearch.h b/bits/stdlib-bsearch.h +index 4132dc6..d688ed2 100644 +--- a/bits/stdlib-bsearch.h ++++ b/bits/stdlib-bsearch.h +@@ -29,14 +29,21 @@ bsearch (const void *__key, const void *__base, size_t __nmemb, size_t __size, + while (__l < __u) + { + __idx = (__l + __u) / 2; +- __p = (void *) (((const char *) __base) + (__idx * __size)); ++ __p = (const void *) (((const char *) __base) + (__idx * __size)); + __comparison = (*__compar) (__key, __p); + if (__comparison < 0) + __u = __idx; + else if (__comparison > 0) + __l = __idx + 1; + else ++#if __GNUC_PREREQ(4, 6) ++# pragma GCC diagnostic push ++# pragma GCC diagnostic ignored "-Wcast-qual" ++#endif + return (void *) __p; ++#if __GNUC_PREREQ(4, 6) ++# pragma GCC diagnostic pop ++#endif + } + + return NULL; +-- +1.8.3.1 + diff --git a/glibc.spec b/glibc.spec index 555d7e2371d4a29edf02ab242fa09b56d0ea0e8c..4c23b0500b81089faf0627924ef5e1d3710682b9 100644 --- a/glibc.spec +++ b/glibc.spec @@ -65,7 +65,7 @@ ############################################################################## Name: glibc Version: 2.34 -Release: 24 +Release: 25 Summary: The GNU libc libraries License: %{all_license} URL: http://www.gnu.org/software/glibc/ @@ -132,6 +132,8 @@ Patch45: elf-Avoid-deadlock-between-pthread_create-and-ctors-.patch Patch46: ld.so-Replace-DL_RO_DYN_SECTION-with-dl_relocate_ld-.patch Patch47: ld.so-Initialize-bootstrap_map.l_ld_readonly-BZ-2834.patch Patch48: Avoid-warning-overriding-recipe-for-.-tst-ro-dynamic.patch +Patch49: posix-Fix-attribute-access-mode-on-getcwd-BZ-27476.patch +Patch50: Suppress-Wcast-qual-warnings-in-bsearch.patch #Patch9000: turn-REP_STOSB_THRESHOLD-from-2k-to-1M.patch Patch9001: delete-no-hard-link-to-avoid-all_language-package-to.patch @@ -1321,6 +1323,10 @@ fi %endif %changelog +* Mon Nov 15 2021 Qingqing Li - 2.34-25 +- fix attribute access mode on getcwd [BZ #27476] +- supress -Wcast-qual warnings in bsearch + * Mon Nov 15 2021 Qingqing Li - 2.34-24 - elf: fix ld.so crash while loading a DSO with a read-only dynamic section https://sourceware.org/bugzilla/show_bug.cgi?id=28340 diff --git a/posix-Fix-attribute-access-mode-on-getcwd-BZ-27476.patch b/posix-Fix-attribute-access-mode-on-getcwd-BZ-27476.patch new file mode 100644 index 0000000000000000000000000000000000000000..a9e8d26b9e20df41fd1c5b911c4a99ef4db0dde4 --- /dev/null +++ b/posix-Fix-attribute-access-mode-on-getcwd-BZ-27476.patch @@ -0,0 +1,50 @@ +From 433ec4f14a5753c7689c83c20c9972915c53c204 Mon Sep 17 00:00:00 2001 +From: Aurelien Jarno +Date: Fri, 10 Sep 2021 19:39:35 +0200 +Subject: [PATCH] posix: Fix attribute access mode on getcwd [BZ #27476] + +There is a GNU extension that allows to call getcwd(NULL, >0). It is +described in the documentation, but also directly in the unistd.h +header, just above the declaration. + +Therefore the attribute access mode added in commit 06febd8c6705 +is not correct. Drop it. +--- + posix/bits/unistd.h | 5 ++--- + posix/unistd.h | 3 +-- + 2 files changed, 3 insertions(+), 5 deletions(-) + +diff --git a/posix/bits/unistd.h b/posix/bits/unistd.h +index f083138..622adeb 100644 +--- a/posix/bits/unistd.h ++++ b/posix/bits/unistd.h +@@ -199,10 +199,9 @@ __NTH (readlinkat (int __fd, const char *__restrict __path, + #endif + + extern char *__getcwd_chk (char *__buf, size_t __size, size_t __buflen) +- __THROW __wur __attr_access ((__write_only__, 1, 2)); ++ __THROW __wur; + extern char *__REDIRECT_NTH (__getcwd_alias, +- (char *__buf, size_t __size), getcwd) +- __wur __attr_access ((__write_only__, 1, 2)); ++ (char *__buf, size_t __size), getcwd) __wur; + extern char *__REDIRECT_NTH (__getcwd_chk_warn, + (char *__buf, size_t __size, size_t __buflen), + __getcwd_chk) +diff --git a/posix/unistd.h b/posix/unistd.h +index 3dca657..8224c5f 100644 +--- a/posix/unistd.h ++++ b/posix/unistd.h +@@ -528,8 +528,7 @@ extern int fchdir (int __fd) __THROW __wur; + an array is allocated with `malloc'; the array is SIZE + bytes long, unless SIZE == 0, in which case it is as + big as necessary. */ +-extern char *getcwd (char *__buf, size_t __size) __THROW __wur +- __attr_access ((__write_only__, 1, 2)); ++extern char *getcwd (char *__buf, size_t __size) __THROW __wur; + + #ifdef __USE_GNU + /* Return a malloc'd string containing the current directory name. +-- +1.8.3.1 +