Re: Strange cygpath behavior.

2011-06-27 Thread Charles Wilson
On 6/27/2011 9:38 AM, Andrey Repin wrote:
>> As you are apparently using the cmd "shell", the correct way to quote
>> arguments in order to preserve spaces etc, is to use double quotes
>> and escape all backslashes with an extra backslash.
> 
> Ok, please explain, how could I escape backslashes in, say, Explorer?
> It could only quote the string.
> I can't even write my own conversion utility :/
> No amount of external conversion would help using diff or patch freely.

Well, here's the thing: on win32, GUI apps (those compiled for the GUI
subsystem) have a different "entry point" than command line ones (those
compiled for the CUI subsystem.

The GUI ones actually use 'WinMain' as an entry point, while the CUI
ones follow the tradition 'int main(int argc, char * argv[])' entry
point (actually, thanks to a quirk of the C, it is
int main(int argc, char * argv[], char * envp[])
but usually the third argument is null).

Anyway, since the signature of WinMain is
int CALLBACK WinMain(
  __in  HINSTANCE hInstance,
  __in  HINSTANCE hPrevInstance,
  __in  LPSTR lpCmdLine,
  __in  int nCmdShow
);
the "command line arguments" are passed in as one giant command line,
and parsing it is up the program itself.



Now, *cygwin* programs are usually CUI, but their actual entry point is
mainCRTStartup, regardless of whether they are compiled for the CUI or
GUI subsystem. This function is defined in cygwin1.dll; it does a lot of
stuff, but eventually converts the "big cmd line string" to an argv[]
array, and calls the user's main() function.  This process of converting
"the big cmd line string" is done according to *unix* quoting rules.

There's also a 'stub' main() that does the opposite: if your app defines
a WinMain but no main(), then the stub main gets the "big cmd line
string" via GetCommandLine (e.g. it ignores whatever argv[] was passed
in) and invokes your WinMain using that big string.

See
http://cygwin.com/cgi-bin/cvsweb.cgi/src/winsup/cygwin/how-startup-shutdown-works.txt?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=src

for more info.


So, what's the point?

I think ONE way of solving your problem is to write a wrapper program,
that will *ignore* argv[].  It should grab the full cmd line using
GetCommandLine(), properly quote it using *win32* quoting rules -- and
then invoke the cygwin program you want to run (*) using main(argc,
argv).  Then, cygwin's parsing routines will Do The Right Thing for you.

Here's some code to get you started:
http://sourceforge.net/projects/mingw/files/UserContributed/execwrap/Current%20Release_%20mingw-execwrap-1.0/

(*) In order to bypass the cygwin parsing rules, this wrapper program
should be a native (that is, non cygwin) application.


Now, why is this so hard?

Well, you've got to realize, what you are trying to do is WAY outside
the normal usage pattern for cygwin tools.  In general, we try to make
sure that cygwin tools work "in the unix way" -- and often, that means
they need to be invoked via a unix style shell.  Sometimes, invoking
directly from the Win32 GUI point-n-click arena just doesn't work as
expected -- as you have discovered.

That's why so few cygwin apps install GUI-style shortcuts into the Start
Menu.  If you look, most of the one that do fall into three categories:
(1) shells - like Cygwin.bat or bash (2) terminals, like rxvt or mintty
(3) X apps that take no cmd line arguments.

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



Vim segv'ing

2011-06-27 Thread Andrew DeFaria

Just started happening recently:

$ vi /etc/hosts
:wq
$ vi /etc/hosts
:w
Vim: Caught deadly signal SEGV

Vim: Finished.
Segmentation fault
--
Andrew DeFaria 
Drive carefully. It's not only cars that can be "recalled" by their maker.%

Cygwin Configuration Diagnostics
Current System Time: Mon Jun 27 12:34:08 2011

Windows XP Professional Ver 5.1 Build 2600 Service Pack 3

Path:   .
\\sc2smbsvr\adefaria\bin
C:\Cygwin\opt\clearscm\bin
C:\Cygwin\opt\clearscm\cc
C:\Cygwin\opt\clearscm\cq
C:\Cygwin\opt\clearscm\cvsbin
C:\Program Files\Rational\Clearcase\bin
C:\Program Files\Rational\Common
C:\Cygwin\bin
C:\Cygwin\sbin
C:\Cygwin\bin
C:\Cygwin\usr\local\bin
C:\Program Files\Rational\clearcase\bin
C:\Program Files\Rational\clearcase\etc
C:\Cygwin\usr\sbin
C:\WINDOWS\System32
C:\WINDOWS

Output from C:\Cygwin\bin\id.exe
UID: 597856(adefaria)GID: 10513(Domain Users)
10513(Domain Users)  0(root)  544(Administrators)
545(Users)   579446(scstaff)

SysDir: C:\WINDOWS\system32
WinDir: C:\WINDOWS

PWD = '/home/adefaria'
CYGWIN = 'ntsec smbntsec nodosfilewarnings'
HOME = '/home/adefaria'

CLEARCASE_BLD_HOST_TYPE = 'unix'
HOMEPATH = '\Documents and Settings\adefaria'
GREEN = '\033[32m'
APPDATA = 'C:\Documents and Settings\adefaria\Application Data'
CLEARTOOL = '/dev/c/Program Files/Rational/Clearcase/bin/cleartool'
B_BLUE = '\033[34m'
TERM = 'xterm'
RoxioCentral = 'C:\Program Files\Common Files\Roxio Shared\9.0\Roxio Central33\'
PROCESSOR_IDENTIFIER = 'x86 Family 6 Model 15 Stepping 6, GenuineIntel'
esc = '\033'
WINDIR = 'C:\WINDOWS'
AQUA = '\033[36m'
YELLOW = '\033[33m'
B_AQUA = '\033[36m'
CVSROOT = ':pserver:and...@defaria.com:/cvs/defaria.com'
PERLTIDY = '/home/adefaria/.rc/perltidyrc'
PERLCRITIC = '/home/adefaria/.rc/perlcriticrc'
OLDPWD = '/usr/bin'
LINUX_VOBTAG_PREFIX = '/vob'
USERDOMAIN = 'TELLABS-WEST'
B_RED = '\033[31m'
UATDATA = 'C:\WINDOWS\system32\CCM\UATData\D9F8C395-CAB8-491d-B8AC-179A1FE1BE77'
OS = 'Windows_NT'
ALLUSERSPROFILE = 'C:\Documents and Settings\All Users'
CDPATH = '.:/vob/adpscmtools:/vob/9200/software/common'
LOGS = '/dev/c/Program Files/Rational/Clearcase/var/log'
NORMAL = '\033[39m'
!:: = '::\'
LS_COLORS = 
'no=00:fi=00:di=01;33:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.ogg=01;35:*.mp3=01;35:*.wav=01;35:'
TEMP = '/tmp'
COMMONPROGRAMFILES = 'C:\Program Files\Common Files'
interactive = 'true'
BLUE = '\033[34m'
VOBTAG_PREFIX = '\'
B_MAGENTA = '\033[35m'
USERNAME = 'adefaria'
PAGER = 'less -s'
RGY = '/dev/c/Program Files/Rational/Clearcase/var/atria/rgy'
PROCESSOR_LEVEL = '6'
MAIL = '/var/mail/'
MAGENTA = '\033[35m'
B_GREEN = '\033[32m'
FP_NO_HOST_CHECK = 'NO'
SYSTEMDRIVE = 'C:'
LANG = 'C'
USERPROFILE = 'C:\Documents and Settings\adefaria'
PVOB = '\9200_projects'
SYSNAME = 'Usscandrewdl'
LOGONSERVER = '\\USSJ1WDSW02'
CLEARCASE_PRIMARY_GROUP = 'scstaff'
PROCESSOR_ARCHITECTURE = 'x86'
MULTITOOL = '/dev/c/Program Files/Rational/bin/multitool'
RED = '\033[31m'
SHLVL = '1'
PS4 = '${0##*/} line $LINENO:'
USERDNSDOMAIN = 'TELLABS-WEST.TELLABSINC.NET'
PATHEXT = '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH'
HOMEDRIVE = 'C:'
VENDOR = 'Unknown'
COMSPEC = 'C:\WINDOWS\system32\cmd.exe'
LESS = 'eiXP?f%f :[stdin] .?pt(%pt\%):?bt(%bt bytes):-..'
TMP = '/tmp'
SYSTEMROOT = 'C:\WINDOWS'
VISUAL = 'vi'
PROCESSOR_REVISION = '0f06'
B_YELLOW = '\033[33m'
ARCH = 'cygwin'
MSHOME = '/dev/c/Program Files/Rational/'
PROGRAMFILES = 'C:\Program Files'
DISPLAY = ':0'
CCHOME = '/dev/c/Program Files/Rational/Clearcase'
NUMBER_OF_PROCESSORS = '2'
B_WHITE = '\033[36m'
SESSIONNAME = 'Console'
COMPUTERNAME = 'USSCANDREWDL'
WHITE = '\033[36m'
_ = '/bin/cygcheck'

HKEY_CURRENT_USER\Software\Cygwin
HKEY_CURRENT_USER\Software\Cygwin\Program Options
HKEY_CURRENT_USER\Software\Cygwin\setup
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start
 Menu2\Programs\Cygwin
  (default) = (unsupported type)
HKEY_LOCAL_MACHINE\SOFTWARE\Cygwin
HKEY_LOCAL_MACHINE\SOFTWARE\Cygwin\Installations
  (default) = '\??\C:\Cygwin'
HKEY_LOCAL_MACHINE\SOFTWARE\Cygwin\Program Options
HKEY_LOCAL_MACHINE\SOFTWARE\Cygwin\setup
  (default) = 'C:\Cygwin'

obcaseinsensitive set to 1

Cygwin installations found in the registry:
  System: Key: c5e39b7a9d22bafb Path: C:\Cygwin

c:  hd  NTFS 95381Mb  36% CP CS UN PA FC 
d:  cd N/AN/A
e:  fd N/AN/A  

[ANNOUNCEMENT] Updated: gsl-1.15-1

2011-06-27 Thread A.R. Burgers

The cygwin gsl package (GNU Scientific Library) has been updated to 1.15-1

This is a new upstream release.
For the announcement of gsl version 1.15 see:

http://cygwin.com/ml/gsl-announce/2011/msg0.html

The homepage for the GSL is http://www.gnu.org/software/gsl/

The gsl package comes in four parts:

gsl:   the shared libraries (dlls)
gsl-apps:  gsl-histogram.exe and gsl-randist.exe
gsl-doc:   documentation
gsl-devel: development resources (headers, static- and import
   libraries)

NOTE: Starting from gsl-1.6-2,if you want to use the GSL, your path
should contain /usr/lib/lapack. This directory is added by
/etc/profile.d/lapack0.sh, and /etc/profile.d/lapack0.csh.\
If you use the start-up scripts from the
base-files packages this script is executed automatically.

Teun Burgers

UPDATE


To update your installation, click on the "Install Cygwin now" link
on the http://cygwin.com/ web page.  This downloads setup.exe to
your system.  Then, run setup and answer all of the questions.

  *** CYGWIN-ANNOUNCE UNSUBSCRIBE INFO ***

If you want to unsubscribe from the cygwin-announce mailing list, look
at the "List-Unsubscribe: " tag in the email header of this message.
Send email to the address specified there.  It will be in the format:

cygwin-announce-unsubscribe-you=yourdomain@cygwin.com

If you need more information on unsubscribing, start reading here:

http://sourceware.org/lists.html#unsubscribe-simple

Please read *all* of the information on unsubscribing that is
available starting at this URL.




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



Cygwin FAQ, incorrect sections 4.19, 4.20, 4.22, 4.23 with Cygwin 1.7.1+?

2011-06-27 Thread Devin Nate
Dear Cygwin users;

We're a long term user of cygwin in various ways, and I was very pleased to see 
in the Cygwin 1.7.1 release notes, and discussion in cygwin-developers, that 
the cygwin1.dll supports parallel installations of cygwin.

I know there are some cases where you can get into trouble, such as launching a 
first cygwin session from a cygwin install location, and having that call a 
cygwin tool located in a second cygwin location.

URLs:
http://sourceware.org/ml/cygwin-developers/2009-10/msg00113.html
http://cygwin.com/cygwin-ug-net/ov-new1.7.html

We went to use this feature in a recent GPL project, and I wanted to double 
check, and Cygwin FAQ sections 4.19, 4.20, 4.22, and 4.23 seem to contradict 
the announcements from the Cygwin 1.7.1 release.

Is there some clarity to this?

My guess is that Cygwin seeks to offer no support for third party apps that use 
cygwin1.dll, and only will work on items from the network installer setup.exe.

By contrast, everything else I've read says that it is completely by design 
that cygwin1.dll 1.7.1 and above can and should operate successfully with 
multiple parallel installs, including of the same or different versions of 
cygwin1.dll, so long as the parallel cygwin installs never meet. Additionally, 
software developers can reasonably safely place a copy of cygwin1.dll with 
their project.

For reference, what we're doing isn't all that exciting. GPL'd rsync installed 
on several hundred windows machines not under our control - we just want to 
make sure we don't interfere with anything the users may be doing already.

Thanks,
Devin Nate


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



Re: Strange cygpath behavior.

2011-06-27 Thread Peter Rosin
Den 2011-06-27 15:38 skrev Andrey Repin:
> Greetings, Peter Rosin!
> 
>> As you are apparently using the cmd "shell", the correct way to quote
>> arguments in order to preserve spaces etc, is to use double quotes
>> and escape all backslashes with an extra backslash.
> 
> Ok, please explain, how could I escape backslashes in, say, Explorer?
> It could only quote the string.

Search me.

> I can't even write my own conversion utility :/
> No amount of external conversion would help using diff or patch freely.

It's not the fault of diff or patch that *you* prefer broken crap that
*you* can't coerce into feeding the desired arguments. I'm sure it's
possible though.

Cheers,
Peter

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



Re: Strange cygpath behavior.

2011-06-27 Thread Andrey Repin
Greetings, Peter Rosin!

> As you are apparently using the cmd "shell", the correct way to quote
> arguments in order to preserve spaces etc, is to use double quotes
> and escape all backslashes with an extra backslash.

Ok, please explain, how could I escape backslashes in, say, Explorer?
It could only quote the string.
I can't even write my own conversion utility :/
No amount of external conversion would help using diff or patch freely.


--
WBR,
 Andrey Repin (anrdae...@freemail.ru) 27.06.2011, <15:39>

Sorry for my terrible english...


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