Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #11562

[PATCH] input: fix logic bug that breaks on O_TEXT systems

From Eric Blake <eblake@redhat.com>
Newsgroups gnu.bash.bug
Subject [PATCH] input: fix logic bug that breaks on O_TEXT systems
Date 2015-09-24 15:47 -0600
Message-ID <mailman.1763.1443131261.19560.bug-bash@gnu.org> (permalink)

Show all headers | View raw


The bash-20101229 snapshot introduced an attempt to incorporate
some patches that were previously used downstream by Cygwin
with regards to managing scripts read with O_TEXT mode (where
lseek() sees different offsets than the number of bytes read,
because the system is converting physical '\r\n' into logical
'\n').  But it introduced a typo, using O_TEXT where it meant
to use B_TEXT, with the result that scripts read in text mode
would seek to the wrong location.

Thanks to Jeff Downs for helping me find the typo.

Signed-off-by: Eric Blake <eblake@redhat.com>
---
 input.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/input.c b/input.c
index 2a9ca26..308b87e 100644
--- a/input.c
+++ b/input.c
@@ -205,7 +205,7 @@ make_buffered_stream (fd, buffer, bufsize)
   if (bufsize == 1)
     bp->b_flag |= B_UNBUFF;
   if (O_TEXT && (fcntl (fd, F_GETFL) & O_TEXT) != 0)
-    bp->b_flag |= O_TEXT;
+    bp->b_flag |= B_TEXT;
   return (bp);
 }

-- 
2.4.3

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

[PATCH] input: fix logic bug that breaks on O_TEXT systems Eric Blake <eblake@redhat.com> - 2015-09-24 15:47 -0600

csiph-web