|
View:
New views
16 Messages
—
Rating Filter:
Alert me
|
|
|
CR/LF problems after upgradeAfter I upgraded cygwin, my scripts stopped working. I see that this has something to do with a change in how bash treats CR/LF and I see a lot of old discussion on this topic, none of which I understand. I am not interested in understanding the details, I just want my scripts to work. So can I either go back to an old version of cygwin before this change, or can I add some commands to my /etc/profile to make my scripts work? Any help would be appreciated.
|
|
|
RE: CR/LF problems after upgradeOn 05 January 2007 08:33, fschmidt wrote:
> After I upgraded cygwin, my scripts stopped working. I see that this has > something to do with a change in how bash treats CR/LF and I see a lot of > old discussion on this topic, none of which I understand. I am not > interested in understanding the details, I just want my scripts to work. So > can I either go back to an old version of cygwin before this change, or can > I add some commands to my /etc/profile to make my scripts work? Any help > would be appreciated. It's dead simple: just use the 'd2u' program on your script files, it will convert the line-endings from dos to unix format and everything will be fine. Alternatively, there is a shell option for recent versions of bash called 'igncr' that persuades it to ignore CR when it finds one at the cost of a bit of slowdown executing scripts. See item #4 in the recent bash release announcements. cheers, DaveK -- Can't think of a witty .sigline today.... -- 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: CR/LF problems after upgrade-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 According to Dave Korn on 1/5/2007 4:43 AM: > On 05 January 2007 08:33, fschmidt wrote: > >> After I upgraded cygwin, my scripts stopped working. I see that this has >> something to do with a change in how bash treats CR/LF > > It's dead simple: just use the 'd2u' program on your script files, it will > convert the line-endings from dos to unix format and everything will be fine. > > Alternatively, there is a shell option for recent versions of bash called > 'igncr' that persuades it to ignore CR when it finds one at the cost of a bit > of slowdown executing scripts. See item #4 in the recent bash release > announcements. Available here: http://cygwin.com/ml/cygwin-announce/2006-12/msg00026.html - -- Don't work too hard, make some time for fun as well! Eric Blake ebb9@... volunteer cygwin bash maintainer -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFnlGq84KuGfSFAYARAi2hAJ99VE8Cuxc+YUvlggGDI1BNEtTCBgCbB+qj tCGaux9QTYDdhmbwueXUISQ= =kFpl -----END PGP SIGNATURE----- -- 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: CR/LF problems after upgradefrom http://cygwin.com/ml/cygwin-announce/2006-12/msg00026.html
Several people I work with, who are even less technical than I am, use cygwin and edit scripts with various editors. So this will not work. I don't know what mounts are, or how to use them. I tried: cd /etc echo '(set -o igncr) 2>/dev/null && set -o igncr; # comment is needed' >bash_env export BASH_ENV=/etc/bash_env This did not work. I tried: export SHELLOPTS=$SHELLOPTS:igncr and got: bash: SHELLOPTS: readonly variable I don't know what the IFS variable is, or how to use it. |
|
|
RE: CR/LF problems after upgradeOn 05 January 2007 18:45, fschmidt wrote:
> from http://cygwin.com/ml/cygwin-announce/2006-12/msg00026.html > >> 2. d2u is your friend. You can use it to convert any problematic script >> into binary line endings. >> > > Several people I work with, who are even less technical than I am, use > cygwin and edit scripts with various editors. So this will not work. You need to use /development methodology/ to solve this problem. Either set their editors to use LFs, or if they like editors that cannot do CR/LFs try and offer them as similar an editor as you can find to use that does do LFs, or perhaps write a script for them to run that finds all the script files and automatically d2u's them, or convert files to LFs when you check them into version control... there are loads of possible solutions. > I don't know what mounts are, or how to use them. That is entirely your own fault. The solution to this problem is for you to be bothered to read the documentation. No technical means can help you if you can't be bothered to employ it. >> 4c. To affect all scripts, export the environment variable BASH_ENV, >> pointing to a file that sets the shell option as desired. Bash will >> source this file on startup for every script. >> > > I tried: > > cd /etc > echo '(set -o igncr) 2>/dev/null && set -o igncr; # comment is needed' >> bash_env > export BASH_ENV=/etc/bash_env > > This did not work. WJFFM: perhaps you need to "chmod x+x /etc/bash_env"? Here's an example: ~ $ cd /tmp /tmp $ mkdir crlf /tmp $ cd crlf/ /tmp/crlf $ touch crlf.sh /tmp/crlf $ write crlf.sh /tmp/crlf $ cat crlf.sh #!/bin/bash echo This is a script with CRLF endings ls pwd uname id /tmp/crlf $ u2d crlf.sh crlf.sh: done. /tmp/crlf $ chmod a+x crlf.sh /tmp/crlf $ ./crlf.sh This is a script with CRLF endings : command not foundls : command not foundpwd : command not founduname : command not foundid /tmp/crlf $ echo '(set -o igncr) 2>/dev/null && set -o igncr; # comment is need ed' >> ./bash_env /tmp/crlf $ export BASH_ENV=/tmp/crlf/bash_env /tmp/crlf $ d2u bash_env bash_env: done. /tmp/crlf $ chmod a+x bash_env /tmp/crlf $ ./crlf.sh This is a script with CRLF endings bash_env crlf.sh /tmp/crlf CYGWIN_NT-5.1 uid=11165(dk) gid=10513(Domain Users) groups=0(root),544(Administrators),545(Use rs),1005(Debugger Users),11113(Artimi),10512(Domain Admins),10513(Domain Users), 10519(Enterprise Admins),11311(Exmergers),12171(Hardware_Share) /tmp/crlf $ >> 4d. Added in the bash-3.2-2 release: export the environment variable >> SHELLOPTS with igncr included in it. It is read-only from within bash, >> but you can set it before invoking bash; once in bash, it auto-tracks the >> current state of 'set -o igncr' or 'shopt -s igncr'. If exported, then >> all bash child processes inherit the same option settings. >> > > I tried: > > export SHELLOPTS=$SHELLOPTS:igncr > > and got: > > bash: SHELLOPTS: readonly variable Well duh. What on earth did you suppose it means up there where it says "It is read-only from within bash"? Can you not see the words which are right in front of your face? >> 5. You can also experiment with the IFS variable for controlling how bash >> will treat \r during variable expansion. >> > > I don't know what the IFS variable is, or how to use it. This is actually the least useful of the suggestions and will only apply in quite limited suggestions, so it's not worth your spending much time on. cheers, DaveK -- Can't think of a witty .sigline today.... -- 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: CR/LF problems after upgradeIt was hard enough to convince people to use cygwin. These people will not change editors or run a global script to accomodate cygwin. May I suggest adding a warning to the cygwin homepage like: "Use of Cygwin requires unix system administration knowledge. Please do not use Cygwin if you are not familiar with unix system administration." This would discourage people like me from using cygwin and would result in a smaller, but more harmonious, cygwin community. Yes it's true that I am not interested in learning unix file system concepts. All I want is a decent shell. If cygwin can't provide this in a relatively painless way, then I will look for an alternative. This didn't work for me. I tried: cd /etc echo '(set -o igncr) 2>/dev/null && set -o igncr; # comment is needed' >./bash_env export BASH_ENV=/etc/bash_env d2u bash_env chmod a+x bash_env And my scripts still don't work. Okay, how can I set SHELLOPTS before invoking bash? I tried it in the /etc/profile but that didn't work. |
|
|
Re: CR/LF problems after upgradeOn 1/5/07, fschmidt wrote:
> Okay, how can I set SHELLOPTS before invoking bash? I tried it in the > /etc/profile but that didn't work. > > -- You admit to not understanding or wanting to understand Unix. What about Windows? It took me less than 60 seconds to figure this one out. Create a new Windows System Environment variable called SHELLOPTS and set it to igncr. When you run cygwin's bash, it will keep that value and add the others in. Depending on your network structure, you can automate this across all of the other dev's systems with a login script, AD GPO, or even a locally run script that access their registries remotely assuming you have admin. -Jason -- 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: CR/LF problems after upgrade - solvedThank you, this worked. |
|
|
|
|
|
Re: CR/LF problems after upgrade-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 http://cygwin.com/acronyms/#TOFU - reformatted > -----Original Message----- > From: cygwin-owner AT cygwin DOT com ^^^^ ^^^^^ http://cygwin.com/acronyms/#PCYMTNQREAIYR - raw email munged > On 1/5/07, fschmidt wrote: >> Okay, how can I set SHELLOPTS before invoking bash? I tried it in the >> /etc/profile but that didn't work. >> According to Eramo, Mark on 1/8/2007 9:33 AM: > I have the same problem and I set this under the Windows System > Variables as well as in the Cygwin shell window but neither worked. Actually, it sounds like you don't have the same problem. > > I use tsch as opposed to bash. Is there something different that needs > to be set in this shell? tcsh is not the same as bash, and SHELLOPTS does not affect tcsh (although even with tcsh, you probably end up invoking a lot of sh scripts that are affected). You'll have to show a simple test case that someone else can reproduce before we can offer help. - -- Don't work too hard, make some time for fun as well! Eric Blake ebb9@... -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFoxma84KuGfSFAYARAkoyAJ43HRX2mb3hJKa73oJ0ffZWlteB9QCgg7r3 1Tn4xzyGhvOX3oFo7nGcX6g= =yRr0 -----END PGP SIGNATURE----- -- 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: CR/LF problems after upgradeOn Jan 8 21:27, Eric Blake wrote:
> http://cygwin.com/acronyms/#TOFU - reformatted > > > -----Original Message----- > > From: cygwin-owner AT cygwin DOT com > ^^^^ ^^^^^ > > http://cygwin.com/acronyms/#PCYMTNQREAIYR - raw email munged > > According to Eramo, Mark on 1/8/2007 9:33 AM: > > I use tsch as opposed to bash. Is there something different that needs > > to be set in this shell? > > tcsh is not the same as bash, and SHELLOPTS does not affect tcsh (although > even with tcsh, you probably end up invoking a lot of sh scripts that are > affected). You'll have to show a simple test case that someone else can > reproduce before we can offer help. Don't use CR/LF in tcsh scripts. Cygwin's standard tcsh doesn't like them. There's an experimental 6.14.00-6 release which has some tweaks to handle CR/LF, but I don't think I'll follow through with this. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- 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: CR/LF problems after upgradeOn 09 January 2007 14:36, Eramo, Mark wrote:
MARK! Please pay attention to the polite requests Eric has made, particularly this one: >> -----Original Message----- >> From: cygwin-owner AT cygwin DOT com > ^^^^ ^^^^^ > > http://cygwin.com/acronyms/#PCYMTNQREAIYR - raw email munged because I DO NOT WANT TO GET SPAMMED IF YOU REPLY TO THIS EMAIL. > First, I added the following Environment Variable > > SHELLOPTS=igncr > > I then Opened Cygwin (envoking bash) and issued the SET command to see > the environment. As you can see below, the SHELLOPTS variable does not > have igncr included > > SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:igncr:interactive ^^^^^ > -comments:monitor :) Looks like it does to me; I suggest you proceed with that test, because it should be working now and if there are any further problems that would indicate a definite bug. cheers, DaveK -- Can't think of a witty .sigline today.... -- 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: CR/LF problems after upgradeOn 5 Jan, fschmidt wrote:
> > 3. Cygwin text mounts automatically work with either line ending style, > > because the \r is stripped before bash reads the file. If you absolutely > > must use files with \r\n line endings, consider mounting the directory > > where those files live as a text mount. However, text mounts are not as > > well tested or supported on the cygwin mailing list, so you may encounter > > other problems with other cygwin tools in those directories. > > > > I don't know what mounts are, or how to use them. With a freshly-installed Cygwin from a mirror that's a few days old, and with c:\cygwin\bin mounted textmode and a network share directory of bash scripts also mounted in textmode, using scripts that had CR/LF endings, each blank line in the script caused an error, and there were other errors too. In short, I don't think the text mounts are doing their magic correctly at the moment. (The scripts mentioned above did work correctly in much older Cygwins using text mounts.) <philosophy> I wonder how many centuries of human endeavour has been absorbed because of the decision to use CR+LF as line endings in DOS? </philosophy> luke -- 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: CR/LF problems after upgradeFrom: Luke Kendall
> <philosophy> > I wonder how many centuries of human endeavour has been > absorbed because of the decision to use CR+LF as line > endings in DOS? > </philosophy> <OT> To be fair, \r\n seems to go back to Gary Kildall's CP/M. http://en.wikipedia.org/wiki/Unprintable_characters </OT> -- 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: CR/LF problems after upgradeBuchbinder, Barry (NIH/NIAID) [E] wrote:
> From: Luke Kendall >> <philosophy> >> I wonder how many centuries of human endeavour has been >> absorbed because of the decision to use CR+LF as line >> endings in DOS? >> </philosophy> > > <OT> > To be fair, \r\n seems to go back to Gary Kildall's CP/M. > http://en.wikipedia.org/wiki/Unprintable_characters > </OT> As far as I know, Unix is actually the oddball, using only a single character to represent two actions on the old ttys, a carriage return followed by a line feed. All oses I used before I was exposed to Unix had <cr><lf> line endings - these included various other mini and microcomputer oses of the late 70s early 80s era. Note that it was important to send the carriage return *before* the line feed, to give the carriage head more time to actually return all the way to the start of the line. If you did the line feed before the carriage return, the next character after the carriage return could start printing while the carriage was still returning! (Actually, this is only true of really old style KSRs that didn't have much buffering, etc., but shows the history of \r\n.) And now that I'm way off topic, I'll just add that if anyone else wants to continue reminiscing, lets take it to -talk. Cary -- 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/ |
| Free embeddable forum powered by Nabble | Forum Help |