This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bash output: ./configure: line 16: $'\r': command not found


Two problems (at least).

But there is a fix-up that appears to work (at least for me); see the end of this reply message.

Generally, there are lots and lots of script files for every build.  That means my builds could be crashing right and left all over the place if bash does not always ignore carriage returns when it is supposed to.  So I need for bash to be able to always ignore carriage returns -- at least all carriage returns immediately before newlines.

But the original 'configure' source file -- the one with the problem -- was OK up to line 16. ?Line 16 was the first blank line after nothing but # comment lines before that. ?I used Windows Explorer to make a copy of the file (i.e., via CTRL-C followed by CTRL-V) and renamed the copy 'configure.txt'; diagnostic output was the same with execution of '$ ./configure.txt --version'. ?So, using MS WordPad, I added a # as the only character on line 16, and the problem went away at that line, but the subsequent two diagnostics remain:

$ ./configure.txt --version
./configure.txt: line 31: syntax error near unexpected token `newline'
'/configure.txt: line 31: ` ? ? ;;

Upon viewing with an editor, line 31 appears to have nothing but five spaces followed by two semicolons.

However, I read 'configure.txt' and then wrote the file out using an editor that removes ending carriage returns (presumably those before newlines). ?(I assume dos2unix may do the same.) ?And the output from execution of './configure.txt --version' was fine:

$ ./configure.txt --version
gsl configure 1.15
generated by GNU Autoconf 2.68
...

So it seems that bash has a bug -- namely, it apparently fails to ignore carriage returns when there is a newline immediately before. ?(But there is some other problem with line 31 of 'configure.txt'; it seems to be an end-of-line problem of some sort, but exactly what is not clear.)

And/or GNU Autoconf 2.68 has a bug that puts out some line endings that bash can't handle even with the '-o igncr' command-line option.

So it seems to be a problem of bugs in both bash and Autoconf 2.68, and the bug ("unclean" design?) in bash might be OK if Autoconf 2.68 did not also have bugs/"unclean" design that brings out bash's bug.

The second problem is that I can find no documentation for the bash '-o igncr' command-line option.

But it turns out that the first problem seems to go away when I follow the advice of http://chess.eecs.berkeley.edu/softdevel/faq/5.html and add the lines

export SHELLOPTS
set -o igncr

to the end of my '.bash_profile' file.

Richard Haney


--- On Tue, 9/18/12, LMH [e-mail address deleted] wrote:

> From: LMH [e-mail address deleted]
> Subject: Re: bash output: ./configure: line 16: $'\r': command not found
> To: cygwin (at) cygwin (dot) com
> Date: Tuesday, September 18, 2012, 11:09 PM
> That error is a sign that the file is
> in the DOS format and not the UNIX 
> format. Bash doesn't recognize the windows end of line
> character \r.
> 
> Just run dos2unix on the file
> dos2unix configure
> 
> that should take care of the error.
> 
> LMH
> 
> 
> 
> Richard Haney wrote:
> > I am trying to get set up to build the Gnu Scientific
> Library using Cygwin bash for my command-line
> processor.? I eventually plan to use the tdm64-1 copy
> of MinGW gcc 4.6.1 to do the building:
> >
> > $ gcc --version
> > gcc.exe (tdm64-1) 4.6.1
> >
> > But I have not gotten to using the gcc tools yet.?
> (I also want to eventually rebuild all or parts of the gcc
> package optimized for my Intel i5 processor.)
> >
> > So in particular, I wanted to run ./configure --help ,
> to find out what options I need to use to build the Gnu
> Scientific Library, besides what is said in the INSTALL
> file.? (For example, I am wondering about revising the
> "make install" defaults.)
> >
> > But first I ran, and got:
> >
> > $ ./configure --version
> > ./configure: line 16: $'\r': command not found
> > ./configure: line 31: syntax error near unexpected
> token
> > `newline'
> > '/configure: line 31: `? ???;;
> >
> > I recall having a similar problem on another laptop
> (probably Cygwin on Windows XP), and I recall that I fixed
> the problem (after a terribly long, horrendous search for
> info and finally realizing that '\r' in C is a carriage
> return; but the details were a long time ago)
> >
> > Anyway, I believe I copied my Cygwin.bat (with the fix)
> from my old laptop to my new one, the one I'm now using
> (with Windows 7 and an Intel i5 processor).
> >
> > Here is the Cygwin.bat file listing:
> >
> > @echo off
> > C:
> > chdir C:\cygwin\bin
> > rem???bash --login -i
> > bash --login -i -o igncr
> >
> > Evidently the "igncr" is supposed to tell bash to
> ignore carriage returns.
> >
> > But on this system, it apparently is not ignoring
> carriage returns.
> >
> > I even searched the bash.info file for the string
> "igncr", but I found no such string.? Even the old
> bash.info file seems to lack that info.
> >
> > However, I did find a web page
> >
> > http://sourceware.org/ml/cygwin-announce/2011-02/msg00027.html
> >
> > that discusses the matter, but that does not seem to
> help in this case.
> >
> > So what's the problem?
> >
> > Has my more recently installed Cygwin dropped the
> "igncr" option capability from the bash command line?
> >
> > Here is my current bash version:
> >
> > $ bash --version
> > GNU bash, version 4.1.10(4)-release (i686-pc-cygwin)
> >
> >
> >
> > --
> > 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
> >
> >
> 
> --
> 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
> 
>

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]