delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT 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=rb3xMS | |
I/4s9xq3ryUggpZMTgPJa5r9WQGunw3OERbA3t7dQILZ7VTr4JQVhCcOUiF1EiW+ | |
Jg6izeYGpAE5x/nAelgs7gFHGir2mvXsORx/Ac83XGUl1TDHBWNCgl0KpPlMeICG | |
B3zVveejtu5fVkx67ylQs49V7OTKtLaiwbEOg= | |
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=Ps/HGKCxpm30 | |
5eiHDol7HtbUPXw=; b=GGwVlxh3EUa3TRcFcNicu+c+H+uGM98OpJtTPD89znMz | |
JUMhkvcYREy4NFc9b3qNGwvyPj3RVPKVNTZhCc+tX8gdlSKsgNtgNB5u6fuhgCzb | |
sOs8MrpNspmyiAF8/sSwi6BjdtwFTikDOn+GmKIqPiFy2MH2nRGGYT7r/uho7EE= | |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT 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: | <55142BC5.4080209@redhat.com> |
Date: | Thu, 26 Mar 2015 09:54:45 -0600 |
From: | Eric Blake <eblake AT redhat DOT com> |
User-Agent: | Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com |
Subject: | Re: bash-4.3.33-1 fails to execute shell script with CR+LF EOL in text-mounted directory |
References: | <20150326153734 DOT 60517 DOT qmail AT mx DOT akamoz DOT jp> |
In-Reply-To: | <20150326153734.60517.qmail@mx.akamoz.jp> |
OpenPGP: | url=http://people.redhat.com/eblake/eblake.gpg |
X-IsSubscribed: | yes |
--WprL4rl5IFHHgWwSqWvCljb2r44u0iocl Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 03/26/2015 09:37 AM, smith AT cygwin DOT akamoz DOT jp wrote: > Dear Cygwin developers: >=20 > It seems that bash-4.3.33(1) handles CR+LF end-of-line in=20 > the shell-script incorrectly, all of the following conditions are met: >=20 > a. the shell-script file is on TEXT-MOUNTED directory, Thanks for the report. I'll have to test this and see if I can spot what is going wrong (I don't normally try text-mount directories). > b. end-of-line style of the file is CR+LF, and Are you absolutely sure that you don't have excess CR in your file? text mounts only treats the CRLF as a single newline, but does not eat lone CR elsewhere in the file. > c. the command in the file includes & (exec-background), > $( ), or `` (command substitutions) >=20 > It works: > d. it is on the binary-mounted directory, and with igncr shell-option, Does igncr make a difference in the text mount directory situation? > e. end-of-line style is LF, or Yeah, if you don't have CR, it doesn't matter whether you are text mount or binary mount. It is only CR that chokes bash, and only if you don't do something like igncr or text mount to hide it. > f. condition c is not met. It seems that &&, | and || work fine, > although I didn't try all of the metachacters and control-constructs. Weird. >=20 > I found it on x86 Cygwin with 64bit Windows environment first, > the same behavior is observed on 32bit Windows environment also. > I've not tried yet on x64 Cygwin with 64bit Windows environment. >=20 > shell-script to test: (WITH CR+LF END-OF-LINE STYLE) > --- 8< ------ 8< ------ 8< ------ 8< ------ 8< --- > #!/bin/bash Please ATTACH the script as a binary file, rather than pasting it inline in your email; or at a bare minimum, show 'od -tx1z yourscript' to make it obvious the exact byte patterns your file contains. Inline text in email does NOT make it obvious what line endings you are intending. >=20 > example of execution, on bash-4.3.33(1): > --- 8< ------ 8< ------ 8< ------ 8< ------ 8< --- > $ LANG=3DC ./test.sh > hoge > ./test.sh: line 3: fuga: command not found > ./test.sh: line 4: piyo: command not found > ./test.sh: line 5: o: command not found > ./test.sh: line 6: ho: command not found > ./test.sh: line 7: cho: command not found > --- 8< ------ 8< ------ 8< ------ 8< ------ 8< --- >=20 > Maybe commands are read from the positions one-byte shifted, line-by-line. Use of & or $() causes bash to fork; maybe the forked child is attempting to lseek back to the position last visited by the parent based on characters read, but failing to account for the fact that lseek on a text-mount file causes issues because characters read is different than file offset advanced? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --WprL4rl5IFHHgWwSqWvCljb2r44u0iocl Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVFCvFAAoJEKeha0olJ0NqgswH/RTz7t3TT4hsLSnoOjHOlMdc vpOc2FiNlzCSjSqviw6EEYHDpYagVmTVF6Gei/rq6bXK6G47ywgs/9vW6H3/D1wL +wBXuliEtuBf4R/5tU2JhRvM+E9/Np2U7mxKOzMW0VXeToVUwHyujt8r6FkXzEXS LVOE9AbPc4iSjzKTLUMu9eMSRCd8T66F2S3BhCx9+0hWIzz/xIZp5KFm39nfhZdF 4u3AGTJk7m2GwRpFZ+vEF0lpF0YNU6Ut1VwqTBKDTIIbsVGMrpU1xD2qCMHd/JpI FljUlyVcN2lqzWb+AK3rOq2uzbq5kqzqr9+6hPaeBG4Nl6w1JdjcuEHzT1Kk+OQ= =F+xG -----END PGP SIGNATURE----- --WprL4rl5IFHHgWwSqWvCljb2r44u0iocl--
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |