delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/03/18/12:01:00

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: ralf <wiesweg AT tacos-gmbh DOT de>
Subject: Re: How to setup cygwin to use always textmode
Date: Fri, 18 Mar 2011 16:00:32 +0000 (UTC)
Lines: 91
Message-ID: <loom.20110318T163044-157@post.gmane.org>
References: <loom DOT 20110318T083042-612 AT post DOT gmane DOT org> <4D83695B DOT 8080200 AT redhat DOT com> <loom DOT 20110318T153128-549 AT post DOT gmane DOT org> <4D8377D6 DOT 1000406 AT redhat DOT com>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019