Re: totalorder*: Fix test failures on PA-RISC and MIPS CPUs

2023-10-16 Thread Adhemerval Zanella Netto
On 14/10/23 15:55, Bruno Haible wrote: > On Linux/mips (all 3 ABIs) and on Linux/hppa (configuring a testdir in such > a way that the configuration ignores the totalorder* functions provided by > glibc and instead uses the gnulib replacement instead: > gl_cv_func_totalorder_in_libm=no gl_cv_fu

Re: optimizing totalorder

2023-10-16 Thread Adhemerval Zanella Netto
On 15/10/23 11:59, Bruno Haible wrote: > With the new benchmark in place, I measured the run time of > - the glibc 2.35 implementation of totalorder, > - the gnulib implementation (picked by configuring with > gl_cv_func_totalorder_in_libm=no gl_cv_func_totalorder_no_libm=no \ >

Re: fnmatch: Overcome wchar_t limitations

2023-07-25 Thread Adhemerval Zanella Netto
On 24/07/23 21:46, Bruno Haible wrote: > This patch fixes the remaining problems of fnmatch() on Cygwin, > native Windows, and AIX in 32-bit mode. > > I think the code changes are in glibc style, because > - they use upper-case names for macros, > - the macro names are aligned to the type a

Re: AC_SYS_LARGEFILE_REQUIRED vs. AC_SYS_YEAR2038_REQUIRED on MSVC

2023-04-16 Thread Adhemerval Zanella
> On 16 Apr 2023, at 12:28, Bruno Haible wrote: > > I presented the test results: >> - hello-3: no gnulib, just AC_SYS_LARGEFILE_REQUIRED >> - hello-4: no gnulib, just AC_SYS_YEAR2038_REQUIRED >> - testdir3: a gnulib testdir for the modules largefile-required stat >> - testdir4: a gnulib

Re: doc: Clarify list of platforms for year2038 support

2023-04-12 Thread Adhemerval Zanella Netto
On 11/04/23 18:58, Paul Eggert wrote: > On 4/11/23 06:45, Adhemerval Zanella Netto wrote: > >> It makes difference on all ABIs with has originally 32 bit time_t support: >> i686, microblaze, arm, m68k, sh, csky, nios2, and hppa, powerpc32, sparc32, >> s390, and

Re: doc: Clarify list of platforms for year2038 support

2023-04-11 Thread Adhemerval Zanella Netto
On 11/04/23 02:33, Paul Eggert wrote: > Oh, I forgot to send comments that partly explain my recent changes in this > area. Here they are, belatedly: > > > On 2023-04-10 05:56, Bruno Haible wrote: > >> +@item >> +Linux/riscv32, > > says this platform used 6

Re: [PATCH 2/2] posix: Remove alloca usage for internal fnmatch implementation

2021-10-20 Thread Adhemerval Zanella
On 08/03/2021 09:59, Florian Weimer wrote: > * Adhemerval Zanella via Libc-alpha: > >> -else if (*p == L_('|')) >> +else if (*p == L_(')') || *p == L_('|')) >>{ >> if (level == 0) >>

Re: [PATCH 2/8] posix: Use char_array for internal glob dirname

2021-03-24 Thread Adhemerval Zanella
On 23/03/2021 13:08, Arjun Shankar wrote: > Hi Adhemerval, > >> This is the first patch of the set to remove alloca usage on glob >> implementation. Internal path to search for file might expand to a >> non static directory derived from pattern for some difference cases >> (GLOB_NOESCAPE, GNU

Re: [PATCH 07/10] regex: fix longstanding backref match bug

2021-02-09 Thread Adhemerval Zanella
Hi Paul, Trying to sync gnulib with glibc code, this patch trigger some regression on glibc testcases: FAIL: posix/tst-boost FAIL: posix/tst-pcre FAIL: posix/tst-rxspencer FAIL: posix/tst-rxspencer-no-utf8 $ grep -n "FAIL rm" posix/tst-boost.out 445:FAIL rm[1] 3..-1 != expected 2..3 448:FAIL rm[

[PATCH 2/2] posix: Remove alloca usage for internal fnmatch implementation

2021-02-02 Thread Adhemerval Zanella
This patch replaces the internal fnmatch pattern list generation to use a dynamic array. Checked on x86_64-linux-gnu. --- posix/fnmatch.c | 24 +- posix/fnmatch_loop.c | 190 +++ 2 files changed, 87 insertions(+), 127 deletions(-) diff --git a/po

[PATCH 1/2] posix: Falling back to non wide mode in case of encoding error [BZ #14185]

2021-02-02 Thread Adhemerval Zanella
Gnulib has added the proposed fix with aed23714d60 (done in 2005), but recently with a glibc merge with 67306f6 (done in 2020 with sync back) it has fallback to old semantic to return -1 on in case of failure. >From gnulib developer feedback it was an oversight. Although the full fix for BZ #1418

Re: [PATCH 1/5] posix: Sync regex code with gnulib

2021-01-20 Thread Adhemerval Zanella
fix, Adhemerval Zanella. > I assume you would fix this in other files too, for example I think a similar > patch is needed for posix/fnmatch.c. > > fnmatch.c:67:26: error: "__clang_major__" is not defined [-Werror=undef] > # if (__GNUC__ >

Re: [PATCH v3 6/6] stdlib: Add testcase fro BZ #26241

2021-01-20 Thread Adhemerval Zanella
On 20/01/2021 01:33, DJ Delorie wrote: > > Adhemerval Zanella via Libc-alpha writes: >> - tst-setcontext9 tst-bz20544 >> + tst-setcontext9 tst-bz20544 tst-canon-bz26341 > > New test, ok. > >> +LDLIBS-tst-canon-bz26341 =

Re: [PATCH 1/5] posix: Sync regex code with gnulib

2021-01-20 Thread Adhemerval Zanella
On 19/01/2021 23:55, Paul Eggert wrote: > On 1/19/21 7:43 AM, Bruno Haible wrote: >> Adhemerval Zanella wrote: >>> -# if (__GNUC__ >= 7) || (__clang_major__ >= 10) >>> +# if (__GNUC__ >= 7) || (defined __clang_major__ &&__clang_major__ >= 10) >

Re: [PATCH 1/5] posix: Sync regex code with gnulib

2021-01-19 Thread Adhemerval Zanella
On 19/01/2021 14:16, Florian Weimer wrote: > * Adhemerval Zanella: > >> On 19/01/2021 13:52, Florian Weimer wrote: >>> * Adhemerval Zanella via Libc-alpha: >>> >>>> Paul, this seemed to a common pattern scatter on multiple file in gnulib. >>&g

Re: [PATCH 1/5] posix: Sync regex code with gnulib

2021-01-19 Thread Adhemerval Zanella
On 19/01/2021 13:52, Florian Weimer wrote: > * Adhemerval Zanella via Libc-alpha: > >> Paul, this seemed to a common pattern scatter on multiple file in gnulib. >> Wouldn't be better to consolidate it on cdefs.h? > > gnulib shouldn't be using cdefs.h on glib

Re: [PATCH 1/5] posix: Sync regex code with gnulib

2021-01-19 Thread Adhemerval Zanella
; > [1] > commit c2a150d089fa096cb5f9e342da80fb30dc0d1953 > Author: Adhemerval Zanella > AuthorDate: Tue Dec 29 17:32:25 2020 -0300 > Commit: Adhemerval Zanella > CommitDate: Mon Jan 4 08:38:52 2021 -0300 > > posix: Sync regex code with gnulib > > It

Re: [PATCH 1/2] posix: User scratch_buffer on fnmatch

2021-01-14 Thread Adhemerval Zanella
On 13/01/2021 16:25, Paul Eggert wrote: > On 1/5/21 5:07 AM, Adhemerval Zanella wrote: >> It seems that gnulib has added the proposed fix with >> aed23714d60d91b2abc74be33635c32ddc5132b5 (done in 2005) and just recently >> with a glibc merge with 67306f600fe6a3bcf3fbb6d8b

Re: [PATCH 3/3] posix: Remove alloca definition from regex

2021-01-11 Thread Adhemerval Zanella
On 08/01/2021 22:20, Paul Eggert wrote: > This patch looks good for glibc, once the previous two regex patches are > done. I installed it into Gnulib by applying the attached, so that > regex_internal.h can stay in lock-step between Gnulib and glibc. Right, I will sync the regex code with gnu

Re: [PATCH 1/3] posix: Remove alloca usage on regex set_regs

2021-01-11 Thread Adhemerval Zanella
On 08/01/2021 17:14, Paul Eggert wrote: > On 1/6/21 10:17 AM, Adhemerval Zanella wrote: >> It replaces the regmatch_t with a dynarray list. > > regexec.c is shared with Gnulib, so some work needed to be done on the Gnulib > side for this patch since Gnulib didn't hav

Re: [PATCH 2/3] posix: Remove alloca usage on regex build_trtable

2021-01-11 Thread Adhemerval Zanella
On 08/01/2021 19:30, Paul Eggert wrote: > On 1/6/21 10:17 AM, Adhemerval Zanella wrote: >> __libc_use_alloca/alloca is replaced with malloc regardless. > > These allocations are so small that they should be put on the stack instead > of using malloc. I did that in Gnulib

Re: [PATCH 1/2] posix: Sync tempname with gnulib [BZ #26648]

2021-01-11 Thread Adhemerval Zanella
On 08/01/2021 22:58, Paul Eggert wrote: > On 1/4/21 9:03 AM, Adhemerval Zanella wrote: > >> -# define __lstat64(version, file, buf) lstat (file, buf) >> +# define __lxstat64(version, file, buf) lstat (file, buf) > > That change isn't quite right for the !_LIBC

Re: [PATCH 2/2] posix: Improve randomness on try_tempname_len

2021-01-11 Thread Adhemerval Zanella
On 08/01/2021 23:20, Paul Eggert wrote: > On 1/4/21 9:03 AM, Adhemerval Zanella wrote: >> For __GT_NOCREATE (mktemp, tempnam, tmpnam) getrandom is also used >> on first try, otherwise randomness is obtained using the clock plus >> a linear congruential generator. > &g

[PATCH 3/3] posix: Remove alloca definition from regex

2021-01-06 Thread Adhemerval Zanella
Since it is not used anymore. No functional changes is expected. Checked on x86_64-linux-gnu. --- posix/regex_internal.h | 19 --- 1 file changed, 19 deletions(-) diff --git a/posix/regex_internal.h b/posix/regex_internal.h index e31ac92674..641b27e2b1 100644 --- a/posix/regex_i

[PATCH 1/3] posix: Remove alloca usage on regex set_regs

2021-01-06 Thread Adhemerval Zanella
It replaces the regmatch_t with a dynarray list. Checked on x86_64-linux-gnu. --- posix/regexec.c | 62 - 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/posix/regexec.c b/posix/regexec.c index b083342f77..5e22f90842 100644 --- a/pos

[PATCH 2/3] posix: Remove alloca usage on regex build_trtable

2021-01-06 Thread Adhemerval Zanella
__libc_use_alloca/alloca is replaced with malloc regardless. Checked on x86_64-linux-gnu. --- posix/regexec.c | 50 +++-- 1 file changed, 15 insertions(+), 35 deletions(-) diff --git a/posix/regexec.c b/posix/regexec.c index 5e22f90842..a8e9a9cd01 1006

[PATCH 8/8] posix: Remove all alloca usage in glob

2021-01-05 Thread Adhemerval Zanella
With alloca usage removal from glob this patch wraps it up by removing all the alloca defines and macros usage. Checked on x86_64-linux-gnu. --- posix/glob.c | 23 --- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/posix/glob.c b/posix/glob.c index b6727ee884..

[PATCH 4/8] posix: Remove alloca usage on glob dirname

2021-01-05 Thread Adhemerval Zanella
This patch replaces the alloca/malloc usage for dirname creation by the char_array struct. Checked on x86_64-linux-gnu. --- posix/glob.c | 28 +--- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/posix/glob.c b/posix/glob.c index 41e1aeacad..d734ca977c 10064

[PATCH 5/8] posix: Use dynarray for globname in glob

2021-01-05 Thread Adhemerval Zanella
This patch uses dynarray at glob internal glob_in_dir function to manage the various matched patterns. It simplify and removes all the boilerplate buffer managements required. It also removes the glob_use_alloca, since it is not used anymore. Checked on x86_64-linux-gnu. --- posix/glob.c | 126

[PATCH 2/8] posix: Use char_array for internal glob dirname

2021-01-05 Thread Adhemerval Zanella
This is the first patch of the set to remove alloca usage on glob implementation. Internal path to search for file might expand to a non static directory derived from pattern for some difference cases (GLOB_NOESCAPE, GNU GLOB_TILDE) and to allow a non-static dirname path glob uses a lot of boilerp

[PATCH 3/8] posix: Remove alloca usage for GLOB_BRACE on glob

2021-01-05 Thread Adhemerval Zanella
GNU GLOB_BRACE internal implementation constructs a new expression and calls glob recursively. It then requires a possible large temporary buffer place the new pattern. This patch removes the alloca/malloc usage and replaces it with char_array. Checked on x86_64-linux-gnu. --- posix/glob.c | 53

[PATCH 7/8] posix: Use char_array for home_dir in glob

2021-01-05 Thread Adhemerval Zanella
This patch uses dynarray at glob internal home directory ame manipulation for GLOB_TILDE. It simplifies it and removes all the boilerplate buffer managements required. Checked x86_64-linux-gnu. --- posix/glob.c | 69 1 file changed, 42 inserti

[PATCH 1/8] malloc: Add specialized dynarray for C strings

2021-01-05 Thread Adhemerval Zanella
har_array-impl.c: New file. * malloc/char_array-skeleton.c: Likewise. * malloc/char_array.h: Likewise. * malloc/tst-char-array.c: Likewise. * malloc/dynarray_overflow_failure.c: Likewise. * malloc/malloc-internal.h (check_add_overflow_size_t): New function. S

[PATCH 6/8] posix: Remove alloca usage on glob user_name

2021-01-05 Thread Adhemerval Zanella
This patch uses dynarray at glob internal user name manipulation for GLOB_TILDE. It simplifies it and removes all the boilerplate buffer managements required. It also removes the glob_use_alloca, since it is not used anymore. Checked on x86_64-linux-gnu. --- posix/glob.c | 86 --

[PATCH 0/8] Remove alloca usage from glob

2021-01-05 Thread Adhemerval Zanella
Adhemerval Zanella (8): malloc: Add specialized dynarray for C strings posix: Use char_array for internal glob dirname posix: Remove alloca usage for GLOB_BRACE on glob posix: Remove alloca usage on glob dirname posix: Use dynarray for globname in glob posix: Remove alloca usage on glob

Re: [PATCH 1/2] posix: User scratch_buffer on fnmatch

2021-01-05 Thread Adhemerval Zanella
On 04/01/2021 17:35, Florian Weimer wrote: > * Adhemerval Zanella via Libc-alpha: > >> It removes the alloca usage on the string convertion to wide characters >> before calling the internal function. > > We have a downstream-only patch to fall back the single by

[PATCH 2/2] posix: Remove alloca usage for internal fnmatch implementation

2021-01-04 Thread Adhemerval Zanella
This patch replaces the internal fnmatch pattern list generation to use a dynamic array. Checked on x86_64-linux-gnu. --- posix/fnmatch.c | 24 +- posix/fnmatch_loop.c | 190 +++ 2 files changed, 87 insertions(+), 127 deletions(-) diff --git a/po

[PATCH 1/2] posix: User scratch_buffer on fnmatch

2021-01-04 Thread Adhemerval Zanella
It removes the alloca usage on the string convertion to wide characters before calling the internal function. Checked on x86_64-linux-gnu. --- posix/fnmatch.c | 152 +--- 1 file changed, 53 insertions(+), 99 deletions(-) diff --git a/posix/fnmatch.c b/

[PATCH 1/2] posix: Sync tempname with gnulib [BZ #26648]

2021-01-04 Thread Adhemerval Zanella
It syncs with gnulib commit ae9fb3d66 with the following change: --- glibc +++ gnulib @@ -61,7 +61,7 @@ # define __gen_tempname gen_tempname # define __mkdir mkdir # define __open open -# define __lstat64(version, file, buf) lstat (file, buf) +# define __lxstat64(version, file, buf) lstat (file

[PATCH 2/2] posix: Improve randomness on try_tempname_len

2021-01-04 Thread Adhemerval Zanella
For __GT_NOCREATE (mktemp, tempnam, tmpnam) getrandom is also used on first try, otherwise randomness is obtained using the clock plus a linear congruential generator. Also for getrandom GRND_NONBLOCK is used to avoid blocking indefinitely on some older kernels. Checked on x86_64-linux-gnu. ---

Re: [PATCH v3 4/6] stdlib: Sync canonicalize with gnulib [BZ #10635] [BZ #26592] [BZ #26341] [BZ #24970]

2021-01-04 Thread Adhemerval Zanella
On 01/01/2021 21:04, Paul Eggert wrote: > On 12/30/20 5:10 AM, Adhemerval Zanella wrote: > >>> it is just really >>> a small optimization that adds code complexity on a somewhat convoluted >>> code. > > The code is indeed simpler without the NARROW_ADDRE

[PATCH 5/5] posix: Sync fnmatch with gnulib

2020-12-30 Thread Adhemerval Zanella
It sync with gnulib commit 43ee1a6bf with following changes: --- posix/fnmatch_loop.c +++ ../../gnulib/gnulib-lib/lib/fnmatch_loop.c @@ -978,12 +978,12 @@ bool no_leading_period, int flags, size_t alloca_used) { const CHAR *startp; - ssize_t level; + size_t level; struct patternlist

[PATCH 2/5] posix: Sync glob code with gnulib

2020-12-30 Thread Adhemerval Zanella
It sync with gnulib commit 43ee1a6bf and fixes and use-after-free bug (gnulib commit 717766da8926e36). The main change over gnulib is: --- posix/glob.c +++ lib/glob.c @@ -59,6 +59,12 @@ # define readdir(str) __readdir64 (str) # define getpwnam_r(name, bufp, buf, len, res) \ __getpwnam_r (n

[PATCH 3/5] Sync intprops.h with gnulib

2020-12-30 Thread Adhemerval Zanella
It sync with gnulib commit 43ee1a6bf. Checked on x86_64-linux-gnu. --- include/intprops.h | 70 ++ 1 file changed, 58 insertions(+), 12 deletions(-) diff --git a/include/intprops.h b/include/intprops.h index 6de65b067d..52e60e5e2d 100644 --- a/include/

[PATCH 4/5] Sync flexmember.h with gnulib

2020-12-30 Thread Adhemerval Zanella
It sync with gnulib commit 43ee1a6bf. --- posix/flexmember.h | 25 - 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/posix/flexmember.h b/posix/flexmember.h index 30e6a6b867..1e839f08c2 100644 --- a/posix/flexmember.h +++ b/posix/flexmember.h @@ -33,11 +33,26

[PATCH 1/5] posix: Sync regex code with gnulib

2020-12-30 Thread Adhemerval Zanella
It sync with gnulib commit 43ee1a6bf. The main change is 9682f18e9. (which does not have a meaniful description). Checked on x86_64-linux-gnu. --- posix/regcomp.c| 2 +- posix/regex.h | 17 - posix/regex_internal.c | 19 ++- posix/regex_internal.

Re: [PATCH v3 4/6] stdlib: Sync canonicalize with gnulib [BZ #10635] [BZ #26592] [BZ #26341] [BZ #24970]

2020-12-30 Thread Adhemerval Zanella
On 30/12/2020 09:34, Adhemerval Zanella wrote: > > > On 29/12/2020 22:21, Paul Eggert wrote: >> On 12/29/20 11:34 AM, Adhemerval Zanella wrote: >>>    idx_t len = strlen (end); >>> + 

Re: [PATCH v3 4/6] stdlib: Sync canonicalize with gnulib [BZ #10635] [BZ #26592] [BZ #26341] [BZ #24970]

2020-12-30 Thread Adhemerval Zanella
On 29/12/2020 22:21, Paul Eggert wrote: > On 12/29/20 11:34 AM, Adhemerval Zanella wrote: >>    idx_t len = strlen (end); >> +  if (INT_ADD_OVERFLOW (len, n)) >> +    { >> +  __set_errno (ENAMETOOLONG); >> + 

[PATCH v3 6/6] stdlib: Add testcase fro BZ #26241

2020-12-29 Thread Adhemerval Zanella
Old implementation of realpath allocates a PATH_MAX using alloca for each symlink in the path, leading to MAXSYMLINKS times PATH_MAX maximum stack usage. The test create a symlink with __eloop_threshold() loops and creates a thread with minimum stack size (obtained through support_small_stack_thre

[PATCH v3 0/6] Multiple fixes to realpath

2020-12-29 Thread Adhemerval Zanella
This is an updated version from previous version synced with more recent gnulib version b29d62dfa. It also contains a testscase for the BZ #26421 and a fix to avoid a regression for BZ #22786. Adhemerval Zanella (6): Import idx.h from gnulib Import filename.h from gnulib malloc: Add

[PATCH v3 1/6] Import idx.h from gnulib

2020-12-29 Thread Adhemerval Zanella
And use to simplify stdlib/canonicalize.c implementation. --- include/idx.h | 114 ++ 1 file changed, 114 insertions(+) create mode 100644 include/idx.h diff --git a/include/idx.h b/include/idx.h new file mode 100644 index 00..024b44ae98 --

[PATCH v3 5/6] support: Add support_small_thread_stack_size

2020-12-29 Thread Adhemerval Zanella
It returns the minimum stack size large enough to cover most internal glibc stack usage. --- support/support_set_small_thread_stack_size.c | 12 +--- support/xthread.h | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/support/support_set_s

[PATCH v3 4/6] stdlib: Sync canonicalize with gnulib [BZ #10635] [BZ #26592] [BZ #26341] [BZ #24970]

2020-12-29 Thread Adhemerval Zanella
It sync with gnulib version b29d62dfa with the following change: -- diff --git a/stdlib/canonicalize.c b/stdlib/canonicalize.c index 04fe95253f..c8f085b779 100644 --- a/stdlib/canonicalize.c +++ b/stdlib/canonicalize.c @@ -41,6 +41,7 @@ #include #include #include +#include #ifdef _LIBC #

[PATCH v3 3/6] malloc: Add scratch_buffer_dupfree

2020-12-29 Thread Adhemerval Zanella
It returns a copy of the buffer up to a defined size. It will be used on realpath sync with gnulib. --- include/scratch_buffer.h| 16 + malloc/Makefile | 1 + malloc/Versions | 1 + malloc/scratch_buffer_dupfree.c | 41

[PATCH v3 2/6] Import filename.h from gnulib

2020-12-29 Thread Adhemerval Zanella
And use to simplify stdlib/canonicalize.c implementation. --- include/filename.h | 110 + 1 file changed, 110 insertions(+) create mode 100644 include/filename.h diff --git a/include/filename.h b/include/filename.h new file mode 100644 index 00

Re: [PATCH v2 6/6] stdlib: Assume FACCESSAT_NEVER_EOVERFLOWS on realpath

2020-12-28 Thread Adhemerval Zanella
On 28/12/2020 18:14, Paul Eggert wrote: > On 12/28/20 5:59 AM, Adhemerval Zanella wrote: >> The faccessat (..., AT_EACCESS) on Linux fallback will either use >> __NR_faccessat for __libc_enable_secure or LFS  fstatat call.  Neither >> fallbacks returns EOVERFLOW in failur

[PATCH v2 6/6] stdlib: Assume FACCESSAT_NEVER_EOVERFLOWS on realpath

2020-12-28 Thread Adhemerval Zanella
The faccessat (..., AT_EACCESS) on Linux fallback will either use __NR_faccessat for __libc_enable_secure or LFS fstatat call. Neither fallbacks returns EOVERFLOW in failure case. Checked on x86_64-linux-gnu. --- stdlib/canonicalize.c | 12 ++-- 1 file changed, 2 insertions(+), 10 delet

[PATCH v2 5/6] stdlibc: Simplify realpath via scratch_buffer_dupfree

2020-12-28 Thread Adhemerval Zanella
From: Paul Eggert Checked on x86_64-linux-gnu. --- stdlib/canonicalize.c | 20 +--- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/stdlib/canonicalize.c b/stdlib/canonicalize.c index 24a027b83f..69f978da78 100644 --- a/stdlib/canonicalize.c +++ b/stdlib/canonicali

[PATCH v2 4/6] stdlib: Sync canonicalize with gnulib [BZ #10635] [BZ #26592] [BZ #26341] [BZ #24970]

2020-12-28 Thread Adhemerval Zanella
It sync with gnulib version bbaba6ce5 with the following difference require fix a glibc build: --- stdlib/canonicalize.c +++ lib/canonicalize-lgpl.c @@ -52,7 +52,6 @@ # endif # define GCC_LINT 1 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) -# define FUNC_REALPATH_WORKS 1 #else # def

[PATCH v2 2/6] Import filename.h from gnulib

2020-12-28 Thread Adhemerval Zanella
And use to simplify stdlib/canonicalize.c implementation. --- include/filename.h | 110 + 1 file changed, 110 insertions(+) create mode 100644 include/filename.h diff --git a/include/filename.h b/include/filename.h new file mode 100644 index 00

[PATCH v2 3/6] malloc: Add scratch_buffer_dupfree

2020-12-28 Thread Adhemerval Zanella
It returns a copy of the buffer up to a defined size. It will be used on realpath sync with gnulib. --- include/scratch_buffer.h| 16 + malloc/Makefile | 1 + malloc/Versions | 1 + malloc/scratch_buffer_dupfree.c | 41

[PATCH v2 1/6] Import idx.h from gnulib

2020-12-28 Thread Adhemerval Zanella
Changes from previous version: - Change idx.h comment to LGPLv2.1+. -- And use to simplify stdlib/canonicalize.c implementation. --- include/idx.h | 114 ++ 1 file changed, 114 insertions(+) create mode 100644 include/idx.h diff --git a/includ

Re: [PATCH 5/5] stdlib: Remove lstat usage from realpath [BZ #24970]

2020-12-28 Thread Adhemerval Zanella
On 28/12/2020 08:42, Adhemerval Zanella wrote: >>>   static idx_t >>> +readlink_scratch_buffer (const char *path, struct scratch_buffer *buf) >>> +{ >>> +  ssize_t r; >>> +  while (true) >>> +    { >>> +  ptrdiff_t bufsize = b

Re: [PATCH 1/5] stdlib: Sync canonicalize with gnulib [BZ #10635] [BZ #26592] [BZ #26241]

2020-12-28 Thread Adhemerval Zanella
On 24/12/2020 19:45, Paul Eggert wrote: > On 12/24/20 7:16 AM, Adhemerval Zanella wrote: >> It sync with gnulib version d9c121346 with the following difference >> require fix a glibc build: > > As I mentioned today on bug-gnulib I installed some changes into Gnulib whic

Re: [PATCH 5/5] stdlib: Remove lstat usage from realpath [BZ #24970]

2020-12-28 Thread Adhemerval Zanella
On 24/12/2020 21:27, Paul Eggert wrote: > This email finishes the review of this proposed glibc patchset. (I didn't > look at patch 4/5 for test cases.) > > On 12/24/20 7:17 AM, Adhemerval Zanella wrote: > >> +/* Check if BUFFER is using the internal buffer.  */

[PATCH 5/5] stdlib: Remove lstat usage from realpath [BZ #24970]

2020-12-24 Thread Adhemerval Zanella
The readlink already tells whether the file is a symlink, so there is no need to call lstat to check it. However for '..' it requires an extra readlink check if the previous component can be really accessed, otherwise the next iteration will check a possible valid path and end early. It should pe

[PATCH 2/5] Import idx.h from gnulib

2020-12-24 Thread Adhemerval Zanella
And use to simplify stdlib/canonicalize.c implementation. --- include/idx.h | 113 ++ stdlib/canonicalize.c | 5 +- 2 files changed, 114 insertions(+), 4 deletions(-) create mode 100644 include/idx.h diff --git a/include/idx.h b/include/idx.h new

[PATCH 1/5] stdlib: Sync canonicalize with gnulib [BZ #10635] [BZ #26592] [BZ #26241]

2020-12-24 Thread Adhemerval Zanella
It sync with gnulib version d9c121346 with the following difference require fix a glibc build: --- ../../gnulib/gnulib-lib/lib/canonicalize-lgpl.c +++ stdlib/canonicalize.c @@ -46,7 +46,7 @@ # define FILE_SYSTEM_PREFIX_LEN(name) 0 # define IS_ABSOLUTE_FILE_NAME(name) ISSLASH(*(name)) # define I

[PATCH 4/5] stdlib: Add testcase fro BZ #26241

2020-12-24 Thread Adhemerval Zanella
Checked on x86_64-linux-gnu and i686-linux-gnu. --- stdlib/Makefile | 3 +- stdlib/tst-canon-bz26341.c| 108 ++ support/support_set_small_thread_stack_size.c | 12 +- support/xthread.h | 2 + 4 files

[PATCH 3/5] Import filename.h from gnulib

2020-12-24 Thread Adhemerval Zanella
And use to simplify stdlib/canonicalize.c implementation. --- include/filename.h| 110 ++ stdlib/canonicalize.c | 5 +- 2 files changed, 111 insertions(+), 4 deletions(-) create mode 100644 include/filename.h diff --git a/include/filename.h b/include

[PATCH 0/5] Fix multiple realpath issues

2020-12-24 Thread Adhemerval Zanella
/project/glibc/list/?series=1062 *** BLURB HERE *** Adhemerval Zanella (5): stdlib: Sync canonicalize with gnulib [BZ #10635] [BZ #26592] [BZ #26241] Import idx.h from gnulib Import filename.h from gnulib stdlib: Add testcase fro BZ #26241 stdlib: Remove lstat usage from realpath [BZ #24970

Re: [PATCH 1/6] canonicalize-lgpl: fix EOVERFLOW bug

2020-12-18 Thread Adhemerval Zanella
On 18/12/2020 09:30, Adhemerval Zanella wrote: > > > On 17/12/2020 07:55, Paul Eggert wrote: >> On 12/11/20 5:03 AM, Adhemerval Zanella wrote: >> >>> I have sent a similar fix to reviews for this very issue for glibc >>> (which is based on the canonic

Re: [PATCH 1/6] canonicalize-lgpl: fix EOVERFLOW bug

2020-12-18 Thread Adhemerval Zanella
On 17/12/2020 07:55, Paul Eggert wrote: > On 12/11/20 5:03 AM, Adhemerval Zanella wrote: > >> I have sent a similar fix to reviews for this very issue for glibc >> (which is based on the canonicalize-lgpl) along with other fixes that >> you might take a look at [1].

Re: [PATCH 1/6] canonicalize-lgpl: fix EOVERFLOW bug

2020-12-11 Thread Adhemerval Zanella
On 02/12/2020 19:39, Paul Eggert wrote: > * lib/canonicalize-lgpl.c: Do not include . > (__realpath): Do not use lstat. Just use readlink, as this > suffices and it avoids the EOVERFLOW problem that lstat has. > * modules/canonicalize-lgpl (Depends-on): Remove lstat, sys_stat. I have sent a simil

Re: Undefined behavior in lib/canonicalize-lgpl.c

2020-09-10 Thread Adhemerval Zanella
On 10/09/2020 05:32, Florian Weimer wrote: > We have received a report that the glibc realpath implementation > exhibits undefined behavior: > > > > In gnulib, the code is in lib/canonicalize-lgpl.c: > > 234 if (!ISSLASH (de

Sync gnulib regex with glibc

2017-12-21 Thread Adhemerval Zanella
Hi Paul, Working on syncing gnulib regex files with glibc a change on gnulib triggers a regression on a glibc testcase: posix/bug-regex28.c: 24 struct tests 25 { 26 const char *regex; 27 const char *string; 28 reg_syntax_t syntax; 29 int retval; 30 } tests[] = { 31 #define EGREP

Re: [PING] [PATCH 00/17] Regex: Make libc regex more usable outside GLIBC

2017-12-19 Thread Adhemerval Zanella
On 19/12/2017 15:43, Paul Eggert wrote: > On 12/19/2017 04:52 AM, Adhemerval Zanella wrote: >> Again, my understanding is we still aim to keep it in sync with gnulib, >> so I think we should first integrate with current gnulib code on glibc >> side (in same approach as we

Re: Unneeded compiler warning in glob.c

2017-12-19 Thread Adhemerval Zanella
On 15/12/2017 23:30, Paul Eggert wrote: > On 12/13/2017 01:38 AM, Tim Rühsen wrote: >> Here is a patch to silence this warning: >> >> glob.c: In function 'rpl_glob': >> glob.c:618:64: warning: pointer of type 'void *' used in arithmetic >> [-Wpointer-arith] >>     err = getpwn

Re: [PATCH v2 1/2] posix: Add compat glob symbol to not follow dangling symbols

2017-09-26 Thread Adhemerval Zanella
On 26/09/2017 11:10, Paul Eggert wrote: > On 09/26/2017 10:24 AM, Adhemerval Zanella wrote: >> I see other possible issues that would >> need to be fixed as well: >> >>    * FLEXIBLE_ARRAY_MEMBER definition for !__LIBC. >>    * __glob_pattern_type duplicated p

Re: [PATCH v2 1/2] posix: Add compat glob symbol to not follow dangling symbols

2017-09-26 Thread Adhemerval Zanella
On 26/09/2017 08:29, Andreas Schwab wrote: > Current version of make won't build against this (undefined reference to > __alloca from included glob sources). > > Andreas. > I am not very familiar of the process to incorporate gnulib code in external projects, but I see other possible issues that wo

Re: [PATCH v2 1/2] posix: Add compat glob symbol to not follow dangling symbols

2017-09-25 Thread Adhemerval Zanella
On 22/09/2017 18:43, Paul Eggert wrote: > On 09/22/2017 06:02 AM, Adhemerval Zanella wrote: >> +   ((flags & (GLOB_ERR | GLOB_NOESCAPE | GLOB_ALTDIRFUNC)) >> +   | GLOB_NOSORT | GLOB_ONLYDIR), > > The indenting is not quite right here: the &q

Re: [PATCH 2/2] Use C11 _Alignas on scratch_buffer internal buffer

2017-09-22 Thread Adhemerval Zanella
On 21/09/2017 19:53, Paul Eggert wrote: > Adhemerval Zanella wrote: >> Now back to the patch topic, I think the first union version [1] should >> the most suitable one and it is what I am intended to push. >> >> [1]https://sourceware.org/ml/libc-alpha/2017-09/msg00730.

Re: [PATCH 8/9] posix: Use enum for __glob_pattern_type result

2017-09-06 Thread Adhemerval Zanella
On 06/09/2017 13:18, Paul Eggert wrote: > Adhemerval Zanella wrote: >> My understanding was double underscore identifiers are reserved for >> implementation >> (C99 7.1.3 Reserved identifiers). > > Yes, and that's the point. When this code is used as part of

Re: [PATCH 8/9] posix: Use enum for __glob_pattern_type result

2017-09-06 Thread Adhemerval Zanella
On 06/09/2017 01:18, Paul Eggert wrote: > Adhemerval Zanella wrote: >> +enum glob_pattern_type_t >> +{ >> + __GLOB_NONE = 0x0, >> + __GLOB_SPECIAL = 0x1, >> + __GLOB_BACKSLASH = 0x2, >> + __GLOB_BRACKET = 0x4 >> +}; > > The ident

Re: clang's Undefined Sanitizer

2017-08-22 Thread Adhemerval Zanella
On 22/08/2017 18:34, Paul Eggert wrote: > On 08/22/2017 10:39 AM, Adhemerval Zanella wrote: >> In fact I decided to *not* sync flexmember because with >> following patch I intend to send (which are in the original thread) >> make flexmember unnecessary. > > I see t

Re: clang's Undefined Sanitizer

2017-08-22 Thread Adhemerval Zanella
ry to fix this. I > hope it is enough to pacify clang's Undefined Sanitizer. If not, Tim, please > let us know, and thanks for reporting the problem. > > I'll CC: this to Adhemerval Zanella, who's working on porting Gnulib glob.c > back to glibc, as I worry that th