1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-24 15:04:13 +00:00
cde/src/cmd/ksh93/tests
Martijn Dekker 9ba2c2e0df Speed up 'read', fixing macOS hang (take 2)
This fixes a hanging bug that could occur on macOS when using the
'read' command to read from a FIFO and encountering end-of-file
without a final newline character. It also makes the 'read' command
perform 15-25% faster on macOS and Linux.

The previous version (ff385e5a) failed on SunOS/Solaris/Illumos
because those systems apparently don't (fully) support the POSIX
standard recv(2) syscall with MSG_PEEK[*], which is the feature
that iffe detects under the 'socket_peek' identifier. On Illumos,
using that methods causes a compilation failure (unknown identifier
MSG_PEEK); on Solaris 11.4, that method causes multiple regressions
in tests/io.sh, suggesting the method compiles but doesn't work at
all. Instead, SunOS/Solaris/Illumos requires the method using
ioctl(2)+I_PEEK and select(2). No other system that ksh currently
builds on requires this method, so it is now only used on
SunOS/Solaris/Illumos.

So far, this version of sfpkrd() has been tested to work correctly
on Linux, macOS, FreeBSD, NetBSD, OpenBSD, HP-UX, Solaris, and
OmniOS (an Illumos distribution).

It still fails to peek on Cygwin, but in the exact same way it
failed before, so that's no loss.

To test, run the 'io' test set:  bin/shtests -p io

src/lib/libast/sfio/sfpkrd.c: sfpkrd():
- Remove long-obsolete Mac OS X and Solaris bug workarounds.
- Remove methods that are no longer needed.
     On systems with a POSIX compliant recv(2), the only thing that
  is required to avoid regressions is the code that was conditional
  upon the socket_peek feature test, which tests for the correct
  functioning of the recv(2) syscall. This has now been made
  mandatory for non-SunOS/Solaris/Illumos systems (using an #error
  directive if it is not detected), with the other methods removed.
  The result performs 15-25% faster on macOS and Linux while
  passing all the regression tests.
     On macOS, avoiding the select(2) method fixes the hanging bug.
     On SunOS/Solaris/Illumos (the '__sun' identifier), the method
  using ioctl(2)+I_PEEK and select(2) (iffe feature IDs:
  stream_peek and lib_select) is preserved.

Resolves: https://github.com/ksh93/ksh/issues/118 (again)

[*] https://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html
2020-08-19 23:54:55 +01:00
..
alias.sh Fixes to compile on Solaris variants, NetBSD, and NixOS 2020-08-03 09:24:16 +01:00
append.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
arith.sh Fix a syntax error when ((...)) is combined with redirections (#68) 2020-07-09 22:12:04 +01:00
arrays.sh Fix creation of extra associative array element '0' (#101) 2020-07-31 17:32:09 +01:00
arrays2.sh Fix unset method in multidimensional arrays (#105) 2020-08-05 18:14:30 +01:00
attributes.sh Really stop affecting user command history (re: aff63e38) 2020-08-13 23:04:29 +01:00
basic.sh Fix a large number of typos and other problems (#110) 2020-08-07 00:50:11 +01:00
bracket.sh Fixes to compile on Solaris variants, NetBSD, and NixOS 2020-08-03 09:24:16 +01:00
builtins.sh printf %H: fix/reduce encoding into entities (re: 8477d2ce) 2020-08-11 08:16:27 +01:00
case.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
comvar.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
comvario.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
coprocess.sh tests/coprocess.sh: fix intermittent false fail on CI (re: 712261c8) 2020-08-13 04:17:29 +01:00
cubetype.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
enum.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
exit.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
expand.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
functions.sh Over-shifting in a POSIX function should cause scripts to exit (#106) 2020-08-05 18:06:16 +01:00
glob.sh Skip '.' and '..' when globbing patterns like .* 2020-08-10 00:35:53 +01:00
grep.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
heredoc.sh Fix command substitutions run on the same line as a here-doc (#91) 2020-07-24 00:03:57 +01:00
io.sh Speed up 'read', fixing macOS hang (take 2) 2020-08-19 23:54:55 +01:00
leaks.sh tests/leaks.sh: rm minor editing glitch 2020-08-14 17:20:26 +01:00
locale.sh Fixes to compile on Solaris variants, NetBSD, and NixOS 2020-08-03 09:24:16 +01:00
math.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
nameref.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
namespace.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
options.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
path.sh Fix 'command -p' lookup if hash table entry exists (re: c9ccee86) 2020-08-17 20:23:39 +01:00
pointtype.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
pty.sh Fixes to compile on Solaris variants, NetBSD, and NixOS 2020-08-03 09:24:16 +01:00
quoting.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
quoting2.sh Fix shellquoting of invalid multibyte char (re: f9d28935, 8c7c60ec) 2020-08-05 18:22:22 +01:00
readcsv.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
recttype.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
restricted.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
return.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
select.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
shtests Really stop affecting user command history (re: aff63e38) 2020-08-13 23:04:29 +01:00
sigchld.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
signal.sh Fixes to compile on Solaris variants, NetBSD, and NixOS 2020-08-03 09:24:16 +01:00
statics.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
subshell.sh Fix crash upon running many subshells (#113) 2020-08-12 18:50:59 +01:00
substring.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
tilde.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
timetype.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
treemove.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
types.sh Fix type names starting with lowercase 'a' (#69) 2020-07-10 17:54:51 +01:00
variables.sh Add ${.sh.pid} as an alternative to $BASHPID (#109) 2020-08-07 02:53:25 +01:00
vartree1.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00
vartree2.sh shtests: use central temporary directory; add --keep option 2020-07-04 01:28:08 +02:00