public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: cygwin@cygwin.com
Subject: Re: 1.7.35: .sh script in dos format does not work.
Date: Thu, 23 Apr 2015 03:16:00 -0000	[thread overview]
Message-ID: <5538641A.1090002@redhat.com> (raw)
In-Reply-To: <ca8501d07d42$ad751770$085f4650$@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1168 bytes --]

On 04/22/2015 03:24 PM, cyg Simple wrote:
>> From: Eric Blake
>>
>> It looks like something is going wrong with lseek() mixed with text-mode
>> mounts.
>>
> 
> I thought lseek was reserved for binary only channels due to the loss of character count because of the CRLF to LF translation.

[you may want to teach your mailer to wrap long lines]

lseek works on files opened in text mode - BUT it only works to the
underlying offset in the file.  You are correct that if you read() 500
bytes, and then try to seek relative to current offset backwards by 100
bytes, that you have to be careful of whether you meant 100 bytes of
text read (but possibly more than 100 bytes when you include \r), or 100
bytes of offset (but possibly less than 100 bytes read because \r was
stripped).

What I haven't yet determined is if the bug lies in bash, for using
lseek() with the wrong numbers on a text mode file, or in cygwin itself,
for not properly handling file repositioning of stdin after flush()
prior to fork(), when stdin is in text mode.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

      reply	other threads:[~2015-04-23  3:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-19 17:48 sean nakasone
2015-04-19 19:35 ` Andrey Repin
2015-04-19 21:09   ` Sean Nakasone
2015-04-20 15:07 ` Eric Blake
2015-04-20 15:14   ` Corinna Vinschen
2015-04-22 21:24   ` cyg Simple
2015-04-23  3:16     ` Eric Blake [this message]

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=5538641A.1090002@redhat.com \
    --to=eblake@redhat.com \
    --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).