Re: [Mono-dev] What will happen if Dispose() hangs?

2015-01-27 Thread Greg Najda
Regarding the TcpClient timeouts, if you are setting the timeout before
connecting, it is ignored. That is a bug. See
https://bugzilla.xamarin.com/show_bug.cgi?id=25365. As a workaround you can
set the timeout after connecting.

On Mon, Jan 26, 2015 at 11:12 PM, Edward Ned Harvey (mono) 
edward.harvey.m...@clevertrove.com wrote:

  When I call SslStream.Dispose(), the thread simply hangs indefinitely.
 (Well, I didn't wait forever; only a few minutes, which is longer than the
 underlying TcpClient timeout periods.)



 Obviously this is a bug, but my question is - What if I simply ignore the
 problem, and don't call Dispose, and just drop reference to the SslStream?
 Presumably the GC will call finalizer, which will then call Dispose().
 Will the GC thread also hang?  Will it put mono into a bad state?  What
 could possibly go wrong?



 Possibly related - I observed that when I set TcpClient read  write
 timeouts, they seem to have no effect.  Set to 6 (60sec), wait a few
 minutes on a Read or Write (actually BeginRead/EndRead, or synchronous
 Write) and nothing happens.  Thread just blocks indefinitely or the end
 method is never called.

 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] FastCGI Performance

2014-04-06 Thread Greg Najda
Someone looked into Mono FastCGI performance a couple months ago and made a
series of blog posts:

http://forcedtoadmin.blogspot.com/2013/11/servicestack-performance-in-mono-p1.html
http://forcedtoadmin.blogspot.com/2013/11/servicestack-performance-in-mono-p2.html
http://forcedtoadmin.blogspot.com/2013/12/servicestack-performance-in-mono-p3.html

He ended up writing a replacement for the Mono FastCGI server instead of
changing it because of architectural changes:
https://github.com/xplicit/HyperFastCgi


On Sun, Apr 6, 2014 at 7:43 PM, Giuliano Barberi gbarb...@aotaonline.comwrote:

 After looking at some of the Mono web benchmarks (
 http://www.techempower.com/benchmarks/#section=data-r8hw=i7test=jsons=2p=13ydj4-0
  )
 I got very curious as to why FastCGI performance was so much lower than
 when using a C# libevent implementation.

 If you look at nancy-libevent2 vs nancy benchmarks, the only difference is
 a C# wrapper around libevent ( https://github.com/kekekeks/evhttp-sharp )
 vs Mono FastCGI. Since Mono uses epoll underneath which is what libevent
 uses afaik, I would not expect there to be such a gap in performance.

 I'm curious whether performance of FastCGI is being looked at or if this
 is expected. Mono when using FastCGI benchmarks almost at the bottom of the
 list when compared to many other technologies (
 http://www.techempower.com/benchmarks/#section=data-r8hw=i7test=json ).
 I've done a bit of analysis on where the bottleneck is and everything I've
 found is pointing to the FastCGI implementation.

 Regards
 --
 Giuliano Barberi

 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] problem compiling mono

2013-08-02 Thread Greg Najda
*** You need Mono version 2.4 or better installed to build MCS
*** Check mono README for information on how to bootstrap a Mono
installation.

As the message says, you need a working mono installed.


On Wed, Jul 31, 2013 at 6:03 PM, alex ninos ninosa...@yahoo.com wrote:

 Hi
 I get this message what should i do?

 make[2]: Entering directory `/home/alexandros/mono/runtime'
 if test -w /home/alexandros/mono/mcs; then :; else chmod -R +w
 /home/alexandros/mono/mcs; fi
 cd /home/alexandros/mono/mcs  make --no-print-directory -s
 NO_DIR_CHECK=1 PROFILES=' net_2_0 net_3_5 net_4_0 net_4_5  ' CC='gcc'
 all-profiles
 *** PLATFORM is not defined.
 *** Assuming PLATFORM is 'linux'.
 make[6]: gmcs: Command not found
 make[6]: *** [build/deps/basic-profile-check.exe] Error 127
 *** The compiler 'gmcs' doesn't appear to be usable.
 *** You need Mono version 2.4 or better installed to build MCS
 *** Check mono README for information on how to bootstrap a Mono
 installation.
 make[5]: *** [do-profile-check] Error 1
 make[4]: *** [profile-do--basic--all] Error 2
 make[3]: *** [profiles-do--all] Error 2
 make[2]: *** [all-local] Error 2
 make[2]: Leaving directory `/home/alexandros/mono/runtime'
 make[1]: *** [all-recursive] Error 1
 make[1]: Leaving directory `/home/alexandros/mono'
 make: *** [all] Error 2

 thanks a lot

 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Recommended software setup to develop and contribute C# code to Mono

2013-07-30 Thread Greg Najda
I get the same problem with MonoDevelop after installing from source to
/usr/local. MonoDevelop 2.8.6.3 on KUbuntu 12.04.

I'm also interested in hearing about development workflow for
mscorlib.because I'm tackling some bugs myself.


On Sun, Jul 28, 2013 at 1:27 AM, jean-michel.perr...@csiro.au wrote:

  Hi,

 I have bumped in a bug with time zone date-time conversion (
 https://r2clr.codeplex.com/workitem/65 but I am pretty sure the
 underlying issue is e.g. https://bugzilla.xamarin.com/show_bug.cgi?id=1849
 )

 I'd like to see whether I can contribute a fix. I am used to test-driven
 development with VS2012, and would like to emulate this with
 MonoDevelop/Xamarin Studio on a Debian or Win box. I assume I cannot debug
 a Mono mscorlib with VS2012 but correct me otherwise.

 Rather than figure out a set up I'd welcome advice from core Mono
 contributors: how do you work, what's your software setup?

 I gave a couple hours trying/googling/doc reading but with limited results.
 - Got the latest 'master' source from GIT. autogen, make, sudo make
 install, fine. However an easy option to build and install the debug
 symbols along is not obvious.
 - Usually as soon as I compile/install mono from source, even a very
 recent (Debian unstable) MonoDevelop stops working (see below). Prior
 attempts to compile MD from source did not work out.

 $ monodevelop
 System.TypeInitializationException: An exception was thrown by the type
 initializer for Mono.Unix.Native.Syscall ---
 System.EntryPointNotFoundException: Mono_Posix_Syscall_get_at_fdcwd

 Thanks in advance.


 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Unix console implementation

2013-07-30 Thread Greg Najda
I'm attempting to fix https://bugzilla.xamarin.com/show_bug.cgi?id=12552and
https://bugzilla.xamarin.com/show_bug.cgi?id=12551. Console, ConsoleDriver,
and the IConsoleDriver implementations make the flawed assumption that is
console is a simple boolean value when standard input or standard output
can be redirected to a file or a pipeline independently of each other.

I got rid of NullConsoleDriver and made WindowsConsoleDriver do the right
thing depending on whether or not standard input or standard output is a
console. This was straightforward; For example,
WindowsConsoleDriver.KeyAvailable does the usual if standard input is a
console, if not it returns false (which should throw an exception instead
as per
http://msdn.microsoft.com/en-us/library/system.console.keyavailable.aspxbut
that's for another commit...).

I am running into some trouble doing the same with TermInfoDriver. It looks
like mono disables the normal echoing of console input characters to the
console and handles that logic itself, echoing input characters to standard
output, instead letting the terminal take care of it. This is quite
problematic if standard output is redirected but standard input is not.

Why does this matter? Here's one use case. A program wants to read in a
password from the user. If standard input is a console, the program uses
ReadKey(true) to read the password without displaying it on the screen.
Consider what happens if the user wants to run output through tee. What
should happen is that everything is the same except that any output the
program itself outputted should go to the file specified to tee. For
example:

greg@Kubuntu:~$ echo abc  test.txt
greg@Kubuntu:~$ sudo cat test.txt | tee sudo_output.txt
[sudo] password for greg:
abc

As another example

greg@Kubuntu:~$ cat -  test_cat_output.txt

Even though standard output is redirected to a file, standard input is
still echoed to the console.

Taking over the job of echoing input characters instead of letting the
terminal handle it strikes me as an odd design. What's the reason for this
approach? Is there a solution to the problem of allowing one of
input/output to be redirected and letting the one using the console to
still function correctly that does not involve rewriting large parts of
TermInfoDriver and associated internal calls?

- Greg
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Help required on starting to contribute for mono for a newcomer

2013-07-11 Thread Greg Najda
What specific problems are you running into?


On Wed, Jul 10, 2013 at 9:02 PM, Aravindh Sridharan yashvi...@gmail.comwrote:

 Hi All,
   I have been a .NET developer for the past 3 years and I am in
 complete love with C#. I was very interested in mono from the beginning but
 only now got a chance to get started. I have a MBP and I am trying to
 compile mono in it. But I am not. I am facing lots of difficulties. Googled
 it, but was not able to find and concrete steps. Mono's page on compile for
 mac didnt help as well. So if I anyone is gracious enough to let me know
 the complete steps on getting started or if some one can point me to such a
 resource, I would be thankful. Also do point me on how to get started in
 contributing to mono.


 Thanks
 Aravindh.S

 ___
 Mono-devel-list mailing list
 Mono-devel-list@lists.ximian.com
 http://lists.ximian.com/mailman/listinfo/mono-devel-list


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Compiling on Windows

2013-07-10 Thread Greg Najda
It's not a simple matter of prepending \\?\ to every path. What if the path
already has \\?\ or one of those other strange Windows prefixes or is a UNC
path, which normally begins \\server\share but would have to become
\\?\UNC\server\share? You also can't use \\?\ with relative paths. Forward
slashes don't get converted to backslashes in \\?\ paths. There are a
multitude of issues that would need to be dealt with, some of them covered
here:
http://blogs.msdn.com/b/bclteam/archive/2007/02/13/long-paths-in-net-part-1-of-3-kim-hamilton.aspx

Windows path rules are kind of insane.


On Wed, Jul 10, 2013 at 9:49 AM, Jonathan Chambers jonc...@gmail.comwrote:

 Or maybe we could try long path support on WIndows.


 http://msdn.microsoft.com/en-us/library/windows/desktop/aa364944(v=vs.85).aspx

 In the ANSI version of this function, the name is limited to *MAX_PATH* 
 characters.
 To extend this limit to 32,767 wide characters, call the Unicode version of
 the function and prepend \\?\ to the path. For more information, see File
 Names, Paths, and 
 Namespaceshttp://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx
 .

 Thanks,
 Jonathan


 On Tue, Jul 9, 2013 at 11:22 PM, Greg Najda gregna...@gmail.com wrote:

 Following up on this, I finally got it figured it. The length of my
 checkout directory is too long at 49 chars, which is not really that long.
 I did some digging and found that Mono uses GetFileAttributes to check for
 the existence of a file in Windows. So I made a test program in C that
 takes a path on the command line and calls GetFileAttributes on it.

 #include Windows.h
 #include stdio.h

 int _tmain(int argc, _TCHAR* argv[])
 {
 DWORD res = GetFileAttributes(argv[1]);

 if(res != -1)
 {
 printf(GetFileAttributes: Found.\r\n);
 }
 else
 {
 printf(GetFileAttributes: Not found. Error code: %d\r\n,
 GetLastError());
 }

 return 0;
 }

 I added two files to
 external\entityframework\src\EntityFramework.SqlServer\Resources\System\Data\SqlClient:
 System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaMapping123.msl
 and
 System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaMapping1234.msl.


 C:\Users\Greg\Documents\Programming\mono_nul_fork\mcs\class\EntityFramework.SqlServerMonoFileExistsTest.exe
 ../../../external/entityframework/src/EntityFramework.SqlServer/Resources/System/Data/SqlClient/System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaMapping123.msl
 GetFileAttributes: Found.

 C:\Users\Greg\Documents\Programming\mono_nul_fork\mcs\class\EntityFramework.SqlServerMonoFileExistsTest.exe
 ../../../external/entityframework/src/EntityFramework.SqlServer/Resources/System/Data/SqlClient/System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaMapping1234.msl
 GetFileAttributes: Not found. Error code: 3

 ../../../external/entityframework/src/EntityFramework.SqlServer/Resources/System/Data/SqlClient/System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaMapping1234.msl
 is only 174 chars, much lower than MAX_PATH of 260 chars. What gives?

 Well, if you put the current directory before the relative path so it
 becomes
 C:\Users\Greg\Documents\Programming\mono_nul_fork\mcs\class\EntityFramework.SqlServer\../../../external/entityframework/src/EntityFramework.SqlServer/Resources/System/Data/SqlClient/System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaMapping1234.msl,
 then that is exactly 260 chars. With null terminator, it's 261 and over
 MAX_PATH. I guess Windows prepends the current directory before checking
 path length.

 Interestingly, .NET's File.Exists does not encounter the same problem. If
 I run mcs using .NET instead of Mono, the particular compile step that
 failed works. I wonder what sorcery it does?

 Perhaps add a suggestion to
 http://www.mono-project.com/Compiling_Mono_on_Windows to keep the path
 length of your checkout directory extremely short.

 https://wrench.mono-project.com/Wrench/index.aspx?show_all=true shows
 the Windows build as still broken so this was all with the last revision
 that Wrench shows to successfully build.


 On Thu, Jun 27, 2013 at 10:24 PM, Greg Najda gregna...@gmail.com wrote:

 I'm new to git. I'm using Atlassian SourceTree as a git gui. I'm pretty
 sure it updates submodules after cloning. I ran git submodule update
 anyway, which produced no output, and then tried building again and got
 the same error.

 After pulling the latest changes I get a new error earlier in the build:

 make[3]: *** No rule to make target `mono-sgen', needed by `mono'.  Stop.


 On Wed, Jun 26, 2013 at 11:12 AM, Rodrigo Kumpera kump...@gmail.comwrote:

 Update your git submodules.


 On Tue, Jun 25, 2013 at 10:05 PM, Greg Najda gregna...@gmail.comwrote:

 I'm running into some trouble compiling Mono on Windows. Here are the
 steps I followed:

 1. Do a git clone (using 1b5ef4d3df262c66f58596bda152db5f4c34741c,
 Add a GSHAREDVT_REG_IREG return marshalling

Re: [Mono-dev] Compiling on Windows

2013-07-09 Thread Greg Najda
Following up on this, I finally got it figured it. The length of my
checkout directory is too long at 49 chars, which is not really that long.
I did some digging and found that Mono uses GetFileAttributes to check for
the existence of a file in Windows. So I made a test program in C that
takes a path on the command line and calls GetFileAttributes on it.

#include Windows.h
#include stdio.h

int _tmain(int argc, _TCHAR* argv[])
{
DWORD res = GetFileAttributes(argv[1]);

if(res != -1)
{
printf(GetFileAttributes: Found.\r\n);
}
else
{
printf(GetFileAttributes: Not found. Error code: %d\r\n,
GetLastError());
}

return 0;
}

I added two files to
external\entityframework\src\EntityFramework.SqlServer\Resources\System\Data\SqlClient:
System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaMapping123.msl
and
System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaMapping1234.msl.


C:\Users\Greg\Documents\Programming\mono_nul_fork\mcs\class\EntityFramework.SqlServerMonoFileExistsTest.exe
../../../external/entityframework/src/EntityFramework.SqlServer/Resources/System/Data/SqlClient/System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaMapping123.msl
GetFileAttributes: Found.

C:\Users\Greg\Documents\Programming\mono_nul_fork\mcs\class\EntityFramework.SqlServerMonoFileExistsTest.exe
../../../external/entityframework/src/EntityFramework.SqlServer/Resources/System/Data/SqlClient/System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaMapping1234.msl
GetFileAttributes: Not found. Error code: 3

../../../external/entityframework/src/EntityFramework.SqlServer/Resources/System/Data/SqlClient/System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaMapping1234.msl
is only 174 chars, much lower than MAX_PATH of 260 chars. What gives?

Well, if you put the current directory before the relative path so it
becomes
C:\Users\Greg\Documents\Programming\mono_nul_fork\mcs\class\EntityFramework.SqlServer\../../../external/entityframework/src/EntityFramework.SqlServer/Resources/System/Data/SqlClient/System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaMapping1234.msl,
then that is exactly 260 chars. With null terminator, it's 261 and over
MAX_PATH. I guess Windows prepends the current directory before checking
path length.

Interestingly, .NET's File.Exists does not encounter the same problem. If I
run mcs using .NET instead of Mono, the particular compile step that failed
works. I wonder what sorcery it does?

Perhaps add a suggestion to
http://www.mono-project.com/Compiling_Mono_on_Windows to keep the path
length of your checkout directory extremely short.

https://wrench.mono-project.com/Wrench/index.aspx?show_all=true shows the
Windows build as still broken so this was all with the last revision that
Wrench shows to successfully build.


On Thu, Jun 27, 2013 at 10:24 PM, Greg Najda gregna...@gmail.com wrote:

 I'm new to git. I'm using Atlassian SourceTree as a git gui. I'm pretty
 sure it updates submodules after cloning. I ran git submodule update
 anyway, which produced no output, and then tried building again and got
 the same error.

 After pulling the latest changes I get a new error earlier in the build:

 make[3]: *** No rule to make target `mono-sgen', needed by `mono'.  Stop.


 On Wed, Jun 26, 2013 at 11:12 AM, Rodrigo Kumpera kump...@gmail.comwrote:

 Update your git submodules.


 On Tue, Jun 25, 2013 at 10:05 PM, Greg Najda gregna...@gmail.com wrote:

 I'm running into some trouble compiling Mono on Windows. Here are the
 steps I followed:

 1. Do a git clone (using 1b5ef4d3df262c66f58596bda152db5f4c34741c, Add
 a GSHAREDVT_REG_IREG return marshalling convention on ARM., 2013-06-23)
 2. Install cygwin. Include packages: autoconf, automake, bison,
 gcc-core, gcc-g++, libtool, make, python, wget, zip (all from
 http://www.mono-project.com/Compiling_Mono_on_Windows), mingw-pthreads
 (get an error with mono/utils/atomic.c without it because it #includes
 pthread.h), gettext, gettext-devel (seem to be missing msgfmt without the
 devel package)
 3. Start cygwin
 4. Copy checkout to /home/Greg/mono
 5. Run:

 export PATH=$PATH:/cygdrive/c/Program Files (x86)/Mono-3.0.10/bin
 cd mono
 ./autogen.sh --prefix=/usr/local 21 | tee
 ~/autogen_output_with_stderror.txt
 make V=1 21 | tee ~/make_output_with_stderror_verbose.txt


 I did see this in the autogen output. Is it anything to be concerned
 about?

 checking winternl.h usability... no
 checking winternl.h presence... yes
 configure: WARNING: winternl.h: present but cannot be compiled
 configure: WARNING: winternl.h: check for missing prerequisite
 headers?
 configure: WARNING: winternl.h: see the Autoconf documentation
 configure: WARNING: winternl.h: section Present But Cannot Be
 Compiled
 configure: WARNING: winternl.h: proceeding with the compiler's result
 configure: WARNING

Re: [Mono-dev] Compiling on Windows

2013-06-27 Thread Greg Najda
I'm new to git. I'm using Atlassian SourceTree as a git gui. I'm pretty
sure it updates submodules after cloning. I ran git submodule update
anyway, which produced no output, and then tried building again and got the
same error.

After pulling the latest changes I get a new error earlier in the build:

make[3]: *** No rule to make target `mono-sgen', needed by `mono'.  Stop.


On Wed, Jun 26, 2013 at 11:12 AM, Rodrigo Kumpera kump...@gmail.com wrote:

 Update your git submodules.


 On Tue, Jun 25, 2013 at 10:05 PM, Greg Najda gregna...@gmail.com wrote:

 I'm running into some trouble compiling Mono on Windows. Here are the
 steps I followed:

 1. Do a git clone (using 1b5ef4d3df262c66f58596bda152db5f4c34741c, Add a
 GSHAREDVT_REG_IREG return marshalling convention on ARM., 2013-06-23)
 2. Install cygwin. Include packages: autoconf, automake, bison, gcc-core,
 gcc-g++, libtool, make, python, wget, zip (all from
 http://www.mono-project.com/Compiling_Mono_on_Windows), mingw-pthreads
 (get an error with mono/utils/atomic.c without it because it #includes
 pthread.h), gettext, gettext-devel (seem to be missing msgfmt without the
 devel package)
 3. Start cygwin
 4. Copy checkout to /home/Greg/mono
 5. Run:

 export PATH=$PATH:/cygdrive/c/Program Files (x86)/Mono-3.0.10/bin
 cd mono
 ./autogen.sh --prefix=/usr/local 21 | tee
 ~/autogen_output_with_stderror.txt
 make V=1 21 | tee ~/make_output_with_stderror_verbose.txt


 I did see this in the autogen output. Is it anything to be concerned
 about?

 checking winternl.h usability... no
 checking winternl.h presence... yes
 configure: WARNING: winternl.h: present but cannot be compiled
 configure: WARNING: winternl.h: check for missing prerequisite
 headers?
 configure: WARNING: winternl.h: see the Autoconf documentation
 configure: WARNING: winternl.h: section Present But Cannot Be
 Compiled
 configure: WARNING: winternl.h: proceeding with the compiler's result
 configure: WARNING: ##
 
 ##
 configure: WARNING: ## Report this to
 http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono ##
 configure: WARNING: ##
 
 ##




 Here are the last several lines of output from make:

 make[7]: Entering directory
 `/home/Greg/mono/mcs/class/EntityFramework.SqlServer'
 make all-local
 make[8]: Entering directory
 `/home/Greg/mono/mcs/class/EntityFramework.SqlServer'
 Converting EntityFramework.SqlServer.dll.sources to
 ../../build/deps/net_4_5_EntityFramework.SqlServer.dll.response ...
 MONO_PATH=./../../class/lib/net_4_5;$MONO_PATH
 /home/Greg/mono/runtime/mono-wrapper  ./../../class/lib/net_4_5/resgen.exe
 ../../../external/entityframework/src/EntityFramework.SqlServer/Properties/Resources.SqlServer.resx
 System.Data.Entity.SqlServer.Properties.Resources.SqlServer.resources
 Read in 44 resources from
 'C:\Users\Greg\Documents\Programs\cygwin\home\Greg\mono\external\entityframework\src\EntityFramework.SqlServer\Properties\Resources.SqlServer.resx'
 Writing resource file...  Done.
 MONO_PATH=./../../class/lib/build;$MONO_PATH
 /home/Greg/mono/runtime/mono-wrapper  ./../../class/lib/build/mcs.exe
 /codepage:65001  /nologo -d:NET_1_1 -d:NET_2_0 -d:NET_3_0 -d:NET_3_5
 -d:NET_4_0 -d:NET_4_5 -nowarn:1699 -nostdlib -lib:./../../class/lib/net_4_5
 -r:mscorlib.dll /debug+ /debug:full -optimize  /noconfig -r:System.dll
 -r:System.Xml.dll -r:System.Core.dll -r:EntityFramework.dll
 -r:System.Data.dll  -keyfile:../ecma.pub -delaysign -warn:1
 -resource:System.Data.Entity.SqlServer.Properties.Resources.SqlServer.resources
 -resource:../../../external/entityframework/src/EntityFramework.SqlServer/Resources/System/Data/SqlClient/System.Data.Resources.SqlClient.SqlProviderServices.ProviderManifest.xml
 -resource:../../../external/entityframework/src/EntityFramework.SqlServer/Resources/System/Data/SqlClient/System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaDefinition.ssdl
 -resource:../../../external/entityframework/src/EntityFramework.SqlServer/Resources/System/Data/SqlClient/System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaDefinition_Sql8.ssdl
 -resource:../../../external/entityframework/src/EntityFramework.SqlServer/Resources/System/Data/SqlClient/System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaDefinitionVersion3.ssdl
 -resource:../../../external/entityframework/src/EntityFramework.SqlServer/Resources/System/Data/SqlClient/System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaDefinitionVersion3_Sql8.ssdl
 -resource:../../../external/entityframework/src/EntityFramework.SqlServer/Resources/System/Data/SqlClient/System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaMapping.msl
 -resource:../../../external/entityframework/src/EntityFramework.SqlServer/Resources/System/Data/SqlClient

[Mono-dev] Compiling on Windows

2013-06-25 Thread Greg Najda
I'm running into some trouble compiling Mono on Windows. Here are the steps
I followed:

1. Do a git clone (using 1b5ef4d3df262c66f58596bda152db5f4c34741c, Add a
GSHAREDVT_REG_IREG return marshalling convention on ARM., 2013-06-23)
2. Install cygwin. Include packages: autoconf, automake, bison, gcc-core,
gcc-g++, libtool, make, python, wget, zip (all from
http://www.mono-project.com/Compiling_Mono_on_Windows), mingw-pthreads (get
an error with mono/utils/atomic.c without it because it #includes
pthread.h), gettext, gettext-devel (seem to be missing msgfmt without the
devel package)
3. Start cygwin
4. Copy checkout to /home/Greg/mono
5. Run:

export PATH=$PATH:/cygdrive/c/Program Files (x86)/Mono-3.0.10/bin
cd mono
./autogen.sh --prefix=/usr/local 21 | tee
~/autogen_output_with_stderror.txt
make V=1 21 | tee ~/make_output_with_stderror_verbose.txt


I did see this in the autogen output. Is it anything to be concerned about?

checking winternl.h usability... no
checking winternl.h presence... yes
configure: WARNING: winternl.h: present but cannot be compiled
configure: WARNING: winternl.h: check for missing prerequisite headers?
configure: WARNING: winternl.h: see the Autoconf documentation
configure: WARNING: winternl.h: section Present But Cannot Be Compiled
configure: WARNING: winternl.h: proceeding with the compiler's result
configure: WARNING: ##

##
configure: WARNING: ## Report this to
http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono ##
configure: WARNING: ##

##




Here are the last several lines of output from make:

make[7]: Entering directory
`/home/Greg/mono/mcs/class/EntityFramework.SqlServer'
make all-local
make[8]: Entering directory
`/home/Greg/mono/mcs/class/EntityFramework.SqlServer'
Converting EntityFramework.SqlServer.dll.sources to
../../build/deps/net_4_5_EntityFramework.SqlServer.dll.response ...
MONO_PATH=./../../class/lib/net_4_5;$MONO_PATH
/home/Greg/mono/runtime/mono-wrapper  ./../../class/lib/net_4_5/resgen.exe
../../../external/entityframework/src/EntityFramework.SqlServer/Properties/Resources.SqlServer.resx
System.Data.Entity.SqlServer.Properties.Resources.SqlServer.resources
Read in 44 resources from
'C:\Users\Greg\Documents\Programs\cygwin\home\Greg\mono\external\entityframework\src\EntityFramework.SqlServer\Properties\Resources.SqlServer.resx'
Writing resource file...  Done.
MONO_PATH=./../../class/lib/build;$MONO_PATH
/home/Greg/mono/runtime/mono-wrapper  ./../../class/lib/build/mcs.exe
/codepage:65001  /nologo -d:NET_1_1 -d:NET_2_0 -d:NET_3_0 -d:NET_3_5
-d:NET_4_0 -d:NET_4_5 -nowarn:1699 -nostdlib -lib:./../../class/lib/net_4_5
-r:mscorlib.dll /debug+ /debug:full -optimize  /noconfig -r:System.dll
-r:System.Xml.dll -r:System.Core.dll -r:EntityFramework.dll
-r:System.Data.dll  -keyfile:../ecma.pub -delaysign -warn:1
-resource:System.Data.Entity.SqlServer.Properties.Resources.SqlServer.resources
-resource:../../../external/entityframework/src/EntityFramework.SqlServer/Resources/System/Data/SqlClient/System.Data.Resources.SqlClient.SqlProviderServices.ProviderManifest.xml
-resource:../../../external/entityframework/src/EntityFramework.SqlServer/Resources/System/Data/SqlClient/System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaDefinition.ssdl
-resource:../../../external/entityframework/src/EntityFramework.SqlServer/Resources/System/Data/SqlClient/System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaDefinition_Sql8.ssdl
-resource:../../../external/entityframework/src/EntityFramework.SqlServer/Resources/System/Data/SqlClient/System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaDefinitionVersion3.ssdl
-resource:../../../external/entityframework/src/EntityFramework.SqlServer/Resources/System/Data/SqlClient/System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaDefinitionVersion3_Sql8.ssdl
-resource:../../../external/entityframework/src/EntityFramework.SqlServer/Resources/System/Data/SqlClient/System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaMapping.msl
-resource:../../../external/entityframework/src/EntityFramework.SqlServer/Resources/System/Data/SqlClient/System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaMappingVersion3.msl
-target:library -out:../../class/lib/net_4_5/EntityFramework.SqlServer.dll
@./../../build/deps/net_4_5_EntityFramework.SqlServer.dll.response
error CS1566: Error reading resource file
`../../../external/entityframework/src/EntityFramework.SqlServer/Resources/System/Data/SqlClient/System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaDefinition.ssdl'
error CS1566: Error reading resource file
`../../../external/entityframework/src/EntityFramework.SqlServer/Resources/System/Data/SqlClient/System.Data.Resources.SqlClient.SqlProviderServices.StoreSchemaDefinition_Sql8.ssdl'
error CS1566: Error reading 

Re: [Mono-dev] sub-process invocation on posix

2013-06-10 Thread Greg Najda
The Windows 
CreateProcesshttp://msdn.microsoft.com/en-us/library/windows/desktop/ms682425%28v=vs.85%29.aspxfunction
takes command line arguments as a single string. This detail
leaked into the .NET Process class. Windows programs with a
WinMainhttp://msdn.microsoft.com/en-us/library/windows/desktop/ms633559%28v=vs.85%29.aspxentry
point typically break that argument string into arguments using
CommandLineToArgvWhttp://msdn.microsoft.com/en-us/library/windows/desktop/bb776391%28v=vs.85%29.aspx.
With a regular main entry point, the C runtime does that for you.
Unfortunately there is no ArgvToCommandLine function, which is a shame
because CommandLineToArgvW has pretty funky rules for quotes and
backslashes. See the docs for
CommandLineToArgvWhttp://msdn.microsoft.com/en-us/library/windows/desktop/bb776391%28v=vs.85%29.aspxand
Raymond Chen's blog
post http://blogs.msdn.com/b/oldnewthing/archive/2010/09/17/10063629.aspxfor
info. Simply enclosing in quotes and putting a backslash before quotes
and backslashes is not good enough for Windows.

I was curious about this myself a week or two ago because I had to pass
some dynamic arguments to a process so I dove into the Mono source. On
Windows Mono passes the argument string as is to CreateProcess. On Unix
platforms Mono uses the GNOME
g_shell_parse_argv()https://developer.gnome.org/glib/2.34/glib-Shell-related-Utilities.html#g-shell-parse-argvfunction
to convert the arg string into an argv before starting the process.

Feel free to use the following code taken from a personal project of
minehttps://bitbucket.org/LHCGreg/dbsc/src/c3cca47e6b190f7b6fad47c12d781e445e962acc/mydbsc/MySqlDbscEngine.cs?at=master.
It passes the unit tests I threw it.

private string QuoteCommandLineArg(string arg)
{
if (Environment.OSVersion.Platform == PlatformID.Unix ||
Environment.OSVersion.Platform == PlatformID.MacOSX)
{
return QuoteCommandLineArgUnix(arg);
}
else
{
return QuoteCommandLineArgWindows(arg);
}
}

internal static string QuoteCommandLineArgWindows(string arg)
{
// If a double quotation mark follows two or an even number of
backslashes,
// each proceeding backslash pair is replaced with one
backslash and the double quotation mark is removed.
// If a double quotation mark follows an odd number of
backslashes, including just one,
// each preceding pair is replaced with one backslash and the
remaining backslash is removed;
// however, in this case the double quotation mark is not
removed.
// -
http://msdn.microsoft.com/en-us/library/system.environment.getcommandlineargs.aspx
//
// Windows command line processing is funky

string escapedArg;
Regex backslashSequenceBeforeQuotes = new Regex(@(\\+));
// Double \ sequences before s, Replace  with \, double \
sequences at end
escapedArg = backslashSequenceBeforeQuotes.Replace(arg, (match)
= new string('\\', match.Groups[1].Length * 2) + \);
escapedArg = escapedArg.Replace(\, @\);
Regex backslashSequenceAtEnd = new Regex(@(\\+)$);
escapedArg = backslashSequenceAtEnd.Replace(escapedArg, (match)
= new string('\\', match.Groups[1].Length * 2));
// C:\blah\\\
// C:\blah\\\
escapedArg = \ + escapedArg + \;
return escapedArg;
}

internal static string QuoteCommandLineArgUnix(string arg)
{
// Mono uses the GNOME g_shell_parse_argv() function to convert
the arg string into an argv
// Just prepend  and \ with \ and enclose in quotes.
// Much simpler than Windows!

Regex backslashOrQuote = new Regex(@\\|);
return \ + backslashOrQuote.Replace(arg, (match) = @\ +
match.ToString()) + \;
}


Hope that helps.

- Greg


On Mon, Jun 10, 2013 at 3:46 PM, Ian Norton inor...@gmail.com wrote:

 I kind of already have a thing to do that, feels a bit icky though,
 especially as there must be some thing lower down that undoes the joined up
 string into a char** again. :)


 On 10 June 2013 16:06, Michael Hutchinson m.j.hutchin...@gmail.comwrote:

 FWIW, you actually just need to double quote each argument and escape
 double quotes so you can very easily write a helper to do this in a way
 that works on both Mono and .NET:

 static Process StartProcess (string name, params string[] args)
 {
 string a = null;
 if (args != null  args.Length  0)
 a = \ + string.Join (args.Select (s = s.Replace (\,
 \\\)).ToArray (), \ \) + \;
 return Process.Start (
 new ProcessStartInfo (name, a) {
 ShellExecute = false,
 }
 );
 }

 Obviously this could be done more efficiently with a StringBuilder.

 Apologies for any errors, I'm writing this on my phone...

 -