delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/03/18/11:12: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,TW_YG,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
Date: Fri, 18 Mar 2011 15:11:27 +0000 (UTC)
Lines: 78
Message-ID: <loom.20110318T153128-549@post.gmane.org>
References: <loom DOT 20110318T083042-612 AT post DOT gmane DOT org> <4D83695B DOT 8080200 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 01:43 AM, Ralf wrote:
> > I'm using cygwin under windows to change text-files with windows
 line-endings 
> > (CR and LF). I wrote a lot of shell-scripts which call each other. The 
> > filenames in those scripts are sometimes given als windows filenames (e.g. 
> > c:\temp\file.txt) sometimes relative (e.g. ../tmp/file.txt) sometimes as
 unix 
> > filenames (e.g. /c/temp/file.txt) and sometimes without any directory (e.g.
> > file.txt)
> > 
> > The current versions of cygwin now only use entries from fstab to determine 
> > the mode but this will break all my scripts because the same file will 
> > sometimes be treated as binary (filename c:\temp\file.txt) and sometimes as 
> > text (filename /c/temp/file.txt).
> > 
> > So is there a way to say 'use always textmode' like it was possible in
 former 
> > releases?
> 
> Use cygpath to convert the filename to POSIX style, so that you never
> open a DOS path.
> 

So I have to go to all my shell scripts (some 1000 lines) and have to find out
which parameters are filenames and which ones not. This will take some weeks.
Is there no global flag to control this?

I can  not understand why this feature has been dropped. In an windows
environment the new behaviour is very confusing. Here an example how sh.exe
behaves:

C:\sw\bin>mount
C:/unix/bin on /usr/bin type ntfs (binary,auto)
C:/unix/lib on /usr/lib type ntfs (binary,auto)
C:/unix on / type ntfs (binary,auto)
C: on /c type ntfs (text,posix=0,user,noumount,auto)
D: on /d type ntfs (text,posix=0,user,noumount,auto)
S: on /s type ntfs (text,posix=0,user,noumount,auto)
Z: on /z type ntfs (text,posix=0,user,noumount,auto)

C:\sw\bin>sh twg.sh
ok

C:\sw\bin>sh ./twg.sh
ok

C:\sw\bin>sh .\twg.sh
.\twg.sh: line 2: syntax error near unexpected token `$'in\r''
'\twg.sh: line 2: `  case "$funk" in

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

C:\sw\bin>

I know "d2u c:\sw\bin\twg.sh" will solve this particular problem but this will
not solve the problems with all the windows files twg.sh reads and writes.

I understand that it can be helpful to make it dependent from the filesystem
but if you use cygwin as an helpful tool in an pure windows environment it's
now confusing and error-prone.

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.

I think it's hard to understand that the same input gives different results
depending on filenames. You can see a lot of posts here which are about this
problem.

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?




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