Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: improve checkptycmd
- X-seq: zsh-workers 54921
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Jun T <takimoto-j@xxxxxxxxxxxxxxxxx>
- Cc: zsh-workers@xxxxxxx
- Subject: Re: PATCH: improve checkptycmd
- Date: Mon, 6 Jul 2026 20:44:49 +0200
- Arc-authentication-results: i=1; mx.google.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=S9+MmiLjUAzrEsvStOfC+zSULUkAGjSUDg4VEwegjdc=; fh=U0plK0J8oBJltcyD3KCzc7MTBA+MjvHzYPuuxmTFpdE=; b=MUneJhpi2LomS7vFg6qTLMaL3uQJxpqczlXauBqzbWYFSxUYJMH9yg/Kb/YeFxPbFi URinyK2+FJVj1pWwm31D3txN5UZ5A+9VVqWNzvEZZ3U3EbqBgsu4Od76Yw50XuJ0xjnk ZOidhTbJ7IEShmui3QzvdClD+6ZEUgjRtNfZIoO3E9IxBD9815rJLOLJYaSyT752NZoc UDbgxECukbhThG67c2FZ+Smxy6zRTR7HxvYgfvQQdEKfp+QoLJ0q7hylrTHWxFEqdCp/ 1i5UKnIYyzGrOjY3wZnd13MRGfdI0YNON3o4FvAIlxMZWscP/D4e4QtLbVtfQJCG6+b6 xeHQ==; darn=zsh.org
- Arc-seal: i=1; a=rsa-sha256; t=1783363501; cv=none; d=google.com; s=arc-20260327; b=VdYdHBPyeV+yPqC/Fyleg/uTfeOYfe2GLekd3X7xl7UZ7pIiyrHZf6RZqUYx2iZK/I 9bdIt52wxIWbPYdipnCLam7RoAjay9qT7Dsrjft1/bMn84+Y6C5ADIWkAR1sF1s3zTqM XkMezjG7puPm14owHLINdbrrJNZVSd5q62GdwlsfuChIr/e6kPhmD4huDwJf8Pi6s3ZQ fKtkKEQORGJeRi0GUblQoVdnWGIchrCFtNIGbRD47J1OOmqKCagzD7DCdWnTavuGDSAP cLDZ+9Sul+uteHGv8Bc7xm+CQopdjzqQGCiLFWbU41PcJZmtDApOpTHTJ1wJGT2hZiJw hhgQ==
- Archived-at: <https://zsh.org/workers/54921>
- In-reply-to: <B739D3E9-C29B-4D00-8A15-30A345AAC25D@kba.biglobe.ne.jp>
- List-id: <zsh-workers.zsh.org>
- References: <20260615164157.20986-1-mikachu@gmail.com> <B739D3E9-C29B-4D00-8A15-30A345AAC25D@kba.biglobe.ne.jp>
On Mon, Jul 6, 2026 at 7:39 PM Jun T <takimoto-j@xxxxxxxxxxxxxxxxx> wrote:
>
> With this patch (commit 4b4ebcca) lots of tests fails on macOS
> (probably all the tests that use zpty). It seems reading from zpty
> returns nothing.
>
> On macOS, HAVE_POLL is not defined because zsh_system.h:374-381 has
>
> #if defined(__APPLE__) && defined(HAVE_SELECT)
> /*
> * Prefer select() to poll() on MacOS X since poll() is known
> * to be problematic in 10.4
> */
> #undef HAVE_POLL
> #undef HAVE_POLL_H
> #endif
>
>
> In funcion checkptycmd(), at zpty.c:576
> ret = select(cmd->fd + 1, (SELECT_ARG_2_T) &fds, NULL, NULL, &tv);
> returns ret=1 (and select_ret is set to 1), but at line 583
> if (ioctl(cmd->fd, FIONREAD, (char *) &val) == 0 && val > 0)
> returns val = 0, and the pty is closed at line 588.
>
> I don't know select()/ioctl() are working as expected or not.
>
> But, if I remove the lines 374-381 in zsh_system.h, i.e., if we use poll()
> also on macOS, then all the test pass, at least on the latest macOS (Sequoia).
>
> Version 10.4 mentioned in the comment is Tiger, which is released in 2005,
> and not supported since 2009, probably.
>
> If there are someone who have older macOS, please test by removing the
> lines 374-381 in zsh_system.h.
Hmm, I didn't look at the code again, but the idea was that even if
one of these things is not defined, the code should still work at
least as well as before. I'll take another look at it a bit later.
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author