delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/01/20/20:11:43

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,SPF_PASS
X-Spam-Check-By: sourceware.org
X-VirusChecked: Checked
X-Env-Sender: Chuck AT toysforbob DOT com
X-Msg-Ref: server-6.tower-202.messagelabs.com!1264036219!69479463!2
X-StarScan-Version: 6.2.4; banners=-,-,-
MIME-Version: 1.0
Subject: Design issue with new MS-DOS style path warning?
Date: Wed, 20 Jan 2010 17:11:28 -0800
Message-ID: <81D39E818991E549B1F66EB6A7D18422BE8626@AVSMOEXCL02.activision.com>
From: "Batson, Chuck" <Chuck AT toysforbob DOT com>
To: <cygwin AT cygwin DOT com>
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

Hello folks,

I am aware it is possible to disable the "MS-DOS style path detected"
warning with the 'nodosfilewarning' option.

But this message raises the question of, "What is the Cygwin ideal?"
That is, how to avoid the warning in a "clean" way without resorting to
the 'nodosfilewarning' option?

There is a situation in which it is not conceptually "clean" to avoid
the warning: at the interface between the host OS and Cygwin tools.

Say, for example, you create a Windows batch file containing the line:

  touch C:\foo.txt

You will receive the warning "MS-DOS style path detected."  How do you
avoid the warning without resorting to 'nodosfilewarning'?

1. Use cygpath to convert the path first.  This solution is not ideal,
because it forces the caller of 'touch' to know that it is a Cygwin
utility and not a native one.  It is also not ideal because in some use
cases it is very impractical to run cygpath over a path before passing
it on to a command.

2. Use some alternative to cygpath, i.e., manual transformation of the
path from DOS style to POSIX style.  This suffers from the same issues
as item #1, with the added issue that it also forces the caller to be
aware of Cygwin internals (i.e., how to map X: to /cygdrive/X/).

3. Put your commands in a shell script and run them from there.  Not
ideal because in a sense it forces you, again, to know the difference
between Cygwin and native utilities.  Even if you're okay with that,
you'll get bitten running the script -- the invocation "bash
C:\script.sh" suffers the same issue!

When starting Cygwin executables from Windows, it should be considered
reasonable -- even sensible -- to use Windows native paths.

Perhaps there should be no warning generated for command-line arguments
when the executable is launched from Windows.  Or perhaps paths should
be converted from Windows to POSIX at that time (similar to the way the
PATH environment variable is handled).

Or perhaps I'm completely missing something fundamental and you're about
to set me straight.  :-)

Thanks for your time.

Best wishes,

Chuck


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