Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Using the history expansion modifier 'a' results in excessive lstat calls



> On 20 May 2022 at 11:15 Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> On 20 May 2022 at 11:08 Stefan Radziuk <sradziuk@xxxxxxxxxxxxxxx> wrote:
> > I have looked through some threads in the mailing list to find out why
> > zgetdir > is being used over getcwd in the first place. It seems it was
> > implemented this way in the 1990s to work around a bug in some implementations
> > of getcwd, which should not be a concern on modern systems. 
> > 
> > I was wondering if zgetdir is still the right way to do this? Are there
> > use cases where it is preferred over getcwd? Maybe zgetcwd could simply
> > use getcwd primarily (i.e. not as fallback), or perhaps USE_GETCWD could
> > be enabled by default (currently it is only enabled on QNX builds).
> 
> The best bet would probably be to try that by default once we're sure the
> release is out of the way --- as you say there's a good chance that's the
> right way to go now and I don't think we're going to find out the problems
> any other way.

Will it be worth seeing what effects the following has?

pws

diff --git a/configure.ac b/configure.ac
index c72148d06..77e381f50 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2021,11 +2021,15 @@ if test x$zsh_cv_sys_superroot = xyes; then
 fi
 
 dnl CHECK FOR SYSTEMS REQUIRING GETCWD
+dnl This is now turned on by default, as we expect modern getcwd
+dnl implementations to work correctly.  Any exceptions should be added
+dnl to the first case.  Currently there are none, hence it is forced
+dnl not to match.
 AC_CACHE_CHECK(whether we should use the native getcwd,
 zsh_cv_use_getcwd,
 [case "${host_cpu}-${host_vendor}-${host_os}" in
-    *QNX*) zsh_cv_use_getcwd=yes ;;
-    *) zsh_cv_use_getcwd=no ;;
+    *NOMATCH*) zsh_cv_use_getcwd=no ;;
+    *) zsh_cv_use_getcwd=yes ;;
  esac])
 AH_TEMPLATE([USE_GETCWD],
 [Define to 1 if you need to use the native getcwd.])




Messages sorted by: Reverse Date, Date, Thread, Author