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 pass parameters to a windows application


On Aug  3 12:26, Andy Koppe wrote:
> On 2 August 2010 12:56, Jason Pyeron wrote:
> >> 'cygstart'.
> >
> > It does not play nice with unc paths. Starting by cmd.exe /c start path does.
> > Suggestions?
> >
> >
> > jpyeron@phoenix /projects/cdnetdb/private/fxiao/cdnet
> > $ cygstart .
> >
> > jpyeron@phoenix /projects/cdnetdb/private/fxiao/cdnet
> > $ cygstart //host67/inst
> > Unable to start '\\?\UNC\host67\inst': There is no application associated with
> > the given file name extension.
> 
> It's a bug.
> 
> Cygstart uses cygwin_conv_path to convert to a Windows path, which
> produces UNC paths for network paths. Trouble is, the ShellExecute
> API, which is used to do the actual opening, doesn't appear to support
> UNC paths.
> 
> Cygpath already turns '\\?\UNC\' at the start of a path into plain ol
> '\\' (unless the resulting path would be longer than MAX_PATH, in
> which case the UNC path is mandatory). Mintty does the same thing when
> a file is opened with Ctrl+click.
> 
> So cygstart would need to do the same. And mkshortcut too (because the
> APIs involved in creating shortcuts have trouble with long paths too).
> Basically, any program that passes a path converted with
> cygwin_conv_path to Windows APIs might have this issue.

It's a shame that not even the official Win32 APIs are always clean
in terms of the long path name definition.

> Therefore I'm wondering whether it wouldn't be better to address this
> once and for all in cygwin_conv_path itself by doing what cygpath
> does: assuming the resulting path fits into MAX_PATH, drop "\\?\" from
> all long paths and turn "UNC\" into "\\".

This is already implemented in cygwin_conv_path for some time, but
only for the CCP_POSIX_TO_WIN_A case.  I never expected that this would
also be necessary for the wide char case.  Anyway, I applied a matching
patch.  As long as the resulting wide char path is not longer than
MAX_PATH, it will be stripped of the long path prefix.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

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