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

Re: PATCH: Avoid \e in C code; building on Solaris 11



On 10 Dec, I wrote:
> It occurred to me that /bin/sh on Solaris 11 is ksh 93 and that test
> consistently doesn't work with ksh (88 or 93). The same applies with
> ksh93 on Linux.
>
> > This is testing that /dev/fd/ entries are created when new descriptors are
> > created.  The commit log says "work around /dev/fd problem on FreeBSD":

> Just doing test -e on /dev/fd/3 gives the same results as the existing
> test on FreeBSD both with and without fdescfs. Do you see a problem with
> this approach?

This test unexpectedly succeeding on Haiku alerted me to the fact that
there is a problem with that approach: several shells will emulate
/dev/fd for redirections and test and Haiku uses bash for /bin/sh.
The following which is similar to the original but using 3<&0 for cat
instead of exec is another approach. This does appear to get the right
result on Solaris 11. Real ksh on Linux doesn't handle this but
otherwise it seems to work.

Oliver

diff --git a/configure.ac b/configure.ac
index aca355ff4..a3f6543a9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1948,7 +1948,7 @@ AH_TEMPLATE([PATH_DEV_FD],
 [Define to the path of the /dev/fd filesystem.])
 AC_CACHE_CHECK(for /dev/fd filesystem, zsh_cv_sys_path_dev_fd,
 [for zsh_cv_sys_path_dev_fd in /proc/self/fd /dev/fd no; do
-   (exec 3<&0; test -e $zsh_cv_sys_path_dev_fd/3;) && break
+   test x`echo ok|(cat $zsh_cv_sys_path_dev_fd/3 3<&0 2>/dev/null;)` = xok && break
  done])
 if test x$zsh_cv_sys_path_dev_fd != xno; then
   AC_DEFINE_UNQUOTED(PATH_DEV_FD, "$zsh_cv_sys_path_dev_fd")




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