[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Builtin 'read -u fd' does not work with fd other than zero.

From: haubi
Subject: Builtin 'read -u fd' does not work with fd other than zero.
Date: Fri, 25 Mar 2005 08:22:35 +0100

Configuration Information [Automatically generated, do not change]:
Machine: sparc
OS: solaris2.8
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='sparc' 
-DCONF_OSTYPE='solaris2.8' -DCONF_MACHTYPE='sparc-sun-solaris2.8' 
-I/wamas/tools/haubi/src/toolsbox-4-patches/buildroot/bash/bash-2.05b/lib  -g 
uname output: SunOS sauxch4 5.8 Generic_108528-11 sun4u sparc SUNW,Sun-Fire-280R
Machine Type: sparc-sun-solaris2.8

Bash Version: 2.05b
Patch Level: 0
Release Status: release

        When using 'read -u 3' or the like, and the pipe-buf already contains
        more than one line, the first line is returned, and bytes up to the next
        multiple of 128 are skipped.

        This bug quite sure exists in bash-3.0 too.

        Send lines to a spawned bash over a pipe with fd!=0 to have more than
        one line in pipe-buffer when doing the 'read -u'.
        If you want, you can have a test case with a python program spawning
        a bash and communicate with it over pipes other than stdin.

diff -ruN bash-2.05b.orig/builtins/read.def bash-2.05b/builtins/read.def
--- bash-2.05b.orig/builtins/read.def   2005-03-25 07:53:42.662996304 +0100
+++ bash-2.05b/builtins/read.def        2005-03-25 07:55:02.205903944 +0100
@@ -274,7 +274,7 @@
   input_is_tty = isatty (fd);
   if (input_is_tty == 0)
 #ifndef __CYGWIN__
-    input_is_pipe = (lseek (0, 0L, SEEK_CUR) < 0) && (errno == ESPIPE);
+    input_is_pipe = (lseek (fd, 0L, SEEK_CUR) < 0) && (errno == ESPIPE);
     input_is_pipe = 1;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]