public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* 1.7.35: .sh script in dos format does not work.
@ 2015-04-19 17:48 sean nakasone
  2015-04-19 19:35 ` Andrey Repin
  2015-04-20 15:07 ` Eric Blake
  0 siblings, 2 replies; 7+ messages in thread
From: sean nakasone @ 2015-04-19 17:48 UTC (permalink / raw)
  To: cygwin

Hi Folks, I think the .sh scripts that are in dos format are not being interpreted properly.

--- Workflow to reproduce error ---

Downloaded cygwin 1.7.35, changed binary to text in the etc/fstab file.

Created a sh script with contents below:
touch a.txt
chmod 777 a.txt


Put 2 newlines at the end of the script.
Save the file as a dos text file (with carriage-returns).

--- Error when running script ---

line 2: mod: command not found

--- More detailed info ---

mod is chmod with the first 2 characters erroneously chopped off.
The more newlines you put at the end of the file, the more characters get chopped off.

--- Other things I tried ---

I tried this on a new Windows 8.1 (64-bit OS, 32-bit cygwin) and Windows Vista (32-bit OS), put the \cygwin\bin and \cygwin\usr\bin at front of PATH env var, and got the same error.

In fstab, i changed text to binary, changed the script to unix format, didn't get an error.

Here's my fstab entry:
none /cygdrive cygdrive text,posix=0,user 0 0

I downgraded to cygwin 1.7.33 and I don't get the error.


I read the fstab documentation, can't figure out what "none" is used for.  I tried other fstab entries, nothing seemed to fix the issue.

Thanks,
Sean

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 1.7.35: .sh script in dos format does not work.
  2015-04-19 17:48 1.7.35: .sh script in dos format does not work sean nakasone
@ 2015-04-19 19:35 ` Andrey Repin
  2015-04-19 21:09   ` Sean Nakasone
  2015-04-20 15:07 ` Eric Blake
  1 sibling, 1 reply; 7+ messages in thread
From: Andrey Repin @ 2015-04-19 19:35 UTC (permalink / raw)
  To: sean nakasone, cygwin

Greetings, sean nakasone!

> Here's my fstab entry:
> none /cygdrive cygdrive text,posix=0,user 0 0

This is a VERY, VERY, VERY bad idea.

> I downgraded to cygwin 1.7.33 and I don't get the error.


> I read the fstab documentation, can't figure out what "none" is used for. 
> I tried other fstab entries, nothing seemed to fix the issue.

This has nothing to do with fstab documentation.
igncr is a bash option. But only bash. If you make a "#!/bin/sh" script, it
may not work, and rightfully so.


-- 
With best regards,
Andrey Repin
Sunday, April 19, 2015 22:18:46

Sorry for my terrible english...


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 1.7.35: .sh script in dos format does not work.
  2015-04-19 19:35 ` Andrey Repin
@ 2015-04-19 21:09   ` Sean Nakasone
  0 siblings, 0 replies; 7+ messages in thread
From: Sean Nakasone @ 2015-04-19 21:09 UTC (permalink / raw)
  To: cygwin

oh, i didnt know about the igncr option. thankyou. 

Sent from my iPhone

> On Apr 19, 2015, at 9:22 AM, Andrey Repin <anrdaemon@yandex.ru> wrote:
> 
> Greetings, sean nakasone!
> 
>> Here's my fstab entry:
>> none /cygdrive cygdrive text,posix=0,user 0 0
> 
> This is a VERY, VERY, VERY bad idea.
> 
>> I downgraded to cygwin 1.7.33 and I don't get the error.
> 
> 
>> I read the fstab documentation, can't figure out what "none" is used for. 
>> I tried other fstab entries, nothing seemed to fix the issue.
> 
> This has nothing to do with fstab documentation.
> igncr is a bash option. But only bash. If you make a "#!/bin/sh" script, it
> may not work, and rightfully so.
> 
> 
> -- 
> With best regards,
> Andrey Repin
> Sunday, April 19, 2015 22:18:46
> 
> Sorry for my terrible english...
> 

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 1.7.35: .sh script in dos format does not work.
  2015-04-19 17:48 1.7.35: .sh script in dos format does not work sean nakasone
  2015-04-19 19:35 ` Andrey Repin
@ 2015-04-20 15:07 ` Eric Blake
  2015-04-20 15:14   ` Corinna Vinschen
  2015-04-22 21:24   ` cyg Simple
  1 sibling, 2 replies; 7+ messages in thread
From: Eric Blake @ 2015-04-20 15:07 UTC (permalink / raw)
  To: cygwin

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

On 04/19/2015 11:48 AM, sean nakasone wrote:
> Hi Folks, I think the .sh scripts that are in dos format are not being interpreted properly.

You're not the first to report it:
https://cygwin.com/ml/cygwin/2015-03/msg00466.html

> 
> mod is chmod with the first 2 characters erroneously chopped off.
> The more newlines you put at the end of the file, the more characters get chopped off.

It looks like something is going wrong with lseek() mixed with text-mode
mounts.

> 
> I downgraded to cygwin 1.7.33 and I don't get the error.

But that's new information.  I hope we haven't broken text mode mounts
in recent cygwin changes.

I still need to find time to investigate more to see whether it is
bash's fault or cygwin's fault.

-- 
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 --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 1.7.35: .sh script in dos format does not work.
  2015-04-20 15:07 ` Eric Blake
@ 2015-04-20 15:14   ` Corinna Vinschen
  2015-04-22 21:24   ` cyg Simple
  1 sibling, 0 replies; 7+ messages in thread
From: Corinna Vinschen @ 2015-04-20 15:14 UTC (permalink / raw)
  To: cygwin

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

On Apr 20 09:06, Eric Blake wrote:
> On 04/19/2015 11:48 AM, sean nakasone wrote:
> > Hi Folks, I think the .sh scripts that are in dos format are not being interpreted properly.
> 
> You're not the first to report it:
> https://cygwin.com/ml/cygwin/2015-03/msg00466.html
> 
> > 
> > mod is chmod with the first 2 characters erroneously chopped off.
> > The more newlines you put at the end of the file, the more characters get chopped off.
> 
> It looks like something is going wrong with lseek() mixed with text-mode
> mounts.
> 
> > 
> > I downgraded to cygwin 1.7.33 and I don't get the error.
> 
> But that's new information.  I hope we haven't broken text mode mounts
> in recent cygwin changes.

Nothing has changed in Cygwin in terms of text mode files or lseek
for a long time.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: 1.7.35: .sh script in dos format does not work.
  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
  1 sibling, 1 reply; 7+ messages in thread
From: cyg Simple @ 2015-04-22 21:24 UTC (permalink / raw)
  To: cygwin

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

--
cyg Simple



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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 1.7.35: .sh script in dos format does not work.
  2015-04-22 21:24   ` cyg Simple
@ 2015-04-23  3:16     ` Eric Blake
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Blake @ 2015-04-23  3:16 UTC (permalink / raw)
  To: cygwin

[-- 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 --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-04-23  3:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-19 17:48 1.7.35: .sh script in dos format does not work 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 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).