X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:message-id:date:from:mime-version:to:subject
	:references:in-reply-to:content-type; q=dns; s=default; b=NLQ0rR
	YxaX+UtntMKXgULvvHkow5xY2VfluYjaOiOubyI+2rs7DTtGqB8uyvV9wUhuWBYi
	5xnaC8TjgvbGvduCTw9mvcHW6qm/cP1/g02dgfC69oQjkU1fivJFuAeQvDjHvb38
	6Fm2b673C5y2FQRlXkIW6Jg+1qrc3NsZcyfk8=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:message-id:date:from:mime-version:to:subject
	:references:in-reply-to:content-type; s=default; bh=cAC+cejIwbOY
	p5toDRiTyQ3LUx8=; b=SxaDMgw5Yv1DHZiRDHpin+xEiPRfwWVWMtNwDdx8h+Sb
	wCc6RDAoJgMjLdL2RNPAXtMttulY/JL+IRmYXr5zFDyna2w7x+wyOXiZGb6PMBTk
	gzIP2zrbe7af1szaD8rYdCrikTE2f06zamPeO+XLgczO38zx50avycPZ9p5L3UY=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2
X-HELO: mx1.redhat.com
Message-ID: <5538641A.1090002@redhat.com>
Date: Wed, 22 Apr 2015 21:16:42 -0600
From: Eric Blake <eblake@redhat.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0
MIME-Version: 1.0
To: cygwin@cygwin.com
Subject: Re: 1.7.35: .sh script in dos format does not work.
References: <235472002.6091440.1429465717870.JavaMail.yahoo@mail.yahoo.com> <55351612.1040803@redhat.com> <ca8501d07d42$ad751770$085f4650$@gmail.com>
In-Reply-To: <ca8501d07d42$ad751770$085f4650$@gmail.com>
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="5an0WxNm8apGRcC1xMtJUpHfVr8M8s5vH"
X-IsSubscribed: yes

--5an0WxNm8apGRcC1xMtJUpHfVr8M8s5vH
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

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.
>>
>=20
> 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.

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


--5an0WxNm8apGRcC1xMtJUpHfVr8M8s5vH
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJVOGQaAAoJEKeha0olJ0Nqqr4H/iQFU07bKWCu5uZGbv5WT58+
rh0IZW00wkRagZass+WsLtqWC9dsxwI55K3jTn4jYpMfEptr0GgyIFGIPUvgkcv/
uMdLzsmZNGCnfLxxDdM4lYBOo17tYuHMLK+FFeTqyBGBpt8Ghs+sb1waYxK4Jxoc
82LH2tidkepOQ+vSSgiR6SG9PAgspwdl0gN5KLFjeBHgDsop+ijM74hj5KM2iMZl
rFqHyGiQZpD+VB/DzrMdbCgtJkYCTdJtZcHHdJH2u1AQrmZccSZ1VXxmkG3+WyC2
vGKzTcRC5DWBZN8fZY+M9llZzlJm+3KyZD2QR0bYbuiiFWKzydp6PUowDTqdUIQ=
=xRd7
-----END PGP SIGNATURE-----

--5an0WxNm8apGRcC1xMtJUpHfVr8M8s5vH--
