Path: csiph.com!xmission!news.glorb.com!usenet.stanford.edu!not-for-mail From: Eric Blake Newsgroups: gnu.bash.bug Subject: [PATCH] input: fix logic bug that breaks on O_TEXT systems Date: Thu, 24 Sep 2015 15:47:29 -0600 Lines: 33 Approved: bug-bash@gnu.org Message-ID: NNTP-Posting-Host: lists.gnu.org X-Trace: usenet.stanford.edu 1443131262 7197 208.118.235.17 (24 Sep 2015 21:47:42 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-bash@gnu.org Envelope-to: bug-bash@gnu.org X-Mailer: git-send-email 2.4.3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1443131254; bh=UF1/hkxPCtQCAJUJoHxUnEZa0qFQXYAi99ArX0R8RdY=; h=Received:Received:From:To:Subject:Date:Message-Id; b=LrczIdAwsB1yvz9dJt1q0UiTqxcwthYi3wLna8Cl4W8U/QfnGjxaDBP0elsL88OOz JJIFgMmMKFyJia1o/1pWniFObxc6mS2fqYMEqs3NQmk8rSKCGCimXI+PFCaDX1eH7W PPbOcQ9EVGr/BCh2yCtvPlpYxMKFFDm2T86ch0cy1kTsgAk8r6LfAsO9QsvpQchEMO 8mlC0qqpSlBrQOSH5QSkii1o/m3LZKhZ2LaJUrIlTo6qE+a5HWX77ovgu7ks7ejbYu IGe++R7tFDpIu2fA63Pg0qc/ubk0cZxX+jW5tWN3sdMNDsdHupNy4XMTAkXrMFoFZ5 iwp6CdGjKYBLA== X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 96.114.154.167 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:11562 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 --- 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