From djberg96 at gmail.com Sat Aug 4 09:20:44 2007 From: djberg96 at gmail.com (Daniel Berger) Date: Sat, 04 Aug 2007 07:20:44 -0600 Subject: [Win32utils-devel] Need some help with pure Ruby win32-changenotify Message-ID: <46B47D2C.50608@gmail.com> Hi all, I know it's deprecated, but people seem to still be using win32-changenotify, so I thought I'd see if I could make it pure Ruby. Also, I thought it would be a good opportunity to test passing a custom Win32::Event object. I'm mostly done I think, but I'm having trouble unraveling the FILE_NOTIFY_INFORMATION struct buffer. Please check out the latest lib/win32/changenotify.rb from CVS and take a look at both the custom wait method and the get_file_action private method. The notification is clearly getting picked up, but I'm just not unraveling the struct properly. Here's a little sample program you can use to test: require 'win32/changenotify' include Win32 filter = ChangeNotify::FILE_NAME | ChangeNotify::DIR_NAME cn = ChangeNotify.new("C:\\", true, filter) cn.wait(15){ |x| p x } while true Then, just make sure to modify some file within the 15 second wait period. Thanks, Dan From noreply at rubyforge.org Sat Aug 4 08:38:23 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sat, 4 Aug 2007 08:38:23 -0400 (EDT) Subject: [Win32utils-devel] [ win32utils-Support Requests-12080 ] How would one add these packages as a dependency to a cross-platform gem? Message-ID: <20070804123823.F080EA970003@rubyforge.org> Support Requests item #12080, was opened at 2007-07-07 19:02 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=412&aid=12080&group_id=85 Category: Install Problem (example) Group: None Status: Open Resolution: None Priority: 3 Submitted By: Luke Bayes (lukebayes) Assigned to: Nobody (None) Summary: How would one add these packages as a dependency to a cross-platform gem? Initial Comment: I am building a ruby application that is expected to work across all supported platforms (mac/win/linux). Since my application needs to download and install myriad other external applications, I have made extensive use of the fork and open3 features - which forced me to use the win32-open3 implementations from you guys (I'm immensely grateful for your hard work btw). Now I'm trying to distribute my application as a rubygem, but when I add win32-open3 as a dependency, I'm afraid users on all of the other platforms are going to get prompted to install it - and subsequently fail the installation. When I try to install locally on OS X with the dependency activated, it complains and fails. Do you folks know how to distribute gems that depend on your packages only for windows users? Here's my project by the way - it's coming along nicely: http://code.google.com/p/projectsprouts ---------------------------------------------------------------------- >Comment By: Daniel Berger (djberg96) Date: 2007-08-04 05:38 Message: I think there are two approaches you can use. One is to create a separate gem for MS Windows. The other thing you could do is set the gem.platform conditionally within the gem spec itself. For example: spec = Gem::Specification.new do |gem| ... if RUBY_PLATFORM.match('mswin') spec.add_dependency("win32-open3") end end Does that help? Dan ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=412&aid=12080&group_id=85 From phasis at gmail.com Sun Aug 5 05:36:45 2007 From: phasis at gmail.com (Heesob Park) Date: Sun, 5 Aug 2007 18:36:45 +0900 Subject: [Win32utils-devel] Need some help with pure Ruby win32-changenotify In-Reply-To: <46B47D2C.50608@gmail.com> References: <46B47D2C.50608@gmail.com> Message-ID: Hi, 2007/8/4, Daniel Berger : > Hi all, > > I know it's deprecated, but people seem to still be using > win32-changenotify, so I thought I'd see if I could make it pure Ruby. > Also, I thought it would be a good opportunity to test passing a custom > Win32::Event object. > > I'm mostly done I think, but I'm having trouble unraveling the > FILE_NOTIFY_INFORMATION struct buffer. Please check out the latest > lib/win32/changenotify.rb from CVS and take a look at both the custom > wait method and the get_file_action private method. > > The notification is clearly getting picked up, but I'm just not > unraveling the struct properly. > > Here's a little sample program you can use to test: > > require 'win32/changenotify' > include Win32 > > filter = ChangeNotify::FILE_NAME | ChangeNotify::DIR_NAME > cn = ChangeNotify.new("C:\\", true, filter) > cn.wait(15){ |x| > p x > } while true > > Then, just make sure to modify some file within the 15 second wait period. > > Thanks, > > Dan You may overlooked the API document that says the FileName field is a variable-length field. Here is working version of get_file_action: def get_file_action(fni) array = [] while true break if fni.nil? || fni[0,4].unpack('L')[0] == 0 int_action = fni[4,4].unpack('L')[0] str_action = 'unknown' case int_action when FILE_ACTION_ADDED str_action = 'added' when FILE_ACTION_REMOVED str_action = 'removed' when FILE_ACTION_MODIFIED str_action = 'modified' when FILE_ACTION_RENAMED_OLD_NAME str_action = 'renamed old name' when FILE_ACTION_RENAMED_NEW_NAME str_action = 'renamed new name' end len = fni[8,4].unpack('L').first buf = fni[12,len] file = wide_to_multi(buf) struct = ChangeNotifyStruct.new(str_action, file) array.push(struct) fni = fni[fni[0,4].unpack('L').first, -1] # Next offset end array end Regards, Park Heesob -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20070805/c95798f4/attachment.html From djberg96 at gmail.com Sun Aug 5 14:51:30 2007 From: djberg96 at gmail.com (Daniel Berger) Date: Sun, 5 Aug 2007 12:51:30 -0600 Subject: [Win32utils-devel] Need some help with pure Ruby win32-changenotify In-Reply-To: References: <46B47D2C.50608@gmail.com> Message-ID: <6037b70c0708051151j5457ae0m191221b213a5ab97@mail.gmail.com> Hi again, Yep, forgot about the variable length, thanks. I've committed your changes. I also increased the buffer to 64k. The problem now seems to be that it detects an event, but the NextEntryOffset is 0. The result is that I see an empty array yielded back most of the time when an event occurs. The C version works fine. Here's a simple script I'm using for testing: Thread.new{ loop { sleep 0.1 } } # So ctrl-c works (might take 10 seconds) filter = ChangeNotify::FILE_NAME | ChangeNotify::DIR_NAME cn = ChangeNotify.new("C:\\", true, filter) cn.wait(10){ |x| p x } while true Any ideas? Thanks, Dan On 8/5/07, Heesob Park wrote: > Hi, > > > 2007/8/4, Daniel Berger : > > > Hi all, > > > > I know it's deprecated, but people seem to still be using > > win32-changenotify, so I thought I'd see if I could make it pure Ruby. > > Also, I thought it would be a good opportunity to test passing a custom > > Win32::Event object. > > > > I'm mostly done I think, but I'm having trouble unraveling the > > FILE_NOTIFY_INFORMATION struct buffer. Please check out the latest > > lib/win32/changenotify.rb from CVS and take a look at both the custom > > wait method and the get_file_action private method. > > > > The notification is clearly getting picked up, but I'm just not > > unraveling the struct properly. > > > > Here's a little sample program you can use to test: > > > > require 'win32/changenotify' > > include Win32 > > > > filter = ChangeNotify::FILE_NAME | ChangeNotify::DIR_NAME > > cn = ChangeNotify.new("C:\\", true, filter) > > cn.wait(15){ |x| > > p x > > } while true > > > > Then, just make sure to modify some file within the 15 second wait period. > > > > Thanks, > > > > Dan > > > You may overlooked the API document that says the FileName field is a > variable-length field. > > Here is working version of get_file_action: > > def get_file_action(fni) > array = [] > while true > break if fni.nil? || fni[0,4].unpack('L')[0] == 0 > int_action = fni[4,4].unpack('L')[0] > str_action = 'unknown' > case int_action > when FILE_ACTION_ADDED > str_action = 'added' > when FILE_ACTION_REMOVED > str_action = 'removed' > when FILE_ACTION_MODIFIED > str_action = 'modified' > when FILE_ACTION_RENAMED_OLD_NAME > str_action = 'renamed old name' > when FILE_ACTION_RENAMED_NEW_NAME > str_action = 'renamed new name' > end > len = fni[8,4].unpack('L').first > buf = fni[12,len] > file = wide_to_multi(buf) > struct = ChangeNotifyStruct.new(str_action, file) > array.push(struct) > fni = fni[fni[0,4].unpack('L').first, -1] # Next offset > end > > array > end > > Regards, > > Park Heesob > > _______________________________________________ > win32utils-devel mailing list > win32utils-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/win32utils-devel > From djberg96 at gmail.com Sun Aug 5 15:34:52 2007 From: djberg96 at gmail.com (Daniel Berger) Date: Sun, 5 Aug 2007 13:34:52 -0600 Subject: [Win32utils-devel] Need some help with pure Ruby win32-changenotify In-Reply-To: <6037b70c0708051151j5457ae0m191221b213a5ab97@mail.gmail.com> References: <46B47D2C.50608@gmail.com> <6037b70c0708051151j5457ae0m191221b213a5ab97@mail.gmail.com> Message-ID: <6037b70c0708051234s454e580w1dc3473ae2349b2a@mail.gmail.com> Nevermind. The break condition needs to be moved to the end of the loop. But, I think there's another issue. Researching further.... Dan On 8/5/07, Daniel Berger wrote: > Hi again, > > Yep, forgot about the variable length, thanks. I've committed your > changes. I also increased the buffer to 64k. > > The problem now seems to be that it detects an event, but the > NextEntryOffset is 0. The result is that I see an empty array yielded > back most of the time when an event occurs. The C version works fine. > > Here's a simple script I'm using for testing: > > Thread.new{ loop { sleep 0.1 } } # So ctrl-c works (might take 10 seconds) > > filter = ChangeNotify::FILE_NAME | ChangeNotify::DIR_NAME > cn = ChangeNotify.new("C:\\", true, filter) > cn.wait(10){ |x| > p x > } while true > > Any ideas? > > Thanks, > > Dan > > On 8/5/07, Heesob Park wrote: > > Hi, > > > > > > 2007/8/4, Daniel Berger : > > > > > Hi all, > > > > > > I know it's deprecated, but people seem to still be using > > > win32-changenotify, so I thought I'd see if I could make it pure Ruby. > > > Also, I thought it would be a good opportunity to test passing a custom > > > Win32::Event object. > > > > > > I'm mostly done I think, but I'm having trouble unraveling the > > > FILE_NOTIFY_INFORMATION struct buffer. Please check out the latest > > > lib/win32/changenotify.rb from CVS and take a look at both the custom > > > wait method and the get_file_action private method. > > > > > > The notification is clearly getting picked up, but I'm just not > > > unraveling the struct properly. > > > > > > Here's a little sample program you can use to test: > > > > > > require 'win32/changenotify' > > > include Win32 > > > > > > filter = ChangeNotify::FILE_NAME | ChangeNotify::DIR_NAME > > > cn = ChangeNotify.new("C:\\", true, filter) > > > cn.wait(15){ |x| > > > p x > > > } while true > > > > > > Then, just make sure to modify some file within the 15 second wait period. > > > > > > Thanks, > > > > > > Dan > > > > > > You may overlooked the API document that says the FileName field is a > > variable-length field. > > > > Here is working version of get_file_action: > > > > def get_file_action(fni) > > array = [] > > while true > > break if fni.nil? || fni[0,4].unpack('L')[0] == 0 > > int_action = fni[4,4].unpack('L')[0] > > str_action = 'unknown' > > case int_action > > when FILE_ACTION_ADDED > > str_action = 'added' > > when FILE_ACTION_REMOVED > > str_action = 'removed' > > when FILE_ACTION_MODIFIED > > str_action = 'modified' > > when FILE_ACTION_RENAMED_OLD_NAME > > str_action = 'renamed old name' > > when FILE_ACTION_RENAMED_NEW_NAME > > str_action = 'renamed new name' > > end > > len = fni[8,4].unpack('L').first > > buf = fni[12,len] > > file = wide_to_multi(buf) > > struct = ChangeNotifyStruct.new(str_action, file) > > array.push(struct) > > fni = fni[fni[0,4].unpack('L').first, -1] # Next offset > > end > > > > array > > end > > > > Regards, > > > > Park Heesob > > > > _______________________________________________ > > win32utils-devel mailing list > > win32utils-devel at rubyforge.org > > http://rubyforge.org/mailman/listinfo/win32utils-devel > > > From djberg96 at gmail.com Sun Aug 5 16:09:37 2007 From: djberg96 at gmail.com (Daniel Berger) Date: Sun, 5 Aug 2007 14:09:37 -0600 Subject: [Win32utils-devel] Need some help with pure Ruby win32-changenotify In-Reply-To: <6037b70c0708051234s454e580w1dc3473ae2349b2a@mail.gmail.com> References: <46B47D2C.50608@gmail.com> <6037b70c0708051151j5457ae0m191221b213a5ab97@mail.gmail.com> <6037b70c0708051234s454e580w1dc3473ae2349b2a@mail.gmail.com> Message-ID: <6037b70c0708051309o5233a645oedee55554d0de785@mail.gmail.com> Ok, solved the remaining issues. I had to move the CloseHandle call in the wait method above the yield/return. Also, I had to increase the buffer size for the final string name. Now I'm wondering if I should automatically prepend the @path to the file name in the final struct. We could use File.expand_path for relative paths. What do you think? Thanks, Dan On 8/5/07, Daniel Berger wrote: > Nevermind. The break condition needs to be moved to the end of the > loop. But, I think there's another issue. Researching further.... > > Dan > > On 8/5/07, Daniel Berger wrote: > > Hi again, > > > > Yep, forgot about the variable length, thanks. I've committed your > > changes. I also increased the buffer to 64k. > > > > The problem now seems to be that it detects an event, but the > > NextEntryOffset is 0. The result is that I see an empty array yielded > > back most of the time when an event occurs. The C version works fine. > > > > Here's a simple script I'm using for testing: > > > > Thread.new{ loop { sleep 0.1 } } # So ctrl-c works (might take 10 seconds) > > > > filter = ChangeNotify::FILE_NAME | ChangeNotify::DIR_NAME > > cn = ChangeNotify.new("C:\\", true, filter) > > cn.wait(10){ |x| > > p x > > } while true > > > > Any ideas? > > > > Thanks, > > > > Dan > > > > On 8/5/07, Heesob Park wrote: > > > Hi, > > > > > > > > > 2007/8/4, Daniel Berger : > > > > > > > Hi all, > > > > > > > > I know it's deprecated, but people seem to still be using > > > > win32-changenotify, so I thought I'd see if I could make it pure Ruby. > > > > Also, I thought it would be a good opportunity to test passing a custom > > > > Win32::Event object. > > > > > > > > I'm mostly done I think, but I'm having trouble unraveling the > > > > FILE_NOTIFY_INFORMATION struct buffer. Please check out the latest > > > > lib/win32/changenotify.rb from CVS and take a look at both the custom > > > > wait method and the get_file_action private method. > > > > > > > > The notification is clearly getting picked up, but I'm just not > > > > unraveling the struct properly. > > > > > > > > Here's a little sample program you can use to test: > > > > > > > > require 'win32/changenotify' > > > > include Win32 > > > > > > > > filter = ChangeNotify::FILE_NAME | ChangeNotify::DIR_NAME > > > > cn = ChangeNotify.new("C:\\", true, filter) > > > > cn.wait(15){ |x| > > > > p x > > > > } while true > > > > > > > > Then, just make sure to modify some file within the 15 second wait period. > > > > > > > > Thanks, > > > > > > > > Dan > > > > > > > > > You may overlooked the API document that says the FileName field is a > > > variable-length field. > > > > > > Here is working version of get_file_action: > > > > > > def get_file_action(fni) > > > array = [] > > > while true > > > break if fni.nil? || fni[0,4].unpack('L')[0] == 0 > > > int_action = fni[4,4].unpack('L')[0] > > > str_action = 'unknown' > > > case int_action > > > when FILE_ACTION_ADDED > > > str_action = 'added' > > > when FILE_ACTION_REMOVED > > > str_action = 'removed' > > > when FILE_ACTION_MODIFIED > > > str_action = 'modified' > > > when FILE_ACTION_RENAMED_OLD_NAME > > > str_action = 'renamed old name' > > > when FILE_ACTION_RENAMED_NEW_NAME > > > str_action = 'renamed new name' > > > end > > > len = fni[8,4].unpack('L').first > > > buf = fni[12,len] > > > file = wide_to_multi(buf) > > > struct = ChangeNotifyStruct.new(str_action, file) > > > array.push(struct) > > > fni = fni[fni[0,4].unpack('L').first, -1] # Next offset > > > end > > > > > > array > > > end > > > > > > Regards, > > > > > > Park Heesob > > > > > > _______________________________________________ > > > win32utils-devel mailing list > > > win32utils-devel at rubyforge.org > > > http://rubyforge.org/mailman/listinfo/win32utils-devel > > > > > > From noreply at rubyforge.org Sun Aug 5 16:34:03 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sun, 5 Aug 2007 16:34:03 -0400 (EDT) Subject: [Win32utils-devel] [ win32utils-Support Requests-12080 ] How would one add these packages as a dependency to a cross-platform gem? Message-ID: <20070805203403.30DFB5240C89@rubyforge.org> Support Requests item #12080, was opened at 2007-07-07 21:02 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=412&aid=12080&group_id=85 Category: Install Problem (example) Group: None Status: Open Resolution: None Priority: 3 Submitted By: Luke Bayes (lukebayes) Assigned to: Nobody (None) Summary: How would one add these packages as a dependency to a cross-platform gem? Initial Comment: I am building a ruby application that is expected to work across all supported platforms (mac/win/linux). Since my application needs to download and install myriad other external applications, I have made extensive use of the fork and open3 features - which forced me to use the win32-open3 implementations from you guys (I'm immensely grateful for your hard work btw). Now I'm trying to distribute my application as a rubygem, but when I add win32-open3 as a dependency, I'm afraid users on all of the other platforms are going to get prompted to install it - and subsequently fail the installation. When I try to install locally on OS X with the dependency activated, it complains and fails. Do you folks know how to distribute gems that depend on your packages only for windows users? Here's my project by the way - it's coming along nicely: http://code.google.com/p/projectsprouts ---------------------------------------------------------------------- Comment By: John-Mason Shackelford (jpshackelford) Date: 2007-08-05 15:34 Message: If you are wanting open3 functionality across platforms take a look at http://popen4.rubyforge.org/ ---------------------------------------------------------------------- Comment By: Daniel Berger (djberg96) Date: 2007-08-04 07:38 Message: I think there are two approaches you can use. One is to create a separate gem for MS Windows. The other thing you could do is set the gem.platform conditionally within the gem spec itself. For example: spec = Gem::Specification.new do |gem| ... if RUBY_PLATFORM.match('mswin') spec.add_dependency("win32-open3") end end Does that help? Dan ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=412&aid=12080&group_id=85 From phasis at gmail.com Sun Aug 5 22:36:56 2007 From: phasis at gmail.com (Heesob Park) Date: Mon, 6 Aug 2007 11:36:56 +0900 Subject: [Win32utils-devel] Need some help with pure Ruby win32-changenotify In-Reply-To: <6037b70c0708051309o5233a645oedee55554d0de785@mail.gmail.com> References: <46B47D2C.50608@gmail.com> <6037b70c0708051151j5457ae0m191221b213a5ab97@mail.gmail.com> <6037b70c0708051234s454e580w1dc3473ae2349b2a@mail.gmail.com> <6037b70c0708051309o5233a645oedee55554d0de785@mail.gmail.com> Message-ID: Hi, 2007/8/6, Daniel Berger : > > Ok, solved the remaining issues. I had to move the CloseHandle call in > the wait method above the yield/return. Also, I had to increase the > buffer size for the final string name. > > Now I'm wondering if I should automatically prepend the @path to the > file name in the final struct. We could use File.expand_path for > relative paths. > > What do you think? I think prepending the @path to the file name is better than printing the relative paths. And appliyng File.expand_path gives wrong result when running on different path from monitoring path. Thanks, > > Dan Regards, Park Heesob -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20070806/82092a5a/attachment.html From djberg96 at gmail.com Mon Aug 6 00:46:27 2007 From: djberg96 at gmail.com (Daniel Berger) Date: Sun, 5 Aug 2007 22:46:27 -0600 Subject: [Win32utils-devel] Need some help with pure Ruby win32-changenotify In-Reply-To: References: <46B47D2C.50608@gmail.com> <6037b70c0708051151j5457ae0m191221b213a5ab97@mail.gmail.com> <6037b70c0708051234s454e580w1dc3473ae2349b2a@mail.gmail.com> <6037b70c0708051309o5233a645oedee55554d0de785@mail.gmail.com> Message-ID: <6037b70c0708052146j23dcb7b7s7d64fdcd1aad0e3b@mail.gmail.com> On 8/5/07, Heesob Park wrote: > Hi, > > > 2007/8/6, Daniel Berger : > > Ok, solved the remaining issues. I had to move the CloseHandle call in > > the wait method above the yield/return. Also, I had to increase the > > buffer size for the final string name. > > > > Now I'm wondering if I should automatically prepend the @path to the > > file name in the final struct. We could use File.expand_path for > > relative paths. > > > > What do you think? > > > I think prepending the @path to the file name is better than printing the > relative paths. > And appliyng File.expand_path gives wrong result when running on different > path from monitoring path. Ah, that's right, thanks. Ok, I've simply join'd the @path to the file name. That's now in CVS. Oh, one thing that I've noticed is that it sometimes returns the filename as "4913". I know I've seen this issue come up at some point before (with the C code, too), but I can't remember what the answer was, and my Google skills are failing me. Do you happen to remember what causes that? Thanks, Dan From djberg96 at gmail.com Mon Aug 6 08:43:01 2007 From: djberg96 at gmail.com (Daniel Berger) Date: Mon, 06 Aug 2007 06:43:01 -0600 Subject: [Win32utils-devel] win32-changenotify and events Message-ID: <46B71755.9010700@gmail.com> Hi all, I've made some changes to the way that events are handled in win32-changenotify, and I wanted to verify that they were both appropriate and sensical. First, win32-changenotify now requires win32-event. In the constructor, if an event isn't explicitly passed, a new Win32::Event object is created (instead of calling CreateEvent directly). Then, in the ChangeNotify#wait method, I manually set the event's signaled state to true when it hits WAIT_OBJECT_0. Does that seem appropriate? Here's a quick sample program I used: # test.rb event = Win32::Event.new('test') p event.signaled? # false filter = ChangeNotify::FILE_NAME | ChangeNotify::DIR_NAME cn = ChangeNotify.new("C:\\", true, filter, event) cn.wait(10){ |x| p x } p event.signaled? # true if a change happened event.close Regards, Dan From phasis at gmail.com Mon Aug 6 12:10:23 2007 From: phasis at gmail.com (Park Heesob) Date: Tue, 7 Aug 2007 01:10:23 +0900 Subject: [Win32utils-devel] Need some help with pure Rubywin32-changenotify References: <46B47D2C.50608@gmail.com><6037b70c0708051151j5457ae0m191221b213a5ab97@mail.gmail.com><6037b70c0708051234s454e580w1dc3473ae2349b2a@mail.gmail.com><6037b70c0708051309o5233a645oedee55554d0de785@mail.gmail.com> <6037b70c0708052146j23dcb7b7s7d64fdcd1aad0e3b@mail.gmail.com> Message-ID: <007f01c7d844$4d5c5160$9a7ba8c0@mycom> Hi, ----- Original Message ----- From: "Daniel Berger" To: "Development and ideas for win32utils projects" Sent: Monday, August 06, 2007 1:46 PM Subject: Re: [Win32utils-devel] Need some help with pure Rubywin32-changenotify > On 8/5/07, Heesob Park wrote: >> Hi, >> >> >> 2007/8/6, Daniel Berger : >> > Ok, solved the remaining issues. I had to move the CloseHandle call in >> > the wait method above the yield/return. Also, I had to increase the >> > buffer size for the final string name. >> > >> > Now I'm wondering if I should automatically prepend the @path to the >> > file name in the final struct. We could use File.expand_path for >> > relative paths. >> > >> > What do you think? >> >> >> I think prepending the @path to the file name is better than printing the >> relative paths. >> And appliyng File.expand_path gives wrong result when running on different >> path from monitoring path. > > Ah, that's right, thanks. Ok, I've simply join'd the @path to the file > name. That's now in CVS. > > Oh, one thing that I've noticed is that it sometimes returns the > filename as "4913". I know I've seen this issue come up at some point > before (with the C code, too), but I can't remember what the answer > was, and my Google skills are failing me. > > Do you happen to remember what causes that? > Sorry, I don't remember that issue. and I never met such case. But I noticed other two issues. First, sometimes filename has trailing garbage characters. It can be fixed by modifing changenotify.rb line # 171 to file = fni[12,len] + "\0\0" # add null char Second, sometimes some events missed when two or more files were removed or added at the same time. I'm not sure it is a known issue. Regards, Park Heesob From Daniel.Berger at qwest.com Mon Aug 6 12:31:31 2007 From: Daniel.Berger at qwest.com (Berger, Daniel) Date: Mon, 6 Aug 2007 11:31:31 -0500 Subject: [Win32utils-devel] Need some help with pureRubywin32-changenotify In-Reply-To: <007f01c7d844$4d5c5160$9a7ba8c0@mycom> Message-ID: <7524A45A1A5B264FA4809E2156496CFBE72D32@ITOMAE2KM01.AD.QINTRA.COM> Hi, > > On 8/5/07, Heesob Park wrote: > > Oh, one thing that I've noticed is that it sometimes returns the > > filename as "4913". I know I've seen this issue come up at > some point > > before (with the C code, too), but I can't remember what the answer > > was, and my Google skills are failing me. > > > > Do you happen to remember what causes that? > > > Sorry, I don't remember that issue. and I never met such case. I was able to see this just by setting up monitoring on the current directory, creating a file via gvim, and editing that file while that directory was being watched. > But I noticed other two issues. > First, sometimes filename has trailing garbage characters. > It can be fixed by modifing changenotify.rb line # 171 to > file = fni[12,len] + "\0\0" # add null char Thanks, I'll commit that change today. > Second, sometimes some events missed when two or more files > were removed or added at the same time. I'm not sure it is a > known issue. I seem to recall that win32-changenotify could never handle a large number of simultaneous events. I think this was a limitation of the ReadDirectoryChangesW function, but I'd have to do more research. That being said, it does seem like the C version picks up more events than the pure Ruby version does. So, there's a problem with the pure Ruby win32-changenotify code, a problem with the pure Ruby win32-ipc code, or Win32API is just not quick enough to pick up more than a few events at a time. Regards, Dan This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments. From phasis at gmail.com Mon Aug 6 21:18:57 2007 From: phasis at gmail.com (Heesob Park) Date: Tue, 7 Aug 2007 10:18:57 +0900 Subject: [Win32utils-devel] Need some help with pureRubywin32-changenotify In-Reply-To: <7524A45A1A5B264FA4809E2156496CFBE72D32@ITOMAE2KM01.AD.QINTRA.COM> References: <007f01c7d844$4d5c5160$9a7ba8c0@mycom> <7524A45A1A5B264FA4809E2156496CFBE72D32@ITOMAE2KM01.AD.QINTRA.COM> Message-ID: Hi, 2007/8/7, Berger, Daniel : > > Hi, > > > > On 8/5/07, Heesob Park wrote: > > > > > > Oh, one thing that I've noticed is that it sometimes returns the > > > filename as "4913". I know I've seen this issue come up at > > some point > > > before (with the C code, too), but I can't remember what the answer > > > was, and my Google skills are failing me. > > > > > > Do you happen to remember what causes that? > > > > > Sorry, I don't remember that issue. and I never met such case. > > I was able to see this just by setting up monitoring on the current > directory, creating a file via gvim, and editing that file while that > directory was being watched. If "4913" file already exists, the filename would be "5036". I investigate the gvim source code, and I found "4913" in fileio.c. It generate temporary file starting from 4913 increasing by 123. So the "4913" is just a filename generated by gvim. Regards, Park Heesob -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20070807/af2307c2/attachment.html From djberg96 at gmail.com Mon Aug 6 21:54:17 2007 From: djberg96 at gmail.com (Daniel Berger) Date: Mon, 6 Aug 2007 19:54:17 -0600 Subject: [Win32utils-devel] Need some help with pureRubywin32-changenotify In-Reply-To: References: <007f01c7d844$4d5c5160$9a7ba8c0@mycom> <7524A45A1A5B264FA4809E2156496CFBE72D32@ITOMAE2KM01.AD.QINTRA.COM> Message-ID: <6037b70c0708061854l4ec9726aqa0e8a324992f546e@mail.gmail.com> On 8/6/07, Heesob Park wrote: > Hi, > > > 2007/8/7, Berger, Daniel : > > Hi, > > > > > > On 8/5/07, Heesob Park wrote: > > > > > > > > > > Oh, one thing that I've noticed is that it sometimes returns the > > > > filename as "4913". I know I've seen this issue come up at > > > some point > > > > before (with the C code, too), but I can't remember what the answer > > > > was, and my Google skills are failing me. > > > > > > > > Do you happen to remember what causes that? > > > > > > > Sorry, I don't remember that issue. and I never met such case. > > > > I was able to see this just by setting up monitoring on the current > > directory, creating a file via gvim, and editing that file while that > > directory was being watched. > > > If "4913" file already exists, the filename would be "5036". > > I investigate the gvim source code, and I found "4913" in fileio.c. > It generate temporary file starting from 4913 increasing by 123. > > So the "4913" is just a filename generated by gvim. Oh, heh, good to know. Thanks, Dan From noreply at rubyforge.org Tue Aug 7 15:17:24 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Tue, 7 Aug 2007 15:17:24 -0400 (EDT) Subject: [Win32utils-devel] [ win32utils-Bugs-12881 ] Cannot wait on Process - service_daemon/service_main Message-ID: <20070807191724.98F395240AD7@rubyforge.org> Bugs item #12881, was opened at 2007-08-07 19:17 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=12881&group_id=85 Category: win32-service Group: None Status: Open Resolution: None Priority: 3 Submitted By: John Leake (ozwaldtwistle) Assigned to: Nobody (None) Summary: Cannot wait on Process - service_daemon/service_main Initial Comment: First of all a warm thank you to all contributors of this excellent library. Windows XP Pro SP2 Ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32] Service 0.5.2 Process 0.5.3 I am using code based on the examples tdaemon.rb and tdaemon_ctl.rb Within tdaemon.rb/service_main() I launch an exe using Process.create and then use Process.waitpid2(process_id) to catch it if it crashes and then restart it. This works fine but when I call service_stop to kill the process it the call blocks until I kill the exe externally. Any suggestions ? ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=12881&group_id=85 From djberg96 at gmail.com Wed Aug 8 07:05:00 2007 From: djberg96 at gmail.com (Daniel Berger) Date: Wed, 08 Aug 2007 05:05:00 -0600 Subject: [Win32utils-devel] Some more win32-changenotify analysis Message-ID: <46B9A35C.3090505@gmail.com> Hi all, I decided to check the responsiveness of the pure Ruby vs C extension versions of win32-changenotify. I setup this little file generator program: a = [] 10.times{ |n| a << Thread.new{ File.open("File_#{n}", 'w'){ |fh| fh.puts "test #{n}" } } } a.each{ |t| t.join } The pure Ruby version did not do so well. In some cases it only picked up one event. In most cases, it didn't pick up *any* events! The C extension did much better, though the behavior was somewhat odd. Most of the time it picked up multiple notifications on some files, while missing others entirely: [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] [#] I also tried with a C version of win32-changenotify using a pure Ruby version of win32-ipc. Although the results were mixed, it did seem to get a little worse in terms of the notifications it returned, typically only returning 4 or 5 notifications, though sometimes it did as well or better than using the C version of win32-ipc, so I'm not sure what to make of that. I'm not sure what to make of the fact that the pure Ruby version doesn't pick up Threaded events most (all?) of the time. Maybe there's some way to use threads within changenotify.rb to make it more responsive? Otherwise, I think I'll have to declare this a failed experiment. Regards, Dan From phasis at gmail.com Wed Aug 8 11:36:43 2007 From: phasis at gmail.com (Heesob Park) Date: Thu, 9 Aug 2007 00:36:43 +0900 Subject: [Win32utils-devel] Some more win32-changenotify analysis In-Reply-To: <46B9A35C.3090505@gmail.com> References: <46B9A35C.3090505@gmail.com> Message-ID: Hi, 2007/8/8, Daniel Berger : > > Hi all, > > I decided to check the responsiveness of the pure Ruby vs C extension > versions of win32-changenotify. I setup this little file generator > program: > > a = [] > > 10.times{ |n| > a << Thread.new{ > File.open("File_#{n}", 'w'){ |fh| fh.puts "test #{n}" } > } > } > > a.each{ |t| t.join } > > The pure Ruby version did not do so well. In some cases it only picked > up one event. In most cases, it didn't pick up *any* events! > > The C extension did much better, though the behavior was somewhat odd. > Most of the time it picked up multiple notifications on some files, > while missing others entirely: > > [# file_name="test1\\test2\\File_0">] > [# file_name="test1\\test2\\File_4">] > [# file_name="test1\\test2\\File_4">] > [# file_name="test1\\test2\\File_5">] > [# file_name="test1\\test2\\File_5">] > [# file_name="test1\\test2\\File_6">] > [# file_name="test1\\test2\\File_6">] > [# file_name="test1\\test2\\File_7">] > [# file_name="test1\\test2\\File_7">] > [# file_name="test1\\test2\\File_8">] > [# file_name="test1\\test2\\File_8">] > [# file_name="test1\\test2\\File_9">] > [# file_name="test1\\test2\\File_9">] > > I also tried with a C version of win32-changenotify using a pure Ruby > version of win32-ipc. Although the results were mixed, it did seem to > get a little worse in terms of the notifications it returned, typically > only returning 4 or 5 notifications, though sometimes it did as well or > better than using the C version of win32-ipc, so I'm not sure what to > make of that. > > I'm not sure what to make of the fact that the pure Ruby version doesn't > pick up Threaded events most (all?) of the time. Maybe there's some way > to use threads within changenotify.rb to make it more responsive? > > Otherwise, I think I'll have to declare this a failed experiment. > > Regards, > > Dan Don't give up yet :) I googled and found a Delphi version. I ported it into Ruby and in my test, it can catch all events. It requires CreateIoCompletionPort and GetQueuedCompletionStatus API function. I also found a bug releated with aquiring next offset of fni at get_file_action. Here is another version of wait and get_file_action: CreateIoCompletionPort = Win32API.new('kernel32', 'CreateIoCompletionPort', 'LLPL', 'L') GetQueuedCompletionStatus = Win32API.new('kernel32', 'GetQueuedCompletionStatus', 'LPPPL', 'I') def CreateIoCompletionPort(handle,port,key,threads) CreateIoCompletionPort.call(handle,port,key,threads) end def GetQueuedCompletionStatus(handle,bytes,key,overlap,millisec) GetQueuedCompletionStatus.call(handle,bytes,key,overlap,millisec) > 0 end # Waits up to 'seconds' for a notification to occur, or infinitely # if no value is specified. # # If a block is provided, yields a ChangeNotifyStruct that contains two # members: file_name and action. # def wait(seconds = INFINITE) seconds *= 1000 unless seconds == INFINITE fni = 0.chr * 65536 # FILE_NOTIFY_INFORMATION struct buffer bytes = [0].pack('L') num_bytes = [0].pack('L') subtree = @recursive ? 1 : 0 dir_handle = get_dir_handle(@path) completion_key = [12345].pack('L') completion_port = CreateIoCompletionPort(dir_handle, 0, completion_key, 0); bool = ReadDirectoryChangesW(dir_handle,fni,fni.size ,subtree, at filter,bytes, at overlap,0) unless bool raise Error, get_last_error end while true GetQueuedCompletionStatus(completion_port, num_bytes, completion_key, @overlap, seconds) break if completion_key.unpack('L').first == 0 yield get_file_action(fni) if block_given? ReadDirectoryChangesW(dir_handle,fni,fni.size ,subtree, at filter,bytes, at overlap,0) end end def get_file_action(fni2) fni = fni2.dup array = [] while true int_action = fni[4,4].unpack('L')[0] str_action = 'unknown' case int_action when FILE_ACTION_ADDED str_action = 'added' when FILE_ACTION_REMOVED str_action = 'removed' when FILE_ACTION_MODIFIED str_action = 'modified' when FILE_ACTION_RENAMED_OLD_NAME str_action = 'renamed old name' when FILE_ACTION_RENAMED_NEW_NAME str_action = 'renamed new name' end len = fni[8,4].unpack('L').first # FileNameLength struct member file = fni[12,len] + "\0\0" # FileName struct member + null buf = 0.chr * 260 WideCharToMultiByte(CP_ACP, 0, file, -1, buf, 260, 0, 0) file = File.join(@path, buf.unpack('A*')[0]) struct = ChangeNotifyStruct.new(str_action, file) array.push(struct) break if fni[0,4].unpack('L')[0] == 0 fni = fni[fni[0,4].unpack('L').first .. -1] # Next offset break if fni.nil? end array end -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20070809/1b1b6e5e/attachment.html From djberg96 at gmail.com Wed Aug 8 15:32:00 2007 From: djberg96 at gmail.com (Daniel Berger) Date: Wed, 8 Aug 2007 13:32:00 -0600 Subject: [Win32utils-devel] Some more win32-changenotify analysis In-Reply-To: References: <46B9A35C.3090505@gmail.com> Message-ID: <6037b70c0708081232x28cbaff8o5eae572c36033a97@mail.gmail.com> On 8/8/07, Heesob Park wrote: > Hi, > I googled and found a Delphi version. > I ported it into Ruby and in my test, it can catch all events. > > It requires CreateIoCompletionPort and GetQueuedCompletionStatus API > function. > I also found a bug releated with aquiring next offset of fni at > get_file_action. Very nice. I'll try this out soon. On a side note, after looking at the docs for CreateIoCompletionPort and GetQueuedCompletionStatus, isn't that how Kernel#select ought to be implemented for MS Windows? I don't understand the sockets API they're using. Perhaps it's a backwards compatibility issue (95/98/ME). Mega bonus points if you can solve the Kernel#select blocking issue on MS Windows, since we only care about NT. :) Dan From djberg96 at gmail.com Thu Aug 9 01:27:05 2007 From: djberg96 at gmail.com (Daniel Berger) Date: Wed, 8 Aug 2007 23:27:05 -0600 Subject: [Win32utils-devel] Some more win32-changenotify analysis In-Reply-To: References: <46B9A35C.3090505@gmail.com> Message-ID: <6037b70c0708082227n17e5a548je8401003d0662378@mail.gmail.com> On 8/8/07, Heesob Park wrote: > Don't give up yet :) > > I googled and found a Delphi version. > I ported it into Ruby and in my test, it can catch all events. > > It requires CreateIoCompletionPort and GetQueuedCompletionStatus API > function. > I also found a bug releated with aquiring next offset of fni at > get_file_action. > > Here is another version of wait and get_file_action: I tried this on my Windows XP (Home) SP2 laptop at home but it didn't pick up any events when I ran the threaded file generator with an infinite wait period. When I specified a wait time of 10 seconds, it seemed to pick up one event every 10 seconds, but with the file name chopped off. I'll try it on my XP Pro box tomorrow at work and see what happens. Is there a way to do a FileIOCompletionRoutine via Win32API btw? Regards, Dan From phasis at gmail.com Thu Aug 9 03:51:04 2007 From: phasis at gmail.com (Heesob Park) Date: Thu, 9 Aug 2007 16:51:04 +0900 Subject: [Win32utils-devel] Some more win32-changenotify analysis In-Reply-To: <6037b70c0708082227n17e5a548je8401003d0662378@mail.gmail.com> References: <46B9A35C.3090505@gmail.com> <6037b70c0708082227n17e5a548je8401003d0662378@mail.gmail.com> Message-ID: Hi, 2007/8/9, Daniel Berger : > > On 8/8/07, Heesob Park wrote: > > > > > Don't give up yet :) > > > > I googled and found a Delphi version. > > I ported it into Ruby and in my test, it can catch all events. > > > > It requires CreateIoCompletionPort and GetQueuedCompletionStatus API > > function. > > I also found a bug releated with aquiring next offset of fni at > > get_file_action. > > > > Here is another version of wait and get_file_action: > > > > I tried this on my Windows XP (Home) SP2 laptop at home but it didn't > pick up any events when I ran the threaded file generator with an > infinite wait period. When I specified a wait time of 10 seconds, it > seemed to pick up one event every 10 seconds, but with the file name > chopped off. > > I'll try it on my XP Pro box tomorrow at work and see what happens. In my test with XP Home SP2 , it works fine. Do you modified both wait and get_file_aciton with my version? Is there a way to do a FileIOCompletionRoutine via Win32API btw? FileIOCompletionRoutine is application defined callback function. As far as I know Win32API don't support callback function. > Regards, > > Dan Regards, Park Heesob -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20070809/ac76ec9f/attachment-0001.html From djberg96 at gmail.com Thu Aug 9 07:20:11 2007 From: djberg96 at gmail.com (Daniel Berger) Date: Thu, 9 Aug 2007 05:20:11 -0600 Subject: [Win32utils-devel] Some more win32-changenotify analysis In-Reply-To: References: <46B9A35C.3090505@gmail.com> <6037b70c0708082227n17e5a548je8401003d0662378@mail.gmail.com> Message-ID: <6037b70c0708090420p37fe8057x5d763497a643b021@mail.gmail.com> On 8/9/07, Heesob Park wrote: > > Hi, > > > 2007/8/9, Daniel Berger : > > On 8/8/07, Heesob Park wrote: > > > > > > > > > Don't give up yet :) > > > > > > I googled and found a Delphi version. > > > I ported it into Ruby and in my test, it can catch all events. > > > > > > It requires CreateIoCompletionPort and GetQueuedCompletionStatus API > > > function. > > > I also found a bug releated with aquiring next offset of fni at > > > get_file_action. > > > > > > Here is another version of wait and get_file_action: > > > > > > > > I tried this on my Windows XP (Home) SP2 laptop at home but it didn't > > pick up any events when I ran the threaded file generator with an > > infinite wait period. When I specified a wait time of 10 seconds, it > > seemed to pick up one event every 10 seconds, but with the file name > > chopped off. > > > > I'll try it on my XP Pro box tomorrow at work and see what happens. > > > In my test with XP Home SP2 , it works fine. > Do you modified both wait and get_file_aciton with my version? Yes, though your version does do a much better job at picking up multiple file events that aren't threaded in my limited testing. For example, opening and saving a file via gvim now picks up four separate events (tempfile generation, deletion, etc). It just seems to be the threaded file creation it doesn't pick up. I'm not sure why, but I'll try at work and see if I see the same behavior on XP Pro. > > Is there a way to do a FileIOCompletionRoutine via Win32API btw? > > > FileIOCompletionRoutine is application defined callback function. > As far as I know Win32API don't support callback function. Any way we could add it? I know the core team won't take patches, but I can always release something separately. Dan PS - I uploaded Windows::NIO into CVS (in the windows-pr project), that contains the functions we need for this. I think I'll put out windows-pr 0.7.0 today. From djberg96 at gmail.com Thu Aug 9 07:39:29 2007 From: djberg96 at gmail.com (Daniel Berger) Date: Thu, 9 Aug 2007 05:39:29 -0600 Subject: [Win32utils-devel] Some more win32-changenotify analysis In-Reply-To: <6037b70c0708090420p37fe8057x5d763497a643b021@mail.gmail.com> References: <46B9A35C.3090505@gmail.com> <6037b70c0708082227n17e5a548je8401003d0662378@mail.gmail.com> <6037b70c0708090420p37fe8057x5d763497a643b021@mail.gmail.com> Message-ID: <6037b70c0708090439g53b957c3u95d68ed6e7ba4ef6@mail.gmail.com> > On 8/9/07, Heesob Park wrote: > > In my test with XP Home SP2 , it works fine. > > Do you modified both wait and get_file_aciton with my version? BTW, I committed the changes (with some extra error checking) into CVS so you can take a look. Regards, Dan From phasis at gmail.com Thu Aug 9 10:22:51 2007 From: phasis at gmail.com (Heesob Park) Date: Thu, 9 Aug 2007 23:22:51 +0900 Subject: [Win32utils-devel] Some more win32-changenotify analysis In-Reply-To: <6037b70c0708090439g53b957c3u95d68ed6e7ba4ef6@mail.gmail.com> References: <46B9A35C.3090505@gmail.com> <6037b70c0708082227n17e5a548je8401003d0662378@mail.gmail.com> <6037b70c0708090420p37fe8057x5d763497a643b021@mail.gmail.com> <6037b70c0708090439g53b957c3u95d68ed6e7ba4ef6@mail.gmail.com> Message-ID: Hi, 2007/8/9, Daniel Berger : > > > On 8/9/07, Heesob Park wrote: > > > > > > In my test with XP Home SP2 , it works fine. > > > Do you modified both wait and get_file_aciton with my version? > > BTW, I committed the changes (with some extra error checking) into CVS > so you can take a look. Now I noticed some events ocurred between GetQueuedCompletionStatus and ReadDirectoryChangesW might be missed. The faster CPU machine can detect the more events. And this version cannot detect the whole events. Regards, Park Heesob -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20070809/12fae252/attachment.html From djberg96 at gmail.com Thu Aug 9 10:23:20 2007 From: djberg96 at gmail.com (Daniel Berger) Date: Thu, 9 Aug 2007 08:23:20 -0600 Subject: [Win32utils-devel] Some more win32-changenotify analysis In-Reply-To: <6037b70c0708090420p37fe8057x5d763497a643b021@mail.gmail.com> References: <46B9A35C.3090505@gmail.com> <6037b70c0708082227n17e5a548je8401003d0662378@mail.gmail.com> <6037b70c0708090420p37fe8057x5d763497a643b021@mail.gmail.com> Message-ID: <6037b70c0708090723i5647a08etc30f506f95b0dcd2@mail.gmail.com> On 8/9/07, Daniel Berger wrote: > On 8/9/07, Heesob Park wrote: > > > > Hi, > > > > > > 2007/8/9, Daniel Berger : > > > On 8/8/07, Heesob Park wrote: > > > > > > > > > > > > > Don't give up yet :) > > > > > > > > I googled and found a Delphi version. > > > > I ported it into Ruby and in my test, it can catch all events. > > > > > > > > It requires CreateIoCompletionPort and GetQueuedCompletionStatus API > > > > function. > > > > I also found a bug releated with aquiring next offset of fni at > > > > get_file_action. > > > > > > > > Here is another version of wait and get_file_action: > > > > > > > > > > > > I tried this on my Windows XP (Home) SP2 laptop at home but it didn't > > > pick up any events when I ran the threaded file generator with an > > > infinite wait period. When I specified a wait time of 10 seconds, it > > > seemed to pick up one event every 10 seconds, but with the file name > > > chopped off. > > > > > > I'll try it on my XP Pro box tomorrow at work and see what happens. On my XP Pro box at work it worked fine - picked up every change and the file names were fine. Must be something about my XP Home laptop. Good thing we only support Pro officially. :) I just realized that I forgot to manually set the event to a signaled state, so I'll do that, then release assuming all else is well. Regards, Dan From djberg96 at gmail.com Thu Aug 9 10:32:44 2007 From: djberg96 at gmail.com (Daniel Berger) Date: Thu, 9 Aug 2007 08:32:44 -0600 Subject: [Win32utils-devel] Some more win32-changenotify analysis In-Reply-To: References: <46B9A35C.3090505@gmail.com> <6037b70c0708082227n17e5a548je8401003d0662378@mail.gmail.com> <6037b70c0708090420p37fe8057x5d763497a643b021@mail.gmail.com> <6037b70c0708090439g53b957c3u95d68ed6e7ba4ef6@mail.gmail.com> Message-ID: <6037b70c0708090732q30a42aau2b400c5455fcb8c4@mail.gmail.com> On 8/9/07, Heesob Park wrote: > Hi, > > > 2007/8/9, Daniel Berger : > > > On 8/9/07, Heesob Park wrote: > > > > > > > > > > In my test with XP Home SP2 , it works fine. > > > > Do you modified both wait and get_file_aciton with my version? > > > > BTW, I committed the changes (with some extra error checking) into CVS > > so you can take a look. > > > Now I noticed some events ocurred between GetQueuedCompletionStatus and > ReadDirectoryChangesW might be missed. The faster CPU machine can detect the > more events. And this version cannot detect the whole events. Anything we can do to improve it? I think we're still doing better than the current C version in any case. :) Thanks, Dan From phasis at gmail.com Thu Aug 9 10:44:13 2007 From: phasis at gmail.com (Heesob Park) Date: Thu, 9 Aug 2007 23:44:13 +0900 Subject: [Win32utils-devel] Some more win32-changenotify analysis In-Reply-To: <6037b70c0708090732q30a42aau2b400c5455fcb8c4@mail.gmail.com> References: <46B9A35C.3090505@gmail.com> <6037b70c0708082227n17e5a548je8401003d0662378@mail.gmail.com> <6037b70c0708090420p37fe8057x5d763497a643b021@mail.gmail.com> <6037b70c0708090439g53b957c3u95d68ed6e7ba4ef6@mail.gmail.com> <6037b70c0708090732q30a42aau2b400c5455fcb8c4@mail.gmail.com> Message-ID: 2007/8/9, Daniel Berger : > > On 8/9/07, Heesob Park wrote: > > Hi, > > > > > > 2007/8/9, Daniel Berger : > > > > On 8/9/07, Heesob Park wrote: > > > > > > > > > > > > > > In my test with XP Home SP2 , it works fine. > > > > > Do you modified both wait and get_file_aciton with my version? > > > > > > BTW, I committed the changes (with some extra error checking) into CVS > > > so you can take a look. > > > > > > Now I noticed some events ocurred between GetQueuedCompletionStatus and > > ReadDirectoryChangesW might be missed. The faster CPU machine can detect > the > > more events. And this version cannot detect the whole events. > > Anything we can do to improve it? I think we're still doing better > than the current C version in any case. :) In case of C version, I guess It could be improved by using thread. But in case of pure Ruby version, I have no idea. If someday Ruby support native windows thread, it would be much better. Thanks, Park Heesob -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20070809/7883fea5/attachment.html From djberg96 at gmail.com Thu Aug 9 10:51:31 2007 From: djberg96 at gmail.com (Daniel Berger) Date: Thu, 9 Aug 2007 08:51:31 -0600 Subject: [Win32utils-devel] Some more win32-changenotify analysis In-Reply-To: References: <46B9A35C.3090505@gmail.com> <6037b70c0708082227n17e5a548je8401003d0662378@mail.gmail.com> <6037b70c0708090420p37fe8057x5d763497a643b021@mail.gmail.com> <6037b70c0708090439g53b957c3u95d68ed6e7ba4ef6@mail.gmail.com> <6037b70c0708090732q30a42aau2b400c5455fcb8c4@mail.gmail.com> Message-ID: <6037b70c0708090751re90db11ya1e06a97bfe0a2ba@mail.gmail.com> On 8/9/07, Heesob Park wrote: > > > > 2007/8/9, Daniel Berger : > > On 8/9/07, Heesob Park wrote: > > > Hi, > > > > > > > > > 2007/8/9, Daniel Berger : > > > > > On 8/9/07, Heesob Park wrote: > > > > > > > > > > > > > > > > > > In my test with XP Home SP2 , it works fine. > > > > > > Do you modified both wait and get_file_aciton with my version? > > > > > > > > BTW, I committed the changes (with some extra error checking) into CVS > > > > so you can take a look. > > > > > > > > > Now I noticed some events ocurred between GetQueuedCompletionStatus and > > > ReadDirectoryChangesW might be missed. The faster CPU machine can detect > the > > > more events. And this version cannot detect the whole events. > > > > Anything we can do to improve it? I think we're still doing better > > than the current C version in any case. :) > > > In case of C version, I guess It could be improved by using thread. But in > case of pure Ruby version, I have no idea. > If someday Ruby support native windows thread, it would be much better. Would wrapping that section of code in a Ruby thread help at all? Or not really due to the nature of the code? One other thing I've noticed is that it doesn't appear possible to Ctrl-C out of that code, even if I setup a separate sleeper thread in the main program. I have to kill it with the task manager. This is a minor issue, but I thought I'd mention it in case you had any ideas. Thanks, Dan From phasis at gmail.com Thu Aug 9 11:44:05 2007 From: phasis at gmail.com (Heesob Park) Date: Fri, 10 Aug 2007 00:44:05 +0900 Subject: [Win32utils-devel] Some more win32-changenotify analysis In-Reply-To: <6037b70c0708090751re90db11ya1e06a97bfe0a2ba@mail.gmail.com> References: <46B9A35C.3090505@gmail.com> <6037b70c0708082227n17e5a548je8401003d0662378@mail.gmail.com> <6037b70c0708090420p37fe8057x5d763497a643b021@mail.gmail.com> <6037b70c0708090439g53b957c3u95d68ed6e7ba4ef6@mail.gmail.com> <6037b70c0708090732q30a42aau2b400c5455fcb8c4@mail.gmail.com> <6037b70c0708090751re90db11ya1e06a97bfe0a2ba@mail.gmail.com> Message-ID: 2007/8/9, Daniel Berger : > On 8/9/07, Heesob Park wrote: > > > > > > > > 2007/8/9, Daniel Berger : > > > On 8/9/07, Heesob Park wrote: > > > > Hi, > > > > > > > > > > > > 2007/8/9, Daniel Berger : > > > > > > On 8/9/07, Heesob Park wrote: > > > > > > > > > > > > > > > > > > > > > > In my test with XP Home SP2 , it works fine. > > > > > > > Do you modified both wait and get_file_aciton with my version? > > > > > > > > > > BTW, I committed the changes (with some extra error checking) into > CVS > > > > > so you can take a look. > > > > > > > > > > > > Now I noticed some events ocurred between GetQueuedCompletionStatus > and > > > > ReadDirectoryChangesW might be missed. The faster CPU machine can > detect > > the > > > > more events. And this version cannot detect the whole events. > > > > > > Anything we can do to improve it? I think we're still doing better > > > than the current C version in any case. :) > > > > > > In case of C version, I guess It could be improved by using thread. But > in > > case of pure Ruby version, I have no idea. > > If someday Ruby support native windows thread, it would be much better. > > Would wrapping that section of code in a Ruby thread help at all? Or > not really due to the nature of the code? I have tried several Ruby threading, but it didn't help at all. The basic idea is like this: arr = [] Thread.new { while true bool = GetQueuedCompletionStatus( comp_port, qbytes, comp_key, @overlap, seconds ) unless bool raise Error, get_last_error end break if comp_key.unpack('L').first == 0 #yield get_file_action(fni) if block_given? arr.push(fni.dup) bool = ReadDirectoryChangesW( dir_handle, fni, fni.size, subtree, @filter, rbytes, @overlap, 0 ) unless bool raise Error, get_last_error end end } while true while arr.length>0 yield get_file_action(arr.pop) if block_given? end sleep 0.5 end > One other thing I've noticed is that it doesn't appear possible to > Ctrl-C out of that code, even if I setup a separate sleeper thread in > the main program. I have to kill it with the task manager. This is a > minor issue, but I thought I'd mention it in case you had any ideas. Or press Ctrl-C and delete some monitoring file :) Regards, Park Heesob -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20070810/b4335f79/attachment-0001.html From Daniel.Berger at qwest.com Thu Aug 9 13:19:04 2007 From: Daniel.Berger at qwest.com (Daniel Berger) Date: Thu, 09 Aug 2007 11:19:04 -0600 Subject: [Win32utils-devel] win32-changenotify 0.5.0 nearing release Message-ID: <46BB4C88.9030300@qwest.com> Hi all, I made some minor final changes to the win32-changenotify code (added accessors I forgot, updated the test suite, explicit type checking in the constructor, etc). The only somewhat major change that I made is that I now have the constructor yield/close if a block is given. Unless anyone objects to that, it's going into 0.5.0. Otherwise, I'll put 0.5.0 out tonight. Regards, Dan From noreply at rubyforge.org Fri Aug 10 15:29:34 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Fri, 10 Aug 2007 15:29:34 -0400 (EDT) Subject: [Win32utils-devel] [ win32utils-Bugs-12979 ] Error while trying to update my gem collection Message-ID: <20070810192934.BEAEB5240E7A@rubyforge.org> Bugs item #12979, was opened at 2007-08-10 15:29 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=12979&group_id=85 Category: windows-pr Group: None Status: Open Resolution: None Priority: 3 Submitted By: Nobody (None) Assigned to: Nobody (None) Summary: Error while trying to update my gem collection Initial Comment: C:\ruby>gem update Updating installed gems... Attempting remote update of windows-pr ERROR: While executing gem ... (OpenURI::HTTPError) 404 Not Found C:\ruby>ruby -v ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32] C:\ruby>gem --version 0.9.4 ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=12979&group_id=85 From noreply at rubyforge.org Fri Aug 10 15:36:31 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Fri, 10 Aug 2007 15:36:31 -0400 (EDT) Subject: [Win32utils-devel] [ win32utils-Bugs-12979 ] Error while trying to update my gem collection Message-ID: <20070810193632.03ED45240D88@rubyforge.org> Bugs item #12979, was opened at 2007-08-10 21:29 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=12979&group_id=85 Category: windows-pr Group: None Status: Open Resolution: None Priority: 3 Submitted By: Nobody (None) Assigned to: Nobody (None) Summary: Error while trying to update my gem collection Initial Comment: C:\ruby>gem update Updating installed gems... Attempting remote update of windows-pr ERROR: While executing gem ... (OpenURI::HTTPError) 404 Not Found C:\ruby>ruby -v ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32] C:\ruby>gem --version 0.9.4 ---------------------------------------------------------------------- Comment By: Dejan Dimic (dima) Date: 2007-08-10 21:36 Message: I forgot to add my gem list if that could be somehow in correlation C:\ruby>gem list *** LOCAL GEMS *** actionmailer (1.3.3) Service layer for easy email delivery and testing. actionpack (1.13.3) Web-flow and rendering framework putting the VC in MVC. actionwebservice (1.2.3) Web service support for Action Pack. activerecord (1.15.3) Implements the ActiveRecord pattern for ORM. activesupport (1.4.2) Support and utility classes used by the Rails framework. cgi_multipart_eof_fix (2.2) Fix an exploitable bug in CGI multipart parsing which affects Ruby <= 1.8.5 when multipart boundary attribute contains a non-halting regular expression string. dbf (1.0.1) A small fast library for reading dBase, xBase, Clipper and FoxPro database files. fxri (0.3.6) Graphical interface to the RI documentation, with search engine. fxruby (1.6.11) FXRuby is the Ruby binding to the FOX GUI toolkit. gem_plugin (0.2.2) A plugin system based only on rubygems that uses dependencies only hoe (1.2.2) Hoe is a way to write Rakefiles much easier and cleaner. hpricot (0.6) a swift, liberal HTML parser with a fantastic library httpclient (2.1.0) gives something like the functionality of libwww-perl (LWP) in Ruby log4r (1.0.5) Log4r is a comprehensive and flexible logging library for Ruby. mongrel (1.0.1) A small fast HTTP library and server that runs Rails, Camping, Nitro and Iowa apps. newgem (0.11.0) Make your own gems at home rails (1.2.3) Web-application framework with template engine, control-flow layer, and ORM. rake (0.7.3) Ruby based make-like utility. RedCloth (3.0.4) RedCloth is a module for using Textile and Markdown in Ruby. Textile and Markdown are text formats. A very simple text format. Another stab at making readable text that can be converted to HTML. ruby-debug (0.9.3) Command line interface (CLI) for ruby-debug-base ruby-debug-base (0.9.3) Fast Ruby debugger ruby-debug-ide (0.1.8) IDE interface for ruby-debug. ruby-postgres (0.7.1.2006.04.06) Ruby extension library providing an API to PostgreSQL ruby-prof (0.5.2) Fast Ruby profiler rubyforge (0.4.3) A script which automates a limited set of rubyforge operations. rubygems-update (0.9.4) RubyGems Update GEM soap4r (1.5.7) An implementation of SOAP 1.1 for Ruby. sources (0.0.1) This package provides download sources for remote gem installation sqlite3-ruby (1.2.1) SQLite3/Ruby is a module to allow Ruby scripts to interface with a SQLite database. syntax (1.0.0) Syntax is Ruby library for performing simple syntax highlighting. tattle (1.0.3) Tattle is a little reporting script used for collecting system information from the Ruby community. win32-clipboard (0.4.3) A package for interacting with the Windows clipboard win32-dir (0.3.2) Extra constants and methods for the Dir class on Windows. win32-eventlog (0.4.4) Interface for the MS Windows Event Log. win32-file (0.5.4) Extra or redefined methods for the File class on Windows. win32-file-stat (1.2.5) A File::Stat class tailored to MS Windows win32-process (0.5.3) Adds fork, wait, wait2, waitpid, waitpid2 and a special kill method win32-sapi (0.1.4) An interface to the MS SAPI (Sound API) library. win32-sound (0.4.1) A library for playing with sound on MS Windows. windows-api (0.1.1) An easier way to create methods using Win32API windows-pr (0.6.6) Windows functions and constants predefined via Win32API ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=12979&group_id=85 From noreply at rubyforge.org Sun Aug 12 15:21:44 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sun, 12 Aug 2007 15:21:44 -0400 (EDT) Subject: [Win32utils-devel] [ win32utils-Bugs-12979 ] Error while trying to update my gem collection Message-ID: <20070812192144.1BEB45240B41@rubyforge.org> Bugs item #12979, was opened at 2007-08-10 21:29 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=12979&group_id=85 Category: windows-pr Group: None Status: Open Resolution: None Priority: 3 Submitted By: Nobody (None) Assigned to: Nobody (None) Summary: Error while trying to update my gem collection Initial Comment: C:\ruby>gem update Updating installed gems... Attempting remote update of windows-pr ERROR: While executing gem ... (OpenURI::HTTPError) 404 Not Found C:\ruby>ruby -v ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32] C:\ruby>gem --version 0.9.4 ---------------------------------------------------------------------- Comment By: Dejan Dimic (dima) Date: 2007-08-12 21:21 Message: Now it works. You should close this one. ---------------------------------------------------------------------- Comment By: Dejan Dimic (dima) Date: 2007-08-10 21:36 Message: I forgot to add my gem list if that could be somehow in correlation C:\ruby>gem list *** LOCAL GEMS *** actionmailer (1.3.3) Service layer for easy email delivery and testing. actionpack (1.13.3) Web-flow and rendering framework putting the VC in MVC. actionwebservice (1.2.3) Web service support for Action Pack. activerecord (1.15.3) Implements the ActiveRecord pattern for ORM. activesupport (1.4.2) Support and utility classes used by the Rails framework. cgi_multipart_eof_fix (2.2) Fix an exploitable bug in CGI multipart parsing which affects Ruby <= 1.8.5 when multipart boundary attribute contains a non-halting regular expression string. dbf (1.0.1) A small fast library for reading dBase, xBase, Clipper and FoxPro database files. fxri (0.3.6) Graphical interface to the RI documentation, with search engine. fxruby (1.6.11) FXRuby is the Ruby binding to the FOX GUI toolkit. gem_plugin (0.2.2) A plugin system based only on rubygems that uses dependencies only hoe (1.2.2) Hoe is a way to write Rakefiles much easier and cleaner. hpricot (0.6) a swift, liberal HTML parser with a fantastic library httpclient (2.1.0) gives something like the functionality of libwww-perl (LWP) in Ruby log4r (1.0.5) Log4r is a comprehensive and flexible logging library for Ruby. mongrel (1.0.1) A small fast HTTP library and server that runs Rails, Camping, Nitro and Iowa apps. newgem (0.11.0) Make your own gems at home rails (1.2.3) Web-application framework with template engine, control-flow layer, and ORM. rake (0.7.3) Ruby based make-like utility. RedCloth (3.0.4) RedCloth is a module for using Textile and Markdown in Ruby. Textile and Markdown are text formats. A very simple text format. Another stab at making readable text that can be converted to HTML. ruby-debug (0.9.3) Command line interface (CLI) for ruby-debug-base ruby-debug-base (0.9.3) Fast Ruby debugger ruby-debug-ide (0.1.8) IDE interface for ruby-debug. ruby-postgres (0.7.1.2006.04.06) Ruby extension library providing an API to PostgreSQL ruby-prof (0.5.2) Fast Ruby profiler rubyforge (0.4.3) A script which automates a limited set of rubyforge operations. rubygems-update (0.9.4) RubyGems Update GEM soap4r (1.5.7) An implementation of SOAP 1.1 for Ruby. sources (0.0.1) This package provides download sources for remote gem installation sqlite3-ruby (1.2.1) SQLite3/Ruby is a module to allow Ruby scripts to interface with a SQLite database. syntax (1.0.0) Syntax is Ruby library for performing simple syntax highlighting. tattle (1.0.3) Tattle is a little reporting script used for collecting system information from the Ruby community. win32-clipboard (0.4.3) A package for interacting with the Windows clipboard win32-dir (0.3.2) Extra constants and methods for the Dir class on Windows. win32-eventlog (0.4.4) Interface for the MS Windows Event Log. win32-file (0.5.4) Extra or redefined methods for the File class on Windows. win32-file-stat (1.2.5) A File::Stat class tailored to MS Windows win32-process (0.5.3) Adds fork, wait, wait2, waitpid, waitpid2 and a special kill method win32-sapi (0.1.4) An interface to the MS SAPI (Sound API) library. win32-sound (0.4.1) A library for playing with sound on MS Windows. windows-api (0.1.1) An easier way to create methods using Win32API windows-pr (0.6.6) Windows functions and constants predefined via Win32API ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=12979&group_id=85 From noreply at rubyforge.org Sun Aug 12 18:07:26 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sun, 12 Aug 2007 18:07:26 -0400 (EDT) Subject: [Win32utils-devel] [ win32utils-Bugs-12979 ] Error while trying to update my gem collection Message-ID: <20070812220726.4B18B5240DA8@rubyforge.org> Bugs item #12979, was opened at 2007-08-10 12:29 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=12979&group_id=85 Category: windows-pr Group: None >Status: Closed >Resolution: Rejected Priority: 3 Submitted By: Nobody (None) Assigned to: Nobody (None) Summary: Error while trying to update my gem collection Initial Comment: C:\ruby>gem update Updating installed gems... Attempting remote update of windows-pr ERROR: While executing gem ... (OpenURI::HTTPError) 404 Not Found C:\ruby>ruby -v ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32] C:\ruby>gem --version 0.9.4 ---------------------------------------------------------------------- >Comment By: Daniel Berger (djberg96) Date: 2007-08-12 15:07 Message: Yep, pretty sure it was a DNS issue with rubygems.org. Dan ---------------------------------------------------------------------- Comment By: Dejan Dimic (dima) Date: 2007-08-12 12:21 Message: Now it works. You should close this one. ---------------------------------------------------------------------- Comment By: Dejan Dimic (dima) Date: 2007-08-10 12:36 Message: I forgot to add my gem list if that could be somehow in correlation C:\ruby>gem list *** LOCAL GEMS *** actionmailer (1.3.3) Service layer for easy email delivery and testing. actionpack (1.13.3) Web-flow and rendering framework putting the VC in MVC. actionwebservice (1.2.3) Web service support for Action Pack. activerecord (1.15.3) Implements the ActiveRecord pattern for ORM. activesupport (1.4.2) Support and utility classes used by the Rails framework. cgi_multipart_eof_fix (2.2) Fix an exploitable bug in CGI multipart parsing which affects Ruby <= 1.8.5 when multipart boundary attribute contains a non-halting regular expression string. dbf (1.0.1) A small fast library for reading dBase, xBase, Clipper and FoxPro database files. fxri (0.3.6) Graphical interface to the RI documentation, with search engine. fxruby (1.6.11) FXRuby is the Ruby binding to the FOX GUI toolkit. gem_plugin (0.2.2) A plugin system based only on rubygems that uses dependencies only hoe (1.2.2) Hoe is a way to write Rakefiles much easier and cleaner. hpricot (0.6) a swift, liberal HTML parser with a fantastic library httpclient (2.1.0) gives something like the functionality of libwww-perl (LWP) in Ruby log4r (1.0.5) Log4r is a comprehensive and flexible logging library for Ruby. mongrel (1.0.1) A small fast HTTP library and server that runs Rails, Camping, Nitro and Iowa apps. newgem (0.11.0) Make your own gems at home rails (1.2.3) Web-application framework with template engine, control-flow layer, and ORM. rake (0.7.3) Ruby based make-like utility. RedCloth (3.0.4) RedCloth is a module for using Textile and Markdown in Ruby. Textile and Markdown are text formats. A very simple text format. Another stab at making readable text that can be converted to HTML. ruby-debug (0.9.3) Command line interface (CLI) for ruby-debug-base ruby-debug-base (0.9.3) Fast Ruby debugger ruby-debug-ide (0.1.8) IDE interface for ruby-debug. ruby-postgres (0.7.1.2006.04.06) Ruby extension library providing an API to PostgreSQL ruby-prof (0.5.2) Fast Ruby profiler rubyforge (0.4.3) A script which automates a limited set of rubyforge operations. rubygems-update (0.9.4) RubyGems Update GEM soap4r (1.5.7) An implementation of SOAP 1.1 for Ruby. sources (0.0.1) This package provides download sources for remote gem installation sqlite3-ruby (1.2.1) SQLite3/Ruby is a module to allow Ruby scripts to interface with a SQLite database. syntax (1.0.0) Syntax is Ruby library for performing simple syntax highlighting. tattle (1.0.3) Tattle is a little reporting script used for collecting system information from the Ruby community. win32-clipboard (0.4.3) A package for interacting with the Windows clipboard win32-dir (0.3.2) Extra constants and methods for the Dir class on Windows. win32-eventlog (0.4.4) Interface for the MS Windows Event Log. win32-file (0.5.4) Extra or redefined methods for the File class on Windows. win32-file-stat (1.2.5) A File::Stat class tailored to MS Windows win32-process (0.5.3) Adds fork, wait, wait2, waitpid, waitpid2 and a special kill method win32-sapi (0.1.4) An interface to the MS SAPI (Sound API) library. win32-sound (0.4.1) A library for playing with sound on MS Windows. windows-api (0.1.1) An easier way to create methods using Win32API windows-pr (0.6.6) Windows functions and constants predefined via Win32API ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=12979&group_id=85 From noreply at rubyforge.org Tue Aug 14 18:17:50 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Tue, 14 Aug 2007 18:17:50 -0400 (EDT) Subject: [Win32utils-devel] [ win32utils-Bugs-10555 ] wait call in while loop generate "bignum too big to convert into long" error Message-ID: <20070814221750.CC1955240B98@rubyforge.org> Bugs item #10555, was opened at 2007-05-03 09:48 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=10555&group_id=85 Category: win32-changejournal Group: Code Status: Open Resolution: None Priority: 3 Submitted By: Dong Zhang (dzhang) Assigned to: Park Heesob (phasis68) >Summary: wait call in while loop generate "bignum too big to convert into long" error Initial Comment: I put the following in a test.rb file. This code comes with the source of Changejournal. ************************************************** require "win32/changejournal" include Win32 # Indefinitely wait for a change in 'C:\' and any of its # subdirectories. Print the file and action affected. cj = ChangeJournal.new('C:\') # A ChangeJournal server :) cj.wait{ |array| array.each{ |info| p info.file_name p info.action p info.path } } while true ********************************************** the script will run for a while, then quit with the following error test.rb:10:in `wait': bignum too big to convert into `long long' (RangeError) from test.rb:10 my pc is XP, sp2, with ruby 1.8.5 (2006-12-25 patchlevel 12) I downloaded the changejournal-0.3.1.so file, renamed it changejournal.so, and drop it in C:\ruby\lib\ruby\site_ruby\1.8\i386-msvcrt\win32. ---------------------------------------------------------------------- >Comment By: Daniel Berger (djberg96) Date: 2007-08-14 15:17 Message: I think instead of doing another release of this as a C extension, we'll convert it to pure Ruby. I've already started on it, and there's an (incomplete) version in CVS. I'll keep this bug open until it's released, however. Dan ---------------------------------------------------------------------- Comment By: Park Heesob (phasis68) Date: 2007-05-04 20:53 Message: I guess the macro NUM2LL should be NUM2ULL in changejournal.h. Regards, Park Heesob ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=10555&group_id=85 From djberg96 at gmail.com Wed Aug 22 22:26:09 2007 From: djberg96 at gmail.com (Daniel Berger) Date: Wed, 22 Aug 2007 20:26:09 -0600 Subject: [Win32utils-devel] Bug in win32-eventlog, grabbing descriptions Message-ID: <46CCF041.6010900@gmail.com> Hi all, I know that once upon a time I said that we shouldn't use DONT_RESOLVE_DLL_REFERENCES (line 698), but it appears that this was wrong headed thinking for win32-eventlog. A couple of folks have complained that they couldn't get descriptions for event records in some cases, and I have a strong feeling that's the culprit. Can anyone see a downside to using DONT_RESOLVE_DLL_REFERENCES? If not I'm going to commit that change and put out a new release this weekend. Thanks, Dan From Daniel.Berger at qwest.com Thu Aug 23 14:44:46 2007 From: Daniel.Berger at qwest.com (Berger, Daniel) Date: Thu, 23 Aug 2007 13:44:46 -0500 Subject: [Win32utils-devel] Getting event log descriptions from remote servers Message-ID: <7524A45A1A5B264FA4809E2156496CFBE72D9A@ITOMAE2KM01.AD.QINTRA.COM> Hi all, Looks like there's still an issue reading descriptions from remote event logs. From Andrew Garberoglio: "I was, however, able to devise a hack by setting up parallel registry key on my workstation with alternate paths to the event source libraries, which I copied from a Windows Server 2003 machine to my workstation. Following that, I then modified the value of BASE_KEY in eventlog.rb to point to the parallel registry key I created." Looks like we need to call RegConnectRegistry() if @server is set, and pass that handle to RegOpenKeyEx(). That sound right? Thanks, Dan This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments. From djberg96 at gmail.com Sat Aug 25 18:34:12 2007 From: djberg96 at gmail.com (Daniel Berger) Date: Sat, 25 Aug 2007 16:34:12 -0600 Subject: [Win32utils-devel] Speeding up win32-eventlog Message-ID: <46D0AE64.2090407@gmail.com> Hi all, I released win32-eventlog 0.4.5 today. It's still a bit on the slow side. The profiler (and general testing) indicates that it's line 696 that's the major culprit: va_list = str.split(0.chr)[0...num] Other than changing 0.chr to a literal "\0", does anyone have a way to speed this up? It's not crucial, but I thought it might make a nice benchmarking challenge for folks on the list. :) Regards, Dan From phasis at gmail.com Sat Aug 25 22:58:14 2007 From: phasis at gmail.com (Heesob Park) Date: Sun, 26 Aug 2007 11:58:14 +0900 Subject: [Win32utils-devel] Speeding up win32-eventlog In-Reply-To: <46D0AE64.2090407@gmail.com> References: <46D0AE64.2090407@gmail.com> Message-ID: Hi, 2007/8/26, Daniel Berger : > > Hi all, > > I released win32-eventlog 0.4.5 today. It's still a bit on the slow > side. The profiler (and general testing) indicates that it's line 696 > that's the major culprit: > > va_list = str.split(0.chr)[0...num] > > Other than changing 0.chr to a literal "\0", does anyone have a way to > speed this up? > > It's not crucial, but I thought it might make a nice benchmarking > challenge for folks on the list. :) > > Regards, > > Dan How about this? va_list = str.unpack('Z*' * num) In my test, it is faster thousandfold than split. Regards, Park Heesob -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20070826/53f587e0/attachment.html From Daniel.Berger at qwest.com Mon Aug 27 10:21:29 2007 From: Daniel.Berger at qwest.com (Berger, Daniel) Date: Mon, 27 Aug 2007 09:21:29 -0500 Subject: [Win32utils-devel] Speeding up win32-eventlog In-Reply-To: Message-ID: <7524A45A1A5B264FA4809E2156496CFBE72DAE@ITOMAE2KM01.AD.QINTRA.COM> Excellent, thanks! I did some experiments where i sent the event description of each version (split vs unpack) to a file and diff'ed the files. It seems that your version is also better at handling descriptions with leading whitespace/newlines/other stuff. For example, with the old (split) version I see a description like this: 8??Scan could not open file With the unpack version that leading garbage is gone. To anyone else reading: There is one other potential issue that requires deeper analysis where a few eventlog descriptions did not match what the event viewer showed (on my home laptop), using either split or unpack, possibly related to nested null's. This is being handled offline at the moment, but I'll update the list if necessary. Regards, Dan -----Original Message----- From: win32utils-devel-bounces at rubyforge.org [mailto:win32utils-devel-bounces at rubyforge.org] On Behalf Of Heesob Park Sent: Saturday, August 25, 2007 8:58 PM To: Development and ideas for win32utils projects Subject: Re: [Win32utils-devel] Speeding up win32-eventlog Hi, 2007/8/26, Daniel Berger : Hi all, I released win32-eventlog 0.4.5 today. It's still a bit on the slow side. The profiler (and general testing) indicates that it's line 696 that's the major culprit: va_list = str.split(0.chr)[0...num] Other than changing 0.chr to a literal "\0", does anyone have a way to speed this up? It's not crucial, but I thought it might make a nice benchmarking challenge for folks on the list. :) Regards, Dan How about this? va_list = str.unpack('Z*' * num) In my test, it is faster thousandfold than split. Regards, Park Heesob This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20070827/bbfc06c3/attachment.html From noreply at rubyforge.org Fri Aug 31 15:07:35 2007 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Fri, 31 Aug 2007 15:07:35 -0400 (EDT) Subject: [Win32utils-devel] [ win32utils-Bugs-13560 ] Service dependencies has wierd string. Message-ID: <20070831190736.0F2EC5240CCB@rubyforge.org> Bugs item #13560, was opened at 2007-08-31 15:07 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=13560&group_id=85 Category: win32-service Group: None Status: Open Resolution: None Priority: 3 Submitted By: Nobody (None) Assigned to: Nobody (None) Summary: Service dependencies has wierd string. Initial Comment: Hello, My name is Jong Lee from Virginia, USA. I am using win32/service which version is 0.5.2. I think I am using latest version. Following code displays service name, type and dependencies. Service.services do |s| puts "#{s.service_name} - #{s.service_type}" s.dependencies.each {|d| puts " " + d} if s.dependencies != nil end Most of results are fine but some of them are displaying wierd string as follwoing. --------------------------------------------- wscsvc - share process RpcSs winmgmt t calSystem tem curity Center Center r on Driver Extensions ver Extensions tensions ns Service e Service ce --------------------------------------------- WSTCODEC - kernel driver --------------------------------------------- wuauserv - share process --------------------------------------------- WZCSVC - share process RpcSs Ndisuio o calSystem tem reless Zero Configuration Zero Configuration Configuration uration n tensions ns Service e Service ce I debugged service.c and service.h and found something wrong. I modified the function "rb_get_dependencies" from service.h like following and it works fine. static VALUE rb_get_dependencies(LPTSTR lpDependencies){ VALUE v_dependencies = rb_ary_new(); if(lpDependencies){ TCHAR* pszDepend = 0; int i = 0; pszDepend = &lpDependencies[i]; while(*pszDepend != 0){ rb_ary_push(v_dependencies, rb_str_new2(pszDepend)); //i += _tcslen(lpDependencies) + 1; <-- Original code i += _tcslen(&(lpDependencies[i])) + 1; // <-- Modified code pszDepend = &lpDependencies[i]; } } if(RARRAY(v_dependencies)->len == 0) v_dependencies = Qnil; return v_dependencies; } The modified module displays as following and I think this change solves the problem. --------------------------------------------- wscsvc - share process RpcSs winmgmt --------------------------------------------- WSTCODEC - kernel driver --------------------------------------------- wuauserv - share process --------------------------------------------- WZCSVC - share process RpcSs Ndisuio Thanks, Jong Lee (jolinhama at gmail dot com) ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=13560&group_id=85