Re: Unable to run even simple batch scripts any more

2007-02-14 Thread Ehud Karni
On Tue, 13 Feb 2007 00:56:24 Eric Backus wrote:

 Obviously, the horse is still alive and attempting to limp along.  I predict
 it'll stay alive for quite some time longer.

 [snip]

 * Workaround inserting set -o igncr is impractical when there are lots of
 scripts.
 [snip]

Among my many scripts, there are some with DOS (i.e. CR LF) ending
that I prefer to leave as is (mostly to be able to edit them with
notpad).

I wrote a little script that can fix bash scripts with CRs by adding
the required set -o igncr line.

Notes:
 1. You can, of course, replace the `awk' with a simple `d2u' if
you don't need the CRs at all.
 2. Change the `grep' arguments (mostly the -r and the files list)
to suit your needs.
 3. This script will fail on a file with : in its name (which can
occur only on manged mounts, because of the OS limitations)

Ehud.

  cut here 
#! /bin/bash -ex

chk_it ()
{
   while read HEAD
   do
   echo Checking $HEAD   # show some progress
   case $HEAD in
   *:1:#*^M )  # ONLY (ba)sh files with 
CR ending
   SNM=`echo $HEAD | cut -d: -f1`  # extract script name
   echo Fixing $SNM 
   cp -p $SNM $SNM-new # copy with permissions
   awk '
BEGIN  { IA = 0 }

$0 ~ /^[ ]*#/  { print $0 ; next }

   {
   if ( IA == 0 )
   {
   print set -o igncr #\r ;
   IA = 1 ;
   }

   print $0 ;
   }
   '  $SNM  $SNM-new # add set -o igncr 
after initial comments

   mv $SNM $SNM-old# save old script
   mv $SNM-new $SNM# rename new to current
   esac
   done
}
# --

grep -E -H -I -m 1 -n -U -r -e '^#![ ]*/bin/(ba)?sh' * \
   | cat -v | chk_it   # check  replace CR 
scripts

# end of fix-cr.sh script 


--
 Ehud Karni   Tel: +972-3-7966-561  /\
 Mivtach - Simon  Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 GnuPG: 98EA398D http://www.keyserver.net/Better Safe Than Sorry

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



Re: Unable to run even simple batch scripts any more

2007-02-13 Thread Eric Blake
 * Workaround by exporting SHELLOPTS breaks things because it put interactive 
 things like history expansion into non-interactive shells (try calling man 
 bash after exporting SHELLOPTS with igncr, for example).

Quit spreading FUD.  I fixed this in bash 3.2.9-11, due to user
requests on this list.

 * Workaround inserting set -o igncr is impractical when there are lots of 
 scripts.

Not if you use  BASH_ENV to point to a short script that does this
on your behalf.

-- 
Eric Blake
volunteer cygwin bash maintainer

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



Re: Unable to run even simple batch scripts any more

2007-02-13 Thread Dennis Simpson
I would like to thank those who unselfishly took their time to help us and
anyone else who reads these posts in the future, as the situation may
persist for a while.
 
Also, we do appreciate that open source developers are not paid, and do
their best. It's great this group is so active.  It impresses me away that
so many chimed in in only 24 hours! 



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



Re: Unable to run even simple batch scripts any more

2007-02-12 Thread Matthew Woehlke

Dennis Simpson wrote:

Three of us updated to latest windows cygwin last week, and none can run
even simple .sh scripts any more.  Prior version was 6 months ago.


http://cygwin.com/ml/cygwin-announce/2006-12/msg00026.html

Next time RTFRA. Oh, and STFLA; this particular horse died a *lng* 
time ago.


--
Matthew
Congratulations! You've won a free trip to the future! All you have to 
do to claim your prize is wait five minutes...



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



Re: Unable to run even simple batch scripts any more

2007-02-12 Thread Eric Backus
Matthew Woehlke mw_triad at users.sourceforge.net writes:

 Dennis Simpson wrote:
  Three of us updated to latest windows cygwin last week, and none can run
  even simple .sh scripts any more.  Prior version was 6 months ago.
 
 http://cygwin.com/ml/cygwin-announce/2006-12/msg00026.html
 
 Next time RTFRA. Oh, and STFLA; this particular horse died a *lng* 
 time ago.

Obviously, the horse is still alive and attempting to limp along.  I predict 
it'll stay alive for quite some time longer.

* Bash's current treatment of crlf causes unexpected breakage of things that 
worked for years, and which most naive users expect to continue to work.
* Workaround using text mounts fails because lots of cygwin commands don't 
work right under text mounts (gzip for example, but there's lots more).
* Workaround by exporting SHELLOPTS breaks things because it put interactive 
things like history expansion into non-interactive shells (try calling man 
bash after exporting SHELLOPTS with igncr, for example).
* Workaround inserting set -o igncr is impractical when there are lots of 
scripts.
* Workaround calling d2u is impractical when there are lots of scripts, and 
breaks if the scripts must work with non-cygwin shells.

I know, cygwin developers are not interested in fixing this, which is 
certainly their right.  But you can be sure that reports of this problem will 
continue to arrive.


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



Re: Unable to run even simple batch scripts any more

2007-02-12 Thread Larry Hall (Cygwin)

Eric Backus wrote:

Matthew Woehlke mw_triad at users.sourceforge.net writes:


Dennis Simpson wrote:

Three of us updated to latest windows cygwin last week, and none can run
even simple .sh scripts any more.  Prior version was 6 months ago.

http://cygwin.com/ml/cygwin-announce/2006-12/msg00026.html

Next time RTFRA. Oh, and STFLA; this particular horse died a *lng* 
time ago.


Obviously, the horse is still alive and attempting to limp along.  I predict 
it'll stay alive for quite some time longer.


* Bash's current treatment of crlf causes unexpected breakage of things that 
worked for years, and which most naive users expect to continue to work.
* Workaround using text mounts fails because lots of cygwin commands don't 
work right under text mounts (gzip for example, but there's lots more).
* Workaround by exporting SHELLOPTS breaks things because it put interactive 
things like history expansion into non-interactive shells (try calling man 
bash after exporting SHELLOPTS with igncr, for example).
* Workaround inserting set -o igncr is impractical when there are lots of 
scripts.
* Workaround calling d2u is impractical when there are lots of scripts, and 
breaks if the scripts must work with non-cygwin shells.


I know, cygwin developers are not interested in fixing this, which is 
certainly their right.  But you can be sure that reports of this problem will 
continue to arrive.




And Cygwin's bash maintainer continues to work to improve the situation for
those who can't just do the right thing, despite all the email that comes
to this list suggesting that he's not interested in these issues.  I'd
recommend, before others start slinging more mud, that they read the
totality of the discussion about this.  I think you'll realize that there
have been herculean efforts to address the deficiencies mentioned above
and that the effort continues.  It would be a shame if all this extra noise
causes the maintainer to actually loose interest in the issues people find
as a result of this change.

--
Larry Hall  http://www.rfk.com
RFK Partners, Inc.  (508) 893-9779 - RFK Office
216 Dalton Rd.  (508) 893-9889 - FAX
Holliston, MA 01746

_

A: Yes.
 Q: Are you sure?
 A: Because it reverses the logical flow of conversation.
 Q: Why is top posting annoying in email?

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