in reply to Re^3: Filesize (-s) is consistenly reporting too small of size in Win32
in thread Filesize (-s) is consistenly reporting too small of size in Win32

Just a thought... "dir" in Windows doesn't cache, does it? That's the only possible thing I can think of. I was careful to be sure that I was testing against the same filename in "dir" and "-s".


Nature is not cruel, pitiless, indifferent. This is one of the hardest lessons for humans to learn. We cannot admit that things might be neither good nor evil, neither cruel nor kind, but simply callous — indifferent to all suffering, lacking all purpose.
- Richard Dawkins
  • Comment on Re^4: Filesize (-s) is consistenly reporting too small of size in Win32

Replies are listed 'Best First'.
Re^5: Filesize (-s) is consistenly reporting too small of size in Win32
by BrowserUk (Patriarch) on Jan 17, 2009 at 12:01 UTC
    Just a thought... "dir" in Windows doesn't cache, does it?

    Nope. The file may (probably is given its small size) cache in the file system cache, but there is no way for it to be updated without the cache being flushed. If that were possible, we (and the world) would have heard about it long ago.

    And there is no way that a re-boot fixed it, cos there's no way for the OP scenario to happen. Perl, dir, explorer and every other program that will show you the size of the file queries that information using the same system API.

    The only possibility that I can think of to explain what you saw is that the file was updated between obtaining the two figures--but that doesn't sit well with your "consistantly" claim.

    Think about it. XP has been around for 7 years. Perl has run on Win32 for 10+ years. If this was a possibilty, someone (else) would have noticed it by now.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      I agree. But the file wasn't being changed between filesize tests. If I were on the otherside of this, I'd assume the user is an idiot and that they made a dumb user error. I may have, but I haven't found it yet. If I do find such a thing, I'll come back and note it just in case some other poor sap does the same dumb thing. Until then, it's a mystery to me.

      Just FYI: My WinXP environment is running on VMware Server using a virtual hard disk (not hosted on a remote share or anything) hosted on a Linux server. I doubt that it affects this... and I certainly hope it doesn't. I'd rather hope I'm just an idiot and that I missed something obvious. Time will tell.


      Nature is not cruel, pitiless, indifferent. This is one of the hardest lessons for humans to learn. We cannot admit that things might be neither good nor evil, neither cruel nor kind, but simply callous — indifferent to all suffering, lacking all purpose.
      - Richard Dawkins

        It might also be a hardware problem. I once had all kinds of similar weirdnesses that eventually turned out to be a simple hardware issue. The entire case story would be too long to tell, but the upshot of it is just this: you wouldn't believe what weird effects a slowly dying power supply with the occasional associated bit errors in RAM may produce...  (and our minds are very good at trying to put meaning into the (sometimes random) coincidences we observe :)

        Maybe something to add to the conversation: I keep getting wperl.exe crashes randomly now. I think maybe my filesystem is dying or something equally terrible is going on. Either it's a coincidence or it's part of the cause.


        If you want to do evil, science provides the most powerful weapons to do evil; but equally, if you want to do good, science puts into your hands the most powerful tools to do so.
        - Richard Dawkins