]> Savannah Git Hosting - gnulib.git/commit
canonicalize, canonicalize-lgpl: fix symlink bug
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 24 Dec 2020 19:38:47 +0000 (11:38 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 24 Dec 2020 20:06:47 +0000 (12:06 -0800)
commit47098f211793a23d10b645c836dc29a52de3bd6c
treee646a124b34c90458f852f69a013f0cd8c59b5ea
parent438234c7409a58f091e314a2eecaef156efbc6ac
canonicalize, canonicalize-lgpl: fix symlink bug

Problem reported by Adhemerval Zanella in:
https://lists.gnu.org/r/bug-gnulib/2020-12/msg00155.html
* lib/canonicalize-lgpl.c, lib/canonicalize.c:
(suffix_requires_dir_check, dir_check): New functions.
(GCC_BOGUS_WRETURN_LOCAL_ADDR): New macro, to put the diagnostic
closer to the related GCC diagnostics.
* lib/canonicalize-lgpl.c (realpath_stk):
* lib/canonicalize.c (canonicalize_file_mode_stk):
Use them to fix a bug with .../symlink-to-regular-file/ etc.
* lib/canonicalize-lgpl.c (__stat) [!_LIBC]: New macro.
(realpath_stk): New function,
with the contents of the old __realpath and a new scratch buffer arg.
This is needed to pacify GCC 10.1, as canonicalize.c is already doing.
(__realpath): Use it.
* tests/test-canonicalize-lgpl.c, tests/test-canonicalize.c:
Add test cases for the bugs.
ChangeLog
lib/canonicalize-lgpl.c
lib/canonicalize.c
tests/test-canonicalize-lgpl.c
tests/test-canonicalize.c