Forum: Ruby Cygwin: Dir.glob ALWAYS accesses floppy??

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Hugh S. (Guest)
on 2008-10-21 18:07
(Received via mailing list)
I'm finding under Cygwin, with

ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-cygwin]

that if I Dir.glob(path) for a path under /cygdrive/c, the floppy
drive is accessed.  I'm trying to avoid a Huge recursive glob that
for a user appears to just hang, so I trying to descend directories
recursively, but this is slowed down a lot, because for every glob
the floppy drive becomes active for about half a second, and it's
noisy [!].

There have been problems with 1.7 Cygwin always accessing the floppy,
but this is 1.5.25, so that should not matter.

Has anyone else seen this, and is there a workaround?  I need tools
that I have under Cygwin only, so not using Cygwin here will involve
a lot more work to find other tools to do those parts that presently
work.

also, is anything else faster than Dir.glob?  I'll have a look at
File.find later, in case that is, but it would be nice to know....

        Thank you,
        Hugh
Victor G. (Guest)
on 2008-10-22 00:15
(Received via mailing list)
If cygwin is installed on your c drive, then you will want to avoid
certain directories during your traversal.

Linux / Unix / Cygwin has a directory that is responsible for your
devices, and they are all 'files'.  This would be the reason.

In the case of Cygwin, you will want to avoid your c:\cygwin\dev
directory which should map to /dev
Hugh S. (Guest)
on 2008-10-22 01:28
(Received via mailing list)
On Wed, 22 Oct 2008, Victor H. Goff III wrote:

> If cygwin is installed on your c drive, then you will want to avoid
> certain directories during your traversal.
>
> Linux / Unix / Cygwin has a directory that is responsible for your
> devices, and they are all 'files'.  This would be the reason.
>
> In the case of Cygwin, you will want to avoid your c:\cygwin\dev
> directory which should map to /dev

I'm avoiding that, I'm doing
   Dir.["/cygdrive/c/Documents and Settings/hgs/**/*{.rb,.pl,.txt}"]
which should not go near /dev or /cygdrive/a.
If I break that up to not use ** but glob each directory in turn,
the A: drive gets hammered with activity, one hit per glob.  This is
on WinXP SP3, by the way.

I'm at a loss to account for this....

        Thank you,
        Hugh
Robert K. (Guest)
on 2008-10-22 11:04
(Received via mailing list)
Welcome back, Hugh!

2008/10/21 Hugh S. <removed_email_address@domain.invalid>:
>
>
> On Wed, 22 Oct 2008, Victor H. Goff III wrote:
>
> I'm avoiding that, I'm doing
>   Dir.["/cygdrive/c/Documents and Settings/hgs/**/*{.rb,.pl,.txt}"]
> which should not go near /dev or /cygdrive/a.
> If I break that up to not use ** but glob each directory in turn,
> the A: drive gets hammered with activity, one hit per glob.  This is
> on WinXP SP3, by the way.

I do not have this issue with my cygwin 1.5.25.

> I'm at a loss to account for this....

Did you check your environment for critical entries that point to the
floppy, like PATH, HOME, LD_LIBRARY_PATH, RUBYLIB?  You could also use
"strace" to see what the interpreter does - maybe that gives you a
hint what causes the floppy access. The only other thing that comes to
mind is a virus scanner that for some reason during drive accesses
checks the floppy.

Kind regards

robert
Hugh S. (Guest)
on 2008-10-22 13:55
(Received via mailing list)
On Wed, 22 Oct 2008, Robert K. wrote:

> Welcome back, Hugh!

I'll probably disappear again soon, the traffic levels are rather
high :-) But I'll be back from time to time.
> > the A: drive gets hammered with activity, one hit per glob.  This is
> > on WinXP SP3, by the way.
>
> I do not have this issue with my cygwin 1.5.25.
>
> > I'm at a loss to account for this....
>
> Did you check your environment for critical entries that point to the
> floppy, like PATH, HOME, LD_LIBRARY_PATH, RUBYLIB?  You could also use

None of those reference /cygdrive/a or A:
> "strace" to see what the interpreter does - maybe that gives you a

Hmm, strange.
strace ruby -e 'puts Dir["/cygdrive/c/*{.txt,.bat}"]'
doesn't touch the A drive.  I wonder.  I'll have to strace the
program I'm running, itself.  Probably something messes with the
definition of glob.

It's ferret_helper, from Stuart R., which I've modified in other
places but nothing directly to do with Dir[].

> hint what causes the floppy access. The only other thing that comes to
> mind is a virus scanner that for some reason during drive accesses
> checks the floppy.

Does Symantec Endpoint Protection do that?  Why not for the short
example?  It will take me a while to figure that out!
>
> Kind regards
>
> robert
>
> --
> remember.guy do |as, often| as.you_can - without end

I'm still lost for words about that....
>

        Hugh
Hugh S. (Guest)
on 2008-10-22 22:09
(Received via mailing list)
Following up to myself, but anyway:

On Wed, 22 Oct 2008, Hugh S. wrote:

> > >   Dir.["/cygdrive/c/Documents and Settings/hgs/**/*{.rb,.pl,.txt}"]
> > floppy, like PATH, HOME, LD_LIBRARY_PATH, RUBYLIB?  You could also use
>
> None of those reference /cygdrive/a or A:
> > "strace" to see what the interpreter does - maybe that gives you a
>
> Hmm, strange.
> strace ruby -e 'puts Dir["/cygdrive/c/*{.txt,.bat}"]'
> doesn't touch the A drive.  I wonder.  I'll have to strace the
> program I'm running, itself.  Probably something messes with the
> definition of glob.

I've not done this yet, partly because there is a Huge amount of output
from strace, and I'm not entirely sure what to search for, but partly
because I have investigated other things
>
> It's ferret_helper, from Stuart R., which I've modified in other
> places but nothing directly to do with Dir[].

ferret_helper does not redefine methods of Dir anywhere that I can see.
It does have its own methods that handle directories, implemented in C,
but none of these seem to affect globbing.
>
> > hint what causes the floppy access. The only other thing that comes to
> > mind is a virus scanner that for some reason during drive accesses
> > checks the floppy.
>
> Does Symantec Endpoint Protection do that?  Why not for the short
> example?  It will take me a while to figure that out!

No closer to finding out about that.

The globbing on my Windows XP system took over a day.  I'm thinking of
rewriting that bit using File.find.  I've also found that I can't kill
it
with <ctrl-C> while it is globbing.
Robert K. (Guest)
on 2008-10-23 09:55
(Received via mailing list)
On 22.10.2008 20:05, Hugh S. wrote:
> Following up to myself, but anyway:
>
> On Wed, 22 Oct 2008, Hugh S. wrote:
>
>> On Wed, 22 Oct 2008, Robert K. wrote:
>>
>>> 2008/10/21 Hugh S. <removed_email_address@domain.invalid>:

>> strace ruby -e 'puts Dir["/cygdrive/c/*{.txt,.bat}"]'
>> doesn't touch the A drive.  I wonder.  I'll have to strace the
>> program I'm running, itself.  Probably something messes with the
>> definition of glob.
>
> I've not done this yet, partly because there is a Huge amount of output
> from strace, and I'm not entirely sure what to search for, but partly
> because I have investigated other things

I would be searching for "/cygdrive/a" and see what you get.  If that
fails, I'd probably search for "/cygdrive" only and then for IO calls
("open" and the like).

>>> hint what causes the floppy access. The only other thing that comes to
>>> mind is a virus scanner that for some reason during drive accesses
>>> checks the floppy.
>> Does Symantec Endpoint Protection do that?  Why not for the short
>> example?  It will take me a while to figure that out!
>
> No closer to finding out about that.

No traces in documentation about handling of removable disks?

> The globbing on my Windows XP system took over a day.  I'm thinking of
> rewriting that bit using File.find.  I've also found that I can't kill it
> with <ctrl-C> while it is globbing.

:-)

Kind regards

  robert
Hugh S. (Guest)
on 2008-10-23 13:56
(Received via mailing list)
On Thu, 23 Oct 2008, Robert K. wrote:

> > > doesn't touch the A drive.  I wonder.  I'll have to strace the program I'm
> > > running, itself.  Probably something messes with the
> > > definition of glob.
> >
> > I've not done this yet, partly because there is a Huge amount of output
> > from strace, and I'm not entirely sure what to search for, but partly
> > because I have investigated other things
>
> I would be searching for "/cygdrive/a" and see what you get.  If that fails,
> I'd probably search for "/cygdrive" only and then for IO calls ("open" and the
> like).


Thanks.

This problem just gets better.  I've not rebooted, but now it is not
accessing the A: drive.  With or without strace, the drive is not
accessed.

I didn't see eny refs to /cygdrive/a when I did
strace ruby ./ff.rb -i ~ | grep -C 8 /cygdrive/a
and dropping the /a turns up way too much.

Just retried, and now it does access it but the grep still doesn't find
anything.  It is using the correct ruby -- the cygwin one.

OK, I think I won't pursue this any further, because it feels like
"we're on a road to nowhere".  I got the version with
Find.find working last night, so I'm going to see if that finishes
in a sensible amount of time.

I think there's enough of this left in the archives for someone else
to explore it.  I'm using Ferret_helper, and version 1.1.1, to get these
problems.  1.2.1 will use Find.find.  My release which should have had
the number 1.2.0 after I took it over from Stuart R. didn't get the
number updated, but it uses the same as 1.1.0 for this bit of code.
So if anyone poking in the archives feels inclined to explore this
further...

I think all will change with cygwin 1.7 anyway, though.
>
> > The globbing on my Windows XP system took over a day.  I'm thinking of
> > rewriting that bit using File.find.  I've also found that I can't kill it
> > with <ctrl-C> while it is globbing.
>
> :-)
>
> Kind regards
>
>   robert
>
        Thank you,
        Hugh
This topic is locked and can not be replied to.