Umask vs umask

Hi,

Windows XP Home
Ruby 1.8.6 p114

I think I need another set of eyes on this one, because it looks to me like Ruby isn't picking up the changes I make with a custom umask, and vice versa.

require 'win32/api'
include Win32

S_IWRITE = 0000200
S_IREAD = 0000400

Umask = API.new('_umask', 'I', 'I', 'msvcrt')

# Mimic file.c
def umask(*args)
    omask = 0

    if args.length == 0
       omask = Umask.call(0)
       Umask.call(omask)
    elsif args.length == 1
       omask = Umask.call(args[0])
    else
       raise ArgumentError, "wrong number of arguments"
    end

    return omask
end

p umask(S_IREAD) # 0
p umask # 256 (ok)
p umask # 256 (double check, ok)

p File.umask # 0 - wtf?

Why isn't Ruby's File.umask picking up the change? I see the same thing if I set it with File.umask and try to read the changes with my own umask.

Regards,

Dan

Daniel Berger wrote:

Hi,

Windows XP Home
Ruby 1.8.6 p114

[snip]

Why isn't Ruby's File.umask picking up the change? I see the same thing
if I set it with File.umask and try to read the changes with my own umask.

Could that be because Windows is not a *NIX?

- --
Phillip Gawlowski
Twitter: twitter.com/cynicalryan

~ - You know you've been hacking too long when...
...you can't sleep any more, because you're stuck in the garbage
collector and it keeps dumping with Illegal Instruction.

Hi,

···

----- Original Message -----
From: "Daniel Berger" <djberg96@gmail.com>
To: "ruby-talk ML" <ruby-talk@ruby-lang.org>
Sent: Sunday, April 13, 2008 9:15 PM
Subject: umask vs umask

Hi,

Windows XP Home
Ruby 1.8.6 p114

I think I need another set of eyes on this one, because it looks to me
like Ruby isn't picking up the changes I make with a custom umask, and
vice versa.

require 'win32/api'
include Win32

S_IWRITE = 0000200
S_IREAD = 0000400

Umask = API.new('_umask', 'I', 'I', 'msvcrt')

# Mimic file.c
def umask(*args)
   omask = 0

   if args.length == 0
      omask = Umask.call(0)
      Umask.call(omask)
   elsif args.length == 1
      omask = Umask.call(args[0])
   else
      raise ArgumentError, "wrong number of arguments"
   end

   return omask
end

p umask(S_IREAD) # 0
p umask # 256 (ok)
p umask # 256 (double check, ok)

p File.umask # 0 - wtf?

Why isn't Ruby's File.umask picking up the change? I see the same thing
if I set it with File.umask and try to read the changes with my own umask.

In my Windows XP Home & Pro, with ruby 1.8.6 p111,
the File.umask works fine.

Regards,

Park Heesob

I noticed that it works as expected when I use the one click installer
but not when I use a Ruby built with VC++ 8.

Are you seeing the same thing?

Regards,

Dan

···

On Apr 13, 7:43 am, "Park Heesob" <phasi...@hotmail.com> wrote:

Hi,

----- Original Message -----
From: "Daniel Berger" <djber...@gmail.com>
To: "ruby-talk ML" <ruby-t...@ruby-lang.org>
Sent: Sunday, April 13, 2008 9:15 PM
Subject: umask vs umask

> Hi,

> Windows XP Home
> Ruby 1.8.6 p114

> I think I need another set of eyes on this one, because it looks to me
> like Ruby isn't picking up the changes I make with a custom umask, and
> vice versa.

> require 'win32/api'
> include Win32

> S_IWRITE = 0000200
> S_IREAD = 0000400

> Umask = API.new('_umask', 'I', 'I', 'msvcrt')

> # Mimic file.c
> def umask(*args)
> omask = 0

> if args.length == 0
> omask = Umask.call(0)
> Umask.call(omask)
> elsif args.length == 1
> omask = Umask.call(args[0])
> else
> raise ArgumentError, "wrong number of arguments"
> end

> return omask
> end

> p umask(S_IREAD) # 0
> p umask # 256 (ok)
> p umask # 256 (double check, ok)

> p File.umask # 0 - wtf?

> Why isn't Ruby's File.umask picking up the change? I see the same thing
> if I set it with File.umask and try to read the changes with my own umask.

In my Windows XP Home & Pro, with ruby 1.8.6 p111,
the File.umask works fine.

Hi,

Daniel Berger wrote:

> Hi,

> � � � omask = Umask.call(0)
> p umask(S_IREAD) # 0
> p umask � � � � �# 256 (ok)
> p umask � � � � �# 256 (double check, ok)

> p File.umask � � # 0 - wtf?

> Why isn't Ruby's File.umask picking up the change? I see the same thing
> if I set it with File.umask and try to read the changes with my own umask.

In my Windows XP Home & Pro, with ruby 1.8.6 p111,
the File.umask works fine.

I noticed that it works as expected when I use the one click installer
but not when I use a Ruby built with VC++ 8.

Are you seeing the same thing?

Yes, I tested with VC++ 9.
It fails as same as your test.
I guess "msvcrt" is valid for VC++ 6.
The situation became more complex since VC++ 8.

Refer to http://msdn2.microsoft.com/en-us/library/abx4dbyh(VS.80).aspx

You should modify the line

Umask = API.new('_umask', 'I', 'I', 'msvcrt')

to

Umask = API.new('_umask', 'I', 'I', 'msvcr80')

It requires Microsoft Visual C++ 2005 SP1 Redistributable Package (x86)
http://www.microsoft.com/downloads/details.aspx?FamilyID=200B2FD9-AE1A-4A14-984D-389C36F85647

Regards,

Park Heesob

···

On Apr 13, 7:43�am, "Park Heesob" <phasi...@hotmail.com> wrote:

--
Posted via http://www.ruby-forum.com/\.

When I try to link against msvcr80 I get:

umask_test.rb:4:in `initialize': LoadLibrary() function failed for
'msvcr80': A dynamic link library (DLL) initialization routine failed.
(Win32::API::Error)
        from umask_test.rb:4:in `new'
        from umask_test.rb:4

The first line of a build shows the options being used:

        cl -W3 -nologo -MD -O2b2xty- -DRUBY_EXPORT -I. -I. -I./
missing -D_CRT_SECURE_NO
_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -c -Tcarray.c

Do I need to use a different build switch?

The download link you mentioned suggests that I only need that patch
if I don't already have Visual C++ installed. But, I do have it
installed.

I'm afraid that even after reading the first article I'm still not
sure what I'm supposed to do to make this work properly.

Regards,

Dan

···

On Apr 13, 11:45 pm, Heesob Park <pha...@gmail.com> wrote:

Hi,

Daniel Berger wrote:
> On Apr 13, 7:43�am, "Park Heesob" <phasi...@hotmail.com> wrote:
>> > Hi,

>> > � � � omask = Umask.call(0)
>> > p umask(S_IREAD) # 0
>> > p umask � � � � �# 256 (ok)
>> > p umask � � � � �# 256 (double check, ok)

>> > p File.umask � � # 0 - wtf?

>> > Why isn't Ruby's File.umask picking up the change? I see the same thing
>> > if I set it with File.umask and try to read the changes with my own umask.

>> In my Windows XP Home & Pro, with ruby 1.8.6 p111,
>> the File.umask works fine.

> I noticed that it works as expected when I use the one click installer
> but not when I use a Ruby built with VC++ 8.

> Are you seeing the same thing?

Yes, I tested with VC++ 9.
It fails as same as your test.
I guess "msvcrt" is valid for VC++ 6.
The situation became more complex since VC++ 8.

Refer tohttp://msdn2.microsoft.com/en-us/library/abx4dbyh(VS.80).aspx

You should modify the line

Umask = API.new('_umask', 'I', 'I', 'msvcrt')

to

Umask = API.new('_umask', 'I', 'I', 'msvcr80')

It requires Microsoft Visual C++ 2005 SP1 Redistributable Package (x86)http://www.microsoft.com/downloads/details.aspx?FamilyID=200B2FD9-AE1\.\.\.

Hi,

Date: Tue, 15 Apr 2008 04:14:15 +0900> From: djberg96@gmail.com> Subject: Re: umask vs umask> To: ruby-talk@ruby-lang.org> > On Apr 13, 11:45 pm, Heesob Park <pha...@gmail.com> wrote:> > Hi,> > > Daniel Berger wrote:> > > On Apr 13, 7:43�am, "Park Heesob" <phasi...@hotmail.com> wrote:> > >> > Hi,> >> > >> > � � � omask = Umask.call(0)> > >> > p umask(S_IREAD) # 0> > >> > p umask � � � � �# 256 (ok)> > >> > p umask � � � � �# 256 (double check, ok)> >> > >> > p File.umask � � # 0 - wtf?> >> > >> > Why isn't Ruby's File.umask picking up the change? I see the same thing> > >> > if I set it with File.umask and try to read the changes with my own umask.> >> > >> In my Windows XP Home & Pro, with ruby 1.8.6 p111,> > >> the File.umask works fine.> >> > > I noticed that it works as expected when I use the one click installer> > > but not when I use a Ruby built with VC++ 8.> >> > > Are you seeing the same thing?> >> > Yes, I tested with VC++ 9.> > It fails as same as your test.> > I guess "msvcrt" is valid for VC++ 6.> > The situation became more complex since VC++ 8.> >> > Refer tohttp://msdn2.microsoft.com/en-us/library/abx4dbyh(VS.80).aspx> >> > You should modify the line> >> > Umask = API.new('_umask', 'I', 'I', 'msvcrt')> >> > to> >> > Umask = API.new('_umask', 'I', 'I', 'msvcr80')> >> > It requires Microsoft Visual C++ 2005 SP1 Redistributable Package (x86)http://www.microsoft.com/downloads/details.aspx?FamilyID=200B2FD9-AE1\.\.\.&gt; > When I try to link against msvcr80 I get:> > umask_test.rb:4:in `initialize': LoadLibrary() function failed for> 'msvcr80': A dynamic link library (DLL) initialization routine failed.> (Win32::API::Error)> from umask_test.rb:4:in `new'> from umask_test.rb:4> > The first line of a build shows the options being used:> > cl -W3 -nologo -MD -O2b2xty- -DRUBY_EXPORT -I. -I. -I./> missing -D_CRT_SECURE_NO> _DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -c -Tcarray.c> > Do I need to use a different build switch?> > The download link you mentioned suggests that I only need that patch> if I don't already have Visual C++ installed. But, I do have it> installed.> > I'm afraid that even after reading the first article I'm still not> sure what I'm supposed to do to make this work properly.>

First copy "msvcr80.dll" and "Microsoft.VC80.CRT.manifest" to the folder where ruby.exe runs.

And make "ruby.exe.manifest" in the the folder where ruby.exe runs with the following content:

<?xml version='1.0' encoding='UTF-8' standalone='yes'?> <assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'> <dependency> <dependentAssembly> <assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' /> </dependentAssembly> </dependency> </assembly>

Although there may be an easy way, this will work for you.
Regards,

Park Heesob

···

_________________________________________________________________
Explore the seven wonders of the world

I gave this a shot, copying msvcr80.dll and
Microsoft.VC80.CRT.manifest from C:\Program Files\Microsoft Visual
Studio 8\VC\redist\x86\Microsoft.VC80.CRT into my CONFIG['bindir']
directory, and created the ruby.exe.manifest as you suggested.

Unfortunately, that still didn't work for me. I also just tried
copying the Microsoft.VC80.CRT.manifest to ruby.exe.manifest, but that
didn't work either.

I'm not really sure where to go from here.

Regards,

Dan

···

On Apr 14, 7:11 pm, Park Heesob <phasi...@hotmail.com> wrote:

Hi,

> Date: Tue, 15 Apr 2008 04:14:15 +0900> From: djber...@gmail.com> Subject: Re: umask vs umask> To: ruby-t...@ruby-lang.org> > On Apr 13, 11:45 pm, Heesob Park <pha...@gmail.com> wrote:> > Hi,> > > Daniel Berger wrote:> > > On Apr 13, 7:43�am, "Park Heesob" <phasi...@hotmail.com> wrote:> > >> > Hi,> >> > >> > � � � omask = Umask.call(0)> > >> > p umask(S_IREAD) # 0> > >> > p umask � � � � �# 256 (ok)> > >> > p umask � � � � �# 256 (double check, ok)> >> > >> > p File.umask � � # 0 - wtf?> >> > >> > Why isn't Ruby's File.umask picking up the change? I see the same thing> > >> > if I set it with File.umask and try to read the changes with my own umask.> >> > >> In my Windows XP Home & Pro, with ruby 1.8.6 p111,> > >> the File.umask works fine.> >> > > I noticed that it works as expected when I use the one click installer> > > but not when I use a Ruby built with VC++ 8.> >> > > Are you seeing the same thing?> >> > Yes, I tested with VC++ 9.> > It fails as same as your test.> > I guess "msvcrt" is valid for VC++ 6.> > The situation became more complex since VC++ 8.> >> > Refer tohttp://msdn2.microsoft.com/en-us/library/abx4dbyh(VS.80).aspx> >> > You should modify the line> >> > Umask = API.new('_umask', 'I', 'I', 'msvcrt')> >> > to> >> > Umask = API.new('_umask', 'I', 'I', 'msvcr80')> >> > It requires Microsoft Visual C++ 2005 SP1 Redistributable Package (x86)http://www.microsoft.com/downloads/details.aspx?FamilyID=200B2FD9-AE1\.\.\.&gt; > When I try to link against msvcr80 I get:> > umask_test.rb:4:in `initialize': LoadLibrary() function failed for> 'msvcr80': A dynamic link library (DLL) initialization routine failed.> (Win32::API::Error)> from umask_test.rb:4:in `new'> from umask_test.rb:4> > The first line of a build shows the options being used:> > cl -W3 -nologo -MD -O2b2xty- -DRUBY_EXPORT -I. -I. -I./> missing -D_CRT_SECURE_NO> _DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -c -Tcarray.c> > Do I need to use a different build switch?> > The download link you mentioned suggests that I only need that patch> if I don't already have Visual C++ installed. But, I do have it> installed.> > I'm afraid that even after reading the first article I'm still not> sure what I'm supposed to do to make this work properly.>

First copy "msvcr80.dll" and "Microsoft.VC80.CRT.manifest" to the folder where ruby.exe runs.

And make "ruby.exe.manifest" in the the folder where ruby.exe runs with the following content:

<?xml version='1.0' encoding='UTF-8' standalone='yes'?> <assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'> <dependency> <dependentAssembly> <assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' /> </dependentAssembly> </dependency> </assembly>

Hi,

Daniel Berger wrote:

···

On Apr 14, 7:11 pm, Park Heesob <phasi...@hotmail.com> wrote:

Hi,

First copy "msvcr80.dll" and "Microsoft.VC80.CRT.manifest" to the folder where ruby.exe runs.

And make "ruby.exe.manifest" in the the folder where ruby.exe runs with the following content:

<?xml version='1.0' encoding='UTF-8' standalone='yes'?> <assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'> <dependency> <dependentAssembly> <assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' /> </dependentAssembly> </dependency> </assembly>

I gave this a shot, copying msvcr80.dll and
Microsoft.VC80.CRT.manifest from C:\Program Files\Microsoft Visual
Studio 8\VC\redist\x86\Microsoft.VC80.CRT into my CONFIG['bindir']
directory, and created the ruby.exe.manifest as you suggested.

Unfortunately, that still didn't work for me. I also just tried
copying the Microsoft.VC80.CRT.manifest to ruby.exe.manifest, but that
didn't work either.

I'm not really sure where to go from here.

The version # '8.0.50608.0' in the ruby.exe.manifest must be same to the
verision # in your Microsoft.VC80.CRT.manifest file.

Regards,

Park Heesob
--
Posted via http://www.ruby-forum.com/\.

I checked that, as well as the public key token. Heres my
Microsoft.VC80.CRT.manifest, just in case:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright © 1981-2001 Microsoft Corporation -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
    <noInheritable/>
    <assemblyIdentity
        type="win32"
        name="Microsoft.VC80.CRT"
        version="8.0.50608.0"
        processorArchitecture="x86"
        publicKeyToken="1fc8b3b9a1e18e3b"
    />
    <file name="msvcr80.dll"/>
    <file name="msvcp80.dll"/>
    <file name="msvcm80.dll"/>
</assembly>

I'm not sure what the problem is. But, a more pressing issue is how
the build scripts should be altered so that either this happens
automatically, or so that it's not necessary (if possible).

Regards,

Dan

···

On Apr 15, 9:29 pm, Heesob Park <pha...@gmail.com> wrote:

Hi,

Daniel Berger wrote:
> On Apr 14, 7:11 pm, Park Heesob <phasi...@hotmail.com> wrote:
>> Hi,

>> First copy "msvcr80.dll" and "Microsoft.VC80.CRT.manifest" to the folder where ruby.exe runs.

>> And make "ruby.exe.manifest" in the the folder where ruby.exe runs with the following content:

>> <?xml version='1.0' encoding='UTF-8' standalone='yes'?> <assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'> <dependency> <dependentAssembly> <assemblyIdentity type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' /> </dependentAssembly> </dependency> </assembly>

> I gave this a shot, copying msvcr80.dll and
> Microsoft.VC80.CRT.manifest from C:\Program Files\Microsoft Visual
> Studio 8\VC\redist\x86\Microsoft.VC80.CRT into my CONFIG['bindir']
> directory, and created the ruby.exe.manifest as you suggested.

> Unfortunately, that still didn't work for me. I also just tried
> copying the Microsoft.VC80.CRT.manifest to ruby.exe.manifest, but that
> didn't work either.

> I'm not really sure where to go from here.

The version # '8.0.50608.0' in the ruby.exe.manifest must be same to the
verision # in your Microsoft.VC80.CRT.manifest file.

Hi,

Daniel Berger wrote:

>> And make "ruby.exe.manifest" in the the folder where ruby.exe runs with the following content:
> didn't work either.

> I'm not really sure where to go from here.

The version # '8.0.50608.0' in the ruby.exe.manifest must be same to the
verision # in your Microsoft.VC80.CRT.manifest file.

I checked that, as well as the public key token. Heres my
Microsoft.VC80.CRT.manifest, just in case:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright � 1981-2001 Microsoft Corporation -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
    <noInheritable/>
    <assemblyIdentity
        type="win32"
        name="Microsoft.VC80.CRT"
        version="8.0.50608.0"
        processorArchitecture="x86"
        publicKeyToken="1fc8b3b9a1e18e3b"
    />
    <file name="msvcr80.dll"/>
    <file name="msvcp80.dll"/>
    <file name="msvcm80.dll"/>
</assembly>

I'm not sure what the problem is. But, a more pressing issue is how
the build scripts should be altered so that either this happens
automatically, or so that it's not necessary (if possible).

As I tested with msvcr90.dll on VC++ 9.0 compiled ruby,
I cannot confirm your problem.

Try google for msvcr80.dll problem .

Here is some links:

Regards,

Park Heesob

···

On Apr 15, 9:29 pm, Heesob Park <pha...@gmail.com> wrote:

--
Posted via http://www.ruby-forum.com/\.