public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Eric Blake <ebb9@byu.net>
To: cygwin@cygwin.com
Subject: Re: bash-3.1-7^[$B!!^[(BBUG
Date: Wed, 13 Sep 2006 21:48:00 -0000	[thread overview]
Message-ID: <loom.20060913T234039-426@post.gmane.org> (raw)
In-Reply-To: <ee9q53$74g$1@sea.gmane.org>

mwoehlke <mwoehlke <at> tibco.com> writes:

> > Would it be possible to do this dynamically (instead of keying off of 
> > mounts, etc.): if the first line of the file read by bash has a \r\n, 
> > use text-mode (1-char-at-a-time) semantics, else use binary semantics 
> > (lseek)?
> 
> I hate to say this, but... if bash goes this route, could it be a shopt? 
> I would rather know that my scripts are broken (DOS-format).
> 

Thanks for the ideas; here's what I'll try.  Bash does indeed already scan the 
first line (I'm not sure if it is line or first 80 characters or what it is 
exactly, but I do know it scans) to see if it detects any NUL bytes, at which 
point it complains the file is binary and not a script.  So I can probably hack 
that scan to also look for \r.  So first I will open the file according to the 
mount point rules.  If the file is text mode, perform the scan in binary mode, 
and if any \r is seen, revert to text mode and no lseeks.  If the scan in 
binary mode succeeds, then leave the file in binary mode, assuming that the 
file is unix format even though it is on a text mount, and that lseeks will 
work.  If the file starts life binary mode (ie. was on a binary mount), skip 
the check for \r in the scan (under the assumption that on a binary mount, \r 
is intentional and not a line ending to be collapsed), and use lseeks.  No 
guarantees on whether this will pan out, or be bigger than I thought, but 
hopefully you will see a bash 3.1-8 with these semantics soon.

-- 
Eric Blake



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

  reply	other threads:[~2006-09-13 21:48 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-13  4:38 bash-3.1-7^[$B!!^[(BBUG Eric Blake
2006-09-13  5:25 ` bash-3.1-7^[$B!!^[(BBUG Christopher Faylor
2006-09-13 14:33   ` bash-3.1-7^[$B!!^[(BBUG Eric Blake
2006-09-13 20:07     ` bash-3.1-7^[$B!!^[(BBUG Shankar Unni
2006-09-13 20:37       ` bash-3.1-7^[$B!!^[(BBUG mwoehlke
2006-09-13 21:48         ` Eric Blake [this message]
2006-09-13 22:08           ` bash-3.1-7^[$B!!^[(BBUG mwoehlke
2006-09-13 23:46             ` bash-3.1-7^[$B!!^[(BBUG Volker Quetschke
2006-09-13 23:58               ` bash-3.1-7^[$B!!^[(BBUG David Rothenberger
2006-09-14  0:30                 ` bash-3.1-7^[$B!!^[(BBUG Larry Hall (Cygwin)
2006-09-18  2:48                   ` bash-3.1-7^[$B!!^[(BBUG Carlo Florendo
2006-09-18  2:54                     ` bash-3.1-7^[$B!!^[(BBUG Carlo Florendo
2006-09-14  0:19               ` bash-3.1-7^[$B!!^[(BBUG Christopher Faylor
2006-09-14  1:09                 ` bash-3.1-7^[$B!!^[(BBUG Volker Quetschke
2006-09-14  2:07                   ` bash-3.1-7^[$B!!^[(BBUG Christopher Faylor
2006-09-14 11:13                     ` bash-3.1-7^[$B!!^[(BBUG Eric Blake
2006-09-14 16:58                       ` bash-3.1-7^[$B!!^[(BBUG Volker Quetschke
2006-09-14 17:15                         ` bash-3.1-7^[$B!!^[(BBUG Dave Korn
2006-09-14 17:22                           ` bash-3.1-7^[$B!!^[(BBUG Volker Quetschke
2006-09-14 17:26                         ` bash-3.1-7^[$B!!^[(BBUG Eric Blake
2006-09-21  3:50                         ` bash-3.1-7^[$B!!^[(BBUG Christopher Layne
2006-09-14 15:21                     ` bash-3.1-7 bug mwoehlke
2006-09-21  3:48                     ` bash-3.1-7^[$B!!^[(BBUG Christopher Layne
2006-09-21  3:37                 ` bash-3.1-7^[$B!!^[(BBUG Christopher Layne
  -- strict thread matches above, loose matches on Subject: below --
2006-09-13  4:13 bash-3.1-7^[$B!!^[(BBUG Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20060913T234039-426@post.gmane.org \
    --to=ebb9@byu.net \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).