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: How to setup cygwin to use always textmode


Eric Blake <eblake <at> redhat.com> writes:
> 
> On 03/18/2011 09:11 AM, ralf wrote:
> > I can  not understand why this feature has been dropped.
> 
> What feature?  Cygwin was designed with POSIX pathnames in mind.  If DOS
> pathnames work, it is a fortunate side-effect, but not the primary
> design goal, and not subject to stay the same in future releases.  The
> only way to guarantee sane behavior from cygwin is to always use POSIX
> pathnames.
> 

During setup of cygwin you could choose between UNIX ending und DOS ending.
I choosed DOS (CR LF) endings and so I was able to mix cywin (my shell scripts)
batch-files and windows executables and the naming of files didn't matter.
After updating to the current release most of my scripts failed!!! Windows
programs can't read the output of my scrips and my scripts can't read most of
my text-files successfully.


> > 
> > C:\sw\bin>sh twg.sh
> > ok
> 
> POSIX path.
> 
> > 
> > C:\sw\bin>sh ./twg.sh
> > ok
> 
> POSIX path.
> 
> > 
> > C:\sw\bin>sh .\twg.sh
> > .\twg.sh: line 2: syntax error near unexpected token `$'in\r''
> > '\twg.sh: line 2: `  case "$funk" in
> 
> DOS path - don't do that if you don't want surprises.  And if you want
> bash to ignore \r, then reread the bash release announcements for
> several ideas for doing this (including 'set -o igncr' or setting the
> SHELLOPTS environment variable before bash is started).
> 
> http://cygwin.com/ml/cygwin-announce/2011-02/msg00027.html

And how can I get bash to write always CR? Adding \r to each echo,cat,awk ... ?
Only finding the places where this is necessary will take weeks.

> 
> > 
> > C:\sw\bin>sh c:\sw\bin\twg.sh
> > c:\sw\bin\twg.sh: line 2: syntax error near unexpected token `$'in\r''
> > ':\sw\bin\twg.sh: line 2: `  case "$funk" in
> 
> DOS path - don't do that if you don't want surprises.
> 

I don't want to do it this way. It's the way it is done in my scripts (lots of
them not only written by me). What can I do to get then to work without
recoding all?

> > In the past I didn't have to pay attention to line endings. All programs
> > (windows and cygwin) used CR LF. But now I have to look at each called
> > program do find out wich line-endings are written.
> 
> If you are writing files for cygwin, then it is much preferred that you
> omit CR, since cygwin emulates Linux which omits CR.  But if you must
> interact with text mode files, then use a text mode mount or tell bash
> that you plan on working with text mode and that bash should ignore CR.
> 
> > So is there a chance to get back the global setting of textmode, or is
> > there a way to get textmode without changing all the scripts?
> 
> /etc/fstab and set textmode mount points on the directories where you
> want it.  But you _don't_ want it globally - for example it's great for
> data files elsewhere in windows, but a bad idea for cygwin's /bin.
> 

Textmode mount points don't solve the problem if depending on the filename
cygwin behaves different. I have to change all filenames in all sripts. Windows
programs writing filenames now have to write unix filenams for script files and
windows filenames for other windows programs. Shell-scripts now have to write
Windows-filenames for windows programs and unix filenames for other shell scipts
and so on. How do I have to write filenames to a file when unix and windows
programs read this file?

Thank you very much for your patience but despite of all our usefull hints I 
think this does not solve my problem.

So are there other features to get back textmode like in earlier releases?




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