From: Park Heesob Date: 2008-04-13T22:43:30+09:00 Subject: Re: umask vs umask Hi, ----- Original Message ----- From: "Daniel Berger" To: "ruby-talk ML" 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