"igem install rake" raise an System.UnauthorizedAccessException (Windows 7)

Hello,

doing my first real test on Windows 7 - I installed the latest IronRuby
(using the MSI installer) and igem install rake issues the following
error:

ERROR: While executing gem … (SystemCallError)
unknown scenario - System.UnauthorizedAccessException, C:/Program
Files/IronRuby 0.9.3.0/lib/ironruby/gems, Create

My understanding is that it’s linked to the permissions in Windows 7.

If I manually create the gems folder and allow full control to the
current
user (not in administrator mode), then I get the following error:

ERROR: While executing gem … (ArgumentError)
Illegal characters in path.

Is there anyone currently running the MSI installed version of IronRuby
on
Windows 7 without these issues ?

thanks,

– Thibaut

move ironruby to a location without a space in the path like C:\ironruby

Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)

On Mon, Jan 25, 2010 at 11:56 AM, Thibaut Barrère
<[email protected]

move ironruby to a location without a space in the path like C:\ironruby

thanks - will try that. Is it worth filing a bug ?

– Thibaut

it’s a known issue that should be fixed in the next release, AFAIK

Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)

On Mon, Jan 25, 2010 at 1:58 PM, Thibaut Barrère

it’s a known issue that should be fixed in the next release, AFAIK

Thanks Ivan,

– Thibaut

Ivan, do you remember what the known issue is? I can’t remember seeing a
discussion about UnauthorizedAccessException. Just making sure that the
bug is really being tracked

From: [email protected]
[mailto:[email protected]] On Behalf Of Thibaut
Barrère
Sent: Monday, January 25, 2010 7:21 AM
To: [email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

it’s a known issue that should be fixed in the next release, AFAIK

Thanks Ivan,

– Thibaut

Program files is a protected location and contains a space in the path.
I
couldn’t find a workitem. But all the problems would be solved
by mimicking jruby and ruby’s way and just putting it in C:\ironruby.

This workitem is related though
http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=2969


Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)

Added a comment to the workitem…

From: [email protected]
[mailto:[email protected]] On Behalf Of Ivan Porto
Carrero
Sent: Monday, January 25, 2010 12:43 PM
To: [email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

Program files is a protected location and contains a space in the path.
I couldn’t find a workitem. But all the problems would be solved by
mimicking jruby and ruby’s way and just putting it in C:\ironruby.

This workitem is related though
http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=2969


Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)

On Mon, Jan 25, 2010 at 8:30 PM, Shri B.
<[email protected]mailto:[email protected]> wrote:
Ivan, do you remember what the known issue is? I can’t remember seeing a
discussion about UnauthorizedAccessException. Just making sure that the
bug is really being tracked

From:
[email protected]mailto:[email protected]
[mailto:[email protected]mailto:[email protected]]
On Behalf Of Thibaut Barrère
Sent: Monday, January 25, 2010 7:21 AM
To: [email protected]mailto:[email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

it’s a known issue that should be fixed in the next release, AFAIK

Thanks Ivan,

– Thibaut


Ironruby-core mailing list
[email protected]mailto:[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core

Btw, c:\ironruby will still need admin priviledges to install to, right?

Does the one-click installer make the gem folder writable to all users
(or atleast all Admin users)? What about on *nix? Without making the gem
folder writable, “igem install” will still fail. Making the folder
writable to all users is a security hole, and ideally RubyGems will
support a way to install to a per-user location, or elevate permission
otherwise. I believe you need to use “sudo gem install” on *nix.

From: Shri B.
Sent: Monday, January 25, 2010 1:42 PM
To: [email protected]
Subject: RE: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

Added a comment to the workitem…

From: [email protected]
[mailto:[email protected]] On Behalf Of Ivan Porto
Carrero
Sent: Monday, January 25, 2010 12:43 PM
To: [email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

Program files is a protected location and contains a space in the path.
I couldn’t find a workitem. But all the problems would be solved by
mimicking jruby and ruby’s way and just putting it in C:\ironruby.

This workitem is related though
http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=2969


Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)

On Mon, Jan 25, 2010 at 8:30 PM, Shri B.
<[email protected]mailto:[email protected]> wrote:
Ivan, do you remember what the known issue is? I can’t remember seeing a
discussion about UnauthorizedAccessException. Just making sure that the
bug is really being tracked

From:
[email protected]mailto:[email protected]
[mailto:[email protected]mailto:[email protected]]
On Behalf Of Thibaut Barrère
Sent: Monday, January 25, 2010 7:21 AM
To: [email protected]mailto:[email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

it’s a known issue that should be fixed in the next release, AFAIK

Thanks Ivan,

– Thibaut


Ironruby-core mailing list
[email protected]mailto:[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core

Jim and I were discussing the desired behavior, and it is a choice
between security and convenience.

has information on how Python is dealing with the admin issue. Packages
(the equivalent of gems) are installed to a per-user location. The
IronRuby equivalent would be that every user has to install his/her own
set of gems, and could be implemented by setting the GEM_PATH
environment variable for the user to point to something like
%USERPROFILE%. Any objection to this behavior?

From: [email protected]
[mailto:[email protected]] On Behalf Of Shri B.
Sent: Monday, January 25, 2010 1:55 PM
To: [email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

Btw, c:\ironruby will still need admin priviledges to install to, right?

Does the one-click installer make the gem folder writable to all users
(or atleast all Admin users)? What about on *nix? Without making the gem
folder writable, “igem install” will still fail. Making the folder
writable to all users is a security hole, and ideally RubyGems will
support a way to install to a per-user location, or elevate permission
otherwise. I believe you need to use “sudo gem install” on *nix.

From: Shri B.
Sent: Monday, January 25, 2010 1:42 PM
To: [email protected]
Subject: RE: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

Added a comment to the workitem…

From: [email protected]
[mailto:[email protected]] On Behalf Of Ivan Porto
Carrero
Sent: Monday, January 25, 2010 12:43 PM
To: [email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

Program files is a protected location and contains a space in the path.
I couldn’t find a workitem. But all the problems would be solved by
mimicking jruby and ruby’s way and just putting it in C:\ironruby.

This workitem is related though
http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=2969


Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)
On Mon, Jan 25, 2010 at 8:30 PM, Shri B.
<[email protected]mailto:[email protected]> wrote:
Ivan, do you remember what the known issue is? I can’t remember seeing a
discussion about UnauthorizedAccessException. Just making sure that the
bug is really being tracked

From:
[email protected]mailto:[email protected]
[mailto:[email protected]mailto:[email protected]]
On Behalf Of Thibaut Barrère
Sent: Monday, January 25, 2010 7:21 AM
To: [email protected]mailto:[email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

it’s a known issue that should be fixed in the next release, AFAIK

Thanks Ivan,

– Thibaut


Ironruby-core mailing list
[email protected]mailto:[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core

Ideally we would be setting GEM_PATH to somewhere in AppData.

JD

From: [email protected]
[mailto:[email protected]] On Behalf Of Shri B.
Sent: Monday, January 25, 2010 4:47 PM
To: [email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

Jim and I were discussing the desired behavior, and it is a choice
between security and convenience.

has information on how Python is dealing with the admin issue. Packages
(the equivalent of gems) are installed to a per-user location. The
IronRuby equivalent would be that every user has to install his/her own
set of gems, and could be implemented by setting the GEM_PATH
environment variable for the user to point to something like
%USERPROFILE%. Any objection to this behavior?

From: [email protected]
[mailto:[email protected]] On Behalf Of Shri B.
Sent: Monday, January 25, 2010 1:55 PM
To: [email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

Btw, c:\ironruby will still need admin priviledges to install to, right?

Does the one-click installer make the gem folder writable to all users
(or atleast all Admin users)? What about on *nix? Without making the gem
folder writable, “igem install” will still fail. Making the folder
writable to all users is a security hole, and ideally RubyGems will
support a way to install to a per-user location, or elevate permission
otherwise. I believe you need to use “sudo gem install” on *nix.

From: Shri B.
Sent: Monday, January 25, 2010 1:42 PM
To: [email protected]
Subject: RE: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

Added a comment to the workitem…

From: [email protected]
[mailto:[email protected]] On Behalf Of Ivan Porto
Carrero
Sent: Monday, January 25, 2010 12:43 PM
To: [email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

Program files is a protected location and contains a space in the path.
I couldn’t find a workitem. But all the problems would be solved by
mimicking jruby and ruby’s way and just putting it in C:\ironruby.

This workitem is related though
http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=2969


Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)
On Mon, Jan 25, 2010 at 8:30 PM, Shri B.
<[email protected]mailto:[email protected]> wrote:
Ivan, do you remember what the known issue is? I can’t remember seeing a
discussion about UnauthorizedAccessException. Just making sure that the
bug is really being tracked

From:
[email protected]mailto:[email protected]
[mailto:[email protected]mailto:[email protected]]
On Behalf Of Thibaut Barrère
Sent: Monday, January 25, 2010 7:21 AM
To: [email protected]mailto:[email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

it’s a known issue that should be fixed in the next release, AFAIK

Thanks Ivan,

– Thibaut


Ironruby-core mailing list
[email protected]mailto:[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core

Just realized that setting GEM_PATH will affect MRI too which would be a
problem. So there will have to be some other way to implement the
per-user IronRuby-specific location for gems. Assuming we can figure
this out, the question still is if the per-user gems model sounds good…

From: [email protected]
[mailto:[email protected]] On Behalf Of Shri B.
Sent: Monday, January 25, 2010 4:47 PM
To: [email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

Jim and I were discussing the desired behavior, and it is a choice
between security and convenience.

has information on how Python is dealing with the admin issue. Packages
(the equivalent of gems) are installed to a per-user location. The
IronRuby equivalent would be that every user has to install his/her own
set of gems, and could be implemented by setting the GEM_PATH
environment variable for the user to point to something like
%USERPROFILE%. Any objection to this behavior?

From: [email protected]
[mailto:[email protected]] On Behalf Of Shri B.
Sent: Monday, January 25, 2010 1:55 PM
To: [email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

Btw, c:\ironruby will still need admin priviledges to install to, right?

Does the one-click installer make the gem folder writable to all users
(or atleast all Admin users)? What about on *nix? Without making the gem
folder writable, “igem install” will still fail. Making the folder
writable to all users is a security hole, and ideally RubyGems will
support a way to install to a per-user location, or elevate permission
otherwise. I believe you need to use “sudo gem install” on *nix.

From: Shri B.
Sent: Monday, January 25, 2010 1:42 PM
To: [email protected]
Subject: RE: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

Added a comment to the workitem…

From: [email protected]
[mailto:[email protected]] On Behalf Of Ivan Porto
Carrero
Sent: Monday, January 25, 2010 12:43 PM
To: [email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

Program files is a protected location and contains a space in the path.
I couldn’t find a workitem. But all the problems would be solved by
mimicking jruby and ruby’s way and just putting it in C:\ironruby.

This workitem is related though
http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=2969


Met vriendelijke groeten - Best regards - Salutations
Ivan Porto C.
Blog: http://flanders.co.nz
Twitter: http://twitter.com/casualjim
Author of IronRuby in Action (http://manning.com/carrero)
On Mon, Jan 25, 2010 at 8:30 PM, Shri B.
<[email protected]mailto:[email protected]> wrote:
Ivan, do you remember what the known issue is? I can’t remember seeing a
discussion about UnauthorizedAccessException. Just making sure that the
bug is really being tracked

From:
[email protected]mailto:[email protected]
[mailto:[email protected]mailto:[email protected]]
On Behalf Of Thibaut Barrère
Sent: Monday, January 25, 2010 7:21 AM
To: [email protected]mailto:[email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

it’s a known issue that should be fixed in the next release, AFAIK

Thanks Ivan,

– Thibaut


Ironruby-core mailing list
[email protected]mailto:[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core

Per-user gems should not be the default. In RubyInstaller (mingw MRI), as well as MRI on Linux, and I believe OS X, system-wide gems are
the default. This, of course, would require elevation (sudo gem install xxx).

I believe per-user gems is now the default (it wasn’t in the past, but
if I’m right a rubygems update changed that behaviour. Maybe 1.3.0 -
http://rubyforge.org/forum/forum.php?forum_id=27728 => ‘RubyGems now
installs gems into ~/.gem if GEM_HOME is not writable. Use
–no-user-install command-line switch to disable this behavior.’).

Here’s what happens on my machine (OS X):

~$ gem list | grep less
~$ sudo gem list | grep less
~$ gem install less
(…)
~$ gem list | grep less
less (1.2.21)
~$ sudo gem list | grep less
(empty)

~$ gem -v
1.3.5
~$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.0.0]

– Thibaut

Yes, that occurred to me this morning. :wink:

So, runas /user:mymachine\administrator igem install foo for globals
gems,
right?


Will G.
http://hotgazpacho.org/

On Tue, Jan 26, 2010 at 4:16 AM, Thibaut Barrère

Per-user gems should not be the default. In RubyInstaller (mingw MRI),
as
well as MRI on Linux, and I believe OS X, system-wide gems are the
default.
This, of course, would require elevation (sudo gem install xxx).


Will G.
http://hotgazpacho.org/

I believe per-user gems is now the default
That’s right - now if you sudo install a system wide gem, if not, it
just creates a .gems in your home dir and installs there. Of course, the
local gems are only available to Ruby apps running as that user.

Cheers,
Sidu.

There are a couple of differences that would be apparent for this
proposed solution:

  1.  Runas /user…. Is much longer than sudo ;)
    
  2.  The normal installation directory is owned by TrustedInstaller 
    

and Admins have no rights by default. We wouldn’t have a supported way
to share gems at this time, since that does have security risks. Each
user would have to install their own gems, but (unsupported) you should
be able to move GEM_PATH (assuming we can figure out how to share
between IronRuby and Ruby) to a shared location and change permissions
on it.

JD

From: [email protected]
[mailto:[email protected]] On Behalf Of Will G.
Sent: Tuesday, January 26, 2010 9:03 AM
To: [email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

Yes, that occurred to me this morning. :wink:

So, runas /user:mymachine\administrator igem install foo for globals
gems, right?


Will G.
http://hotgazpacho.org/

On Tue, Jan 26, 2010 at 4:16 AM, Thibaut Barrère
<[email protected]mailto:[email protected]> wrote:

Per-user gems should not be the default. In RubyInstaller (mingw MRI), as well as MRI on Linux, and I believe OS X, system-wide gems are
the default. This, of course, would require elevation (sudo gem install xxx).
I believe per-user gems is now the default (it wasn’t in the past, but
if I’m right a rubygems update changed that behaviour. Maybe 1.3.0 -
http://rubyforge.org/forum/forum.php?forum_id=27728 => ‘RubyGems now
installs gems into ~/.gem if GEM_HOME is not writable. Use
–no-user-install command-line switch to disable this behavior.’).

Here’s what happens on my machine (OS X):

~$ gem list | grep less
~$ sudo gem list | grep less
~$ gem install less
(…)
~$ gem list | grep less
less (1.2.21)
~$ sudo gem list | grep less
(empty)

~$ gem -v
1.3.5
~$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.0.0]

– Thibaut


Ironruby-core mailing list
[email protected]mailto:[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core

Another way to simulate “sudo” is to use an elevated Command Prompt.
http://www.sevenforums.com/tutorials/11841-run-administrator.html tells
you how. If you are using the command prompt a lot, you only need to
deal with the UAC dialog box once when you open the elevated Command
Prompt. After that, all commands executed from the Command Prompt run
elevated.

Jim, from an elevated Command prompt, I was able to create a new file in
%ProgramFiles% using notepad, and did not get any UAC dialog box. This
would mean that “gem install” should also be able to install gems to
%ProgramFiles%. Not sure how this reconciles with your comment about
TrustedInstaller.

Thibaut, could you try using “igem install –user-install”? (I wonder if
IronRuby needs to catch the System.UnauthorizedAccessException exception
and raise a Ruby exception for RubyGems to do the right thing.)

Could you also separately try running from an elevated Command Prompt?

From: [email protected]
[mailto:[email protected]] On Behalf Of Jim D.
Sent: Tuesday, January 26, 2010 9:18 AM
To: [email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

There are a couple of differences that would be apparent for this
proposed solution:

  1.  Runas /user…. Is much longer than sudo ;)
    
  2.  The normal installation directory is owned by TrustedInstaller 
    

and Admins have no rights by default. We wouldn’t have a supported way
to share gems at this time, since that does have security risks. Each
user would have to install their own gems, but (unsupported) you should
be able to move GEM_PATH (assuming we can figure out how to share
between IronRuby and Ruby) to a shared location and change permissions
on it.

JD

From: [email protected]
[mailto:[email protected]] On Behalf Of Will G.
Sent: Tuesday, January 26, 2010 9:03 AM
To: [email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

Yes, that occurred to me this morning. :wink:

So, runas /user:mymachine\administrator igem install foo for globals
gems, right?


Will G.
http://hotgazpacho.org/
On Tue, Jan 26, 2010 at 4:16 AM, Thibaut Barrère
<[email protected]mailto:[email protected]> wrote:

Per-user gems should not be the default. In RubyInstaller (mingw MRI), as well as MRI on Linux, and I believe OS X, system-wide gems are
the default. This, of course, would require elevation (sudo gem install xxx).
I believe per-user gems is now the default (it wasn’t in the past, but
if I’m right a rubygems update changed that behaviour. Maybe 1.3.0 -
http://rubyforge.org/forum/forum.php?forum_id=27728 => ‘RubyGems now
installs gems into ~/.gem if GEM_HOME is not writable. Use
–no-user-install command-line switch to disable this behavior.’).

Here’s what happens on my machine (OS X):

~$ gem list | grep less
~$ sudo gem list | grep less
~$ gem install less
(…)
~$ gem list | grep less
less (1.2.21)
~$ sudo gem list | grep less
(empty)

~$ gem -v
1.3.5
~$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.0.0]

– Thibaut


Ironruby-core mailing list
[email protected]mailto:[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core

There indeed is a difference in behavior between IronRuby and MRI when
creating a file in %ProgramFiles% from a non-elevated process. MRI
silently writes to USERPROFILE. IronRuby raises Errno::EACCES. I have
opened http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=3685
to track this. I don’t see the System.UnauthorizedAccessException
though.

D:>ruby -e “File.open(‘c:/Program Files/foo.txt’, ‘w+’) {}”

D:>dir “c:\Program Files\foo.txt”
File Not Found

D:>dir “%USERPROFILE%\AppData\Local\VirtualStore\Program Files\foo.txt”
01/26/2010 11:39 AM 0 foo.txt
1 File(s) 0 bytes
0 Dir(s) 122,124,869,632 bytes free

D:>rbx -e “File.open(‘c:/Program Files/foo.txt’, ‘w+’) {}”
mscorlib:0:in `WinIOError’: Access to the path ‘c:\Program
Files\foo.txt’ is denied. (Errno::EACCES)

From: [email protected]
[mailto:[email protected]] On Behalf Of Shri B.
Sent: Tuesday, January 26, 2010 11:09 AM
To: [email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

Another way to simulate “sudo” is to use an elevated Command Prompt.
http://www.sevenforums.com/tutorials/11841-run-administrator.html tells
you how. If you are using the command prompt a lot, you only need to
deal with the UAC dialog box once when you open the elevated Command
Prompt. After that, all commands executed from the Command Prompt run
elevated.

Jim, from an elevated Command prompt, I was able to create a new file in
%ProgramFiles% using notepad, and did not get any UAC dialog box. This
would mean that “gem install” should also be able to install gems to
%ProgramFiles%. Not sure how this reconciles with your comment about
TrustedInstaller.

Thibaut, could you try using “igem install –user-install”? (I wonder if
IronRuby needs to catch the System.UnauthorizedAccessException exception
and raise a Ruby exception for RubyGems to do the right thing.)

Could you also separately try running from an elevated Command Prompt?

From: [email protected]
[mailto:[email protected]] On Behalf Of Jim D.
Sent: Tuesday, January 26, 2010 9:18 AM
To: [email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

There are a couple of differences that would be apparent for this
proposed solution:

  1.  Runas /user…. Is much longer than sudo ;)
    
  2.  The normal installation directory is owned by TrustedInstaller 
    

and Admins have no rights by default. We wouldn’t have a supported way
to share gems at this time, since that does have security risks. Each
user would have to install their own gems, but (unsupported) you should
be able to move GEM_PATH (assuming we can figure out how to share
between IronRuby and Ruby) to a shared location and change permissions
on it.

JD

From: [email protected]
[mailto:[email protected]] On Behalf Of Will G.
Sent: Tuesday, January 26, 2010 9:03 AM
To: [email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

Yes, that occurred to me this morning. :wink:

So, runas /user:mymachine\administrator igem install foo for globals
gems, right?


Will G.
http://hotgazpacho.org/
On Tue, Jan 26, 2010 at 4:16 AM, Thibaut Barrère
<[email protected]mailto:[email protected]> wrote:

Per-user gems should not be the default. In RubyInstaller (mingw MRI), as well as MRI on Linux, and I believe OS X, system-wide gems are
the default. This, of course, would require elevation (sudo gem install xxx).
I believe per-user gems is now the default (it wasn’t in the past, but
if I’m right a rubygems update changed that behaviour. Maybe 1.3.0 -
http://rubyforge.org/forum/forum.php?forum_id=27728 => ‘RubyGems now
installs gems into ~/.gem if GEM_HOME is not writable. Use
–no-user-install command-line switch to disable this behavior.’).

Here’s what happens on my machine (OS X):

~$ gem list | grep less
~$ sudo gem list | grep less
~$ gem install less
(…)
~$ gem list | grep less
less (1.2.21)
~$ sudo gem list | grep less
(empty)

~$ gem -v
1.3.5
~$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.0.0]

– Thibaut


Ironruby-core mailing list
[email protected]mailto:[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core

Hm, that’s interesting… MRI gets redirected to the virtual store but
IronRuby does not, I wonder if that is more of a .NET issue than a
IronRuby problem…

JD

From: [email protected]
[mailto:[email protected]] On Behalf Of Shri B.
Sent: Tuesday, January 26, 2010 11:44 AM
To: [email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

There indeed is a difference in behavior between IronRuby and MRI when
creating a file in %ProgramFiles% from a non-elevated process. MRI
silently writes to USERPROFILE. IronRuby raises Errno::EACCES. I have
opened http://ironruby.codeplex.com/WorkItem/View.aspx?WorkItemId=3685
to track this. I don’t see the System.UnauthorizedAccessException
though.

D:>ruby -e “File.open(‘c:/Program Files/foo.txt’, ‘w+’) {}”

D:>dir “c:\Program Files\foo.txt”
File Not Found

D:>dir “%USERPROFILE%\AppData\Local\VirtualStore\Program Files\foo.txt”
01/26/2010 11:39 AM 0 foo.txt
1 File(s) 0 bytes
0 Dir(s) 122,124,869,632 bytes free

D:>rbx -e “File.open(‘c:/Program Files/foo.txt’, ‘w+’) {}”
mscorlib:0:in `WinIOError’: Access to the path ‘c:\Program
Files\foo.txt’ is denied. (Errno::EACCES)

From: [email protected]
[mailto:[email protected]] On Behalf Of Shri B.
Sent: Tuesday, January 26, 2010 11:09 AM
To: [email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

Another way to simulate “sudo” is to use an elevated Command Prompt.
http://www.sevenforums.com/tutorials/11841-run-administrator.html tells
you how. If you are using the command prompt a lot, you only need to
deal with the UAC dialog box once when you open the elevated Command
Prompt. After that, all commands executed from the Command Prompt run
elevated.

Jim, from an elevated Command prompt, I was able to create a new file in
%ProgramFiles% using notepad, and did not get any UAC dialog box. This
would mean that “gem install” should also be able to install gems to
%ProgramFiles%. Not sure how this reconciles with your comment about
TrustedInstaller.

Thibaut, could you try using “igem install –user-install”? (I wonder if
IronRuby needs to catch the System.UnauthorizedAccessException exception
and raise a Ruby exception for RubyGems to do the right thing.)

Could you also separately try running from an elevated Command Prompt?

From: [email protected]
[mailto:[email protected]] On Behalf Of Jim D.
Sent: Tuesday, January 26, 2010 9:18 AM
To: [email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

There are a couple of differences that would be apparent for this
proposed solution:

  1.  Runas /user…. Is much longer than sudo ;)
    
  2.  The normal installation directory is owned by TrustedInstaller 
    

and Admins have no rights by default. We wouldn’t have a supported way
to share gems at this time, since that does have security risks. Each
user would have to install their own gems, but (unsupported) you should
be able to move GEM_PATH (assuming we can figure out how to share
between IronRuby and Ruby) to a shared location and change permissions
on it.

JD

From: [email protected]
[mailto:[email protected]] On Behalf Of Will G.
Sent: Tuesday, January 26, 2010 9:03 AM
To: [email protected]
Subject: Re: [Ironruby-core] “igem install rake” raise an
System.UnauthorizedAccessException (Windows 7)

Yes, that occurred to me this morning. :wink:

So, runas /user:mymachine\administrator igem install foo for globals
gems, right?


Will G.
http://hotgazpacho.org/
On Tue, Jan 26, 2010 at 4:16 AM, Thibaut Barrère
<[email protected]mailto:[email protected]> wrote:

Per-user gems should not be the default. In RubyInstaller (mingw MRI), as well as MRI on Linux, and I believe OS X, system-wide gems are
the default. This, of course, would require elevation (sudo gem install xxx).
I believe per-user gems is now the default (it wasn’t in the past, but
if I’m right a rubygems update changed that behaviour. Maybe 1.3.0 -
http://rubyforge.org/forum/forum.php?forum_id=27728 => ‘RubyGems now
installs gems into ~/.gem if GEM_HOME is not writable. Use
–no-user-install command-line switch to disable this behavior.’).

Here’s what happens on my machine (OS X):

~$ gem list | grep less
~$ sudo gem list | grep less
~$ gem install less
(…)
~$ gem list | grep less
less (1.2.21)
~$ sudo gem list | grep less
(empty)

~$ gem -v
1.3.5
~$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.0.0]

– Thibaut


Ironruby-core mailing list
[email protected]mailto:[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core