On Thu, 02 Nov 2023 at 22:23, Tom Lane <t...@sss.pgh.pa.us> wrote: > Japin Li <japi...@hotmail.com> writes: >> It seems the 'SEL\t' is converted to 'SEL ' which is "SEL" with 5 spaces. > > That would be plausible if readline were disabled, or otherwise > not functioning. >
I think this might be a bug comes from Illumos pseudo-tty. I can reproduce this by using pseudo-tty on Illumos. Here is a simple test case: $ cat pseudo-tty.c #define _XOPEN_SOURCE 600 #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #include <sys/types.h> #include <sys/wait.h> #define DEV_PTMX "/dev/ptmx" int main(void) { int ptm_fd; pid_t pid; char *pts_name; ptm_fd = open(DEV_PTMX, O_RDWR); grantpt(ptm_fd); unlockpt(ptm_fd); pts_name = ptsname(ptm_fd); pid = fork(); if (pid == -1) { fprintf(stderr, "could not fork a new process: %m\n"); close(ptm_fd); return -1; } else if (pid == 0) { int pts_fd; close(ptm_fd); pts_fd = open(pts_name, O_RDWR); write(pts_fd, "SEL\tH", 5); close(pts_fd); } else { int status; char buffer[512] = { 0 }; ssize_t bytes; bytes = read(ptm_fd, buffer, sizeof(buffer)); printf("%ld: '%s'\n", bytes, buffer); waitpid(pid, &status, 0); close(ptm_fd); } return 0; } On IllumsOS $ gcc -o pseudo-tty pseudo-tty.c $ ./pseudo-tty 9: 'SEL H' On Ubuntu $ gcc -o pseudo-tty pseudo-tty.c $ ./pseudo-tty 5: 'SEL H' -- Regrads, Japin Li ChengDu WenWu Information Technology Co., Ltd.