Loading ...
Sorry, an error occurred while loading the content.

"bug" in FileId() ?

Expand Messages
  • Peter Galbavy
    Apologies for not being a subscriber to the list. My bad. I will subscribe shortly, but I want to get this one out for comment. In 2.49, the t/inode_names test
    Message 1 of 4 , Nov 20, 2002
    • 0 Attachment
      Apologies for not being a subscriber to the list. My bad. I will subscribe
      shortly, but I want to get this one out for comment.

      In 2.49, the t/inode_names test failed on OpenBSD/i386 (3.2-current). After
      quite a bit of head scratching, I >think< I know what the problem is;

      The test of the stat elements [0] and [1] (in sub FileId() around line
      540 -below) is redundent and will always fail where an OS may return '0' for
      either value - in this case I think that 'dev' is '0' for the root
      filesystem on OpenBSD:

      my @inode_stat = ();
      if($self->{inode_names}) {
      print STDERR "\ninode_names is SET\n";
      @inode_stat = stat($file);
      unless($inode_stat[0] && $inode_stat[1]) {
      @inode_stat = ();
      }
      }

      perl's stat() returns and empty array if the stat fails, so the above code
      can be reduced to:

      my @inode_stat = ();
      if($self->{inode_names}) {
      print STDERR "\ninode_names is SET\n";
      @inode_stat = stat($file);
      }

      And it now works for me and passes all tests.

      Obviously, this could just be me misunderstanding what this is meant to do,
      and I am happy to be enlightened.

      rgds,
      --
      Peter Galbavy
      Knowtion Ltd.


      ---------------------------------------------------------------------
      To unsubscribe, e-mail: asp-unsubscribe@...
      For additional commands, e-mail: asp-help@...
    • Josh Chamas
      ... For now, let s try this code: if($self- {inode_names}) { @inode_stat = stat($file); # one or the other device or file ids must be not 0
      Message 2 of 4 , Nov 20, 2002
      • 0 Attachment
        Peter Galbavy wrote:
        >
        > perl's stat() returns and empty array if the stat fails, so the above code
        > can be reduced to:
        >
        > my @inode_stat = ();
        > if($self->{inode_names}) {
        > print STDERR "\ninode_names is SET\n";
        > @inode_stat = stat($file);
        > }
        >
        > And it now works for me and passes all tests.
        >

        For now, let's try this code:

        if($self->{inode_names}) {
        @inode_stat = stat($file);
        # one or the other device or file ids must be not 0
        unless($inode_stat[0] || $inode_stat[1]) {
        @inode_stat = ();
        }

        What I would like to avoid is having InodeNames try to work on
        any system for which device and file ids are 0

        I'll send you a copy of this distribution privately so you
        can test on your system.

        Regards,

        Josh

        ________________________________________________________________
        Josh Chamas, Founder phone:925-552-0128
        Chamas Enterprises Inc. http://www.chamas.com
        NodeWorks Link Checking http://www.nodeworks.com


        ---------------------------------------------------------------------
        To unsubscribe, e-mail: asp-unsubscribe@...
        For additional commands, e-mail: asp-help@...
      • Ian Cass
        ... But surely on some weird systems that might be valid? If the stat call fails, it will return undef. It should therefore be safe to assume that if the stat
        Message 3 of 4 , Nov 21, 2002
        • 0 Attachment
          > What I would like to avoid is having InodeNames try to work on
          > any system for which device and file ids are 0

          But surely on some weird systems that might be valid? If the stat call
          fails, it will return undef. It should therefore be safe to assume that if
          the stat call does not return undef, it has suceeded and the results are
          valid?

          --
          Ian Cass


          ---------------------------------------------------------------------
          To unsubscribe, e-mail: asp-unsubscribe@...
          For additional commands, e-mail: asp-help@...
        • Josh Chamas
          ... Its not that the stat call would fail, but that the dev/file inode portions returned on the stat call would be meaningless, like 0,0 or undef,undef I
          Message 4 of 4 , Nov 21, 2002
          • 0 Attachment
            Ian Cass wrote:
            >>What I would like to avoid is having InodeNames try to work on
            >>any system for which device and file ids are 0
            >
            >
            > But surely on some weird systems that might be valid? If the stat call
            > fails, it will return undef. It should therefore be safe to assume that if
            > the stat call does not return undef, it has suceeded and the results are
            > valid?
            >

            Its not that the stat call would fail, but that the
            dev/file inode portions returned on the stat call
            would be meaningless, like 0,0 or undef,undef

            I believe I saw this a long while back on some win32 perl,
            so that is why I test for the inode numbers at all.

            Regards,

            Josh
            ________________________________________________________________
            Josh Chamas, Founder phone:925-552-0128
            Chamas Enterprises Inc. http://www.chamas.com
            NodeWorks Link Checking http://www.nodeworks.com


            ---------------------------------------------------------------------
            To unsubscribe, e-mail: asp-unsubscribe@...
            For additional commands, e-mail: asp-help@...
          Your message has been successfully submitted and would be delivered to recipients shortly.