mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-06-17 21:18:06 +02:00
53607: Stop printing /usr/bin/foo -> /usr/bin/foo in 'whence -s'.
Makes the new test PASS. Review-by: Bart Schaefer
This commit is contained in:
parent
ed0c98f63f
commit
5db0d046b6
4 changed files with 18 additions and 2 deletions
|
@ -1,5 +1,8 @@
|
|||
2025-05-14 Daniel Shahaf <d.s@daniel.shahaf.name>
|
||||
|
||||
* 53607: Src/utils.c, Test/B13whence.ztst: Stop printing
|
||||
/usr/bin/foo -> /usr/bin/foo in 'whence -s'.
|
||||
|
||||
* 53524 (cf. 53607): Test/B13whence.ztst: Add an XFAIL test for a
|
||||
'whence -s' bug involving non-symlink arguments.
|
||||
|
||||
|
|
14
Src/utils.c
14
Src/utils.c
|
@ -1003,11 +1003,23 @@ print_if_link(char *s, int all)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (chrealpath(&s, 'P', 0)) {
|
||||
#ifdef HAVE_MEMCCPY
|
||||
char s_at_entry[PATH_MAX+1];
|
||||
if (!memccpy(s_at_entry, s, '\0', sizeof(s_at_entry))) {
|
||||
DPUTS1(1, "path longer than PATH_MAX: %s", s);
|
||||
s_at_entry[PATH_MAX] = '\0';
|
||||
}
|
||||
#else /* HAVE_MEMCCPY */
|
||||
char *s_at_entry = ztrdup(s);
|
||||
#endif /* HAVE_MEMCCPY */
|
||||
if (chrealpath(&s, 'P', 0) && strcmp(s, s_at_entry)) {
|
||||
printf(" -> ");
|
||||
zputs(*s ? s : "/", stdout);
|
||||
zsfree(s);
|
||||
}
|
||||
#ifndef HAVE_MEMCCPY
|
||||
zsfree(s_at_entry);
|
||||
#endif /* !HAVE_MEMCCPY */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,5 +34,5 @@
|
|||
1:whence deals with symlink loops gracefully
|
||||
|
||||
whence -s =sh(:P) | grep '.->' | wc -l
|
||||
-fD:(workers/53524) whence -s doesn't print arrows for symlink-free paths
|
||||
0:(workers/53524) whence -s doesn't print arrows for symlink-free paths
|
||||
>0
|
||||
|
|
|
@ -1261,6 +1261,7 @@ AC_CHECK_FUNCS(strftime strptime mktime timelocal \
|
|||
initgroups \
|
||||
setuid seteuid setreuid setresuid setsid \
|
||||
setgid setegid setregid setresgid \
|
||||
memccpy \
|
||||
memcpy memmove strstr strerror strtoul \
|
||||
getrlimit getrusage \
|
||||
setlocale \
|
||||
|
|
Loading…
Reference in a new issue