#6 Open directory, not file

closed-fixed
File I/O (2)
8
2002-09-05
2002-05-08
No

Trying to open a file in a directory (like ":test:foo") when there is a file of the name of that directory (e.g., ":test") opens the file instead of failing.

This was discovered when "use Test::More" tried to execute the "TEST" file in the current directory, in the perl test suite.

Discussion

  • Matthias Neeracher

    • assigned_to: neeri --> pudge
    • status: open --> open-fixed
     
  • Matthias Neeracher

    Logged In: YES
    user_id=37219

    GUSIMPW.nw,1.18

    --- src/GUSIMPW.nw 23 Jul 2001 06:34:30 -0000 1.17
    +++ src/GUSIMPW.nw 30 Aug 2002 07:00:36 -0000
    @@ -252,12 +252,12 @@
    <<Member functions for class [[GUSIMPWDevice]]>>=
    bool GUSIMPWDevice::Want(GUSIFileToken & file)
    {
    - switch (file.WhichRequest()) {
    - case GUSIFileToken::kWillOpen:
    - return !file.IsDevice() || (file.StrStdStream(file.Path()) > -1);
    - default:
    - return false;
    - }
    + if (file.WhichRequest() != GUSIFileToken::kWillOpen)
    + return false; // Won't handle anything but open
    + if (file.IsDevice()) // Handle standard devices
    + return file.StrStdStream(file.Path()) > -1;
    + else // File or its parent directory must exist
    + return file.Error() ? file.Error() == fnfErr : file.Exists();
    }
    @

     
  • Chris Nandor

    Chris Nandor - 2002-09-05
    • status: open-fixed --> closed-fixed
     
  • Chris Nandor

    Chris Nandor - 2002-09-05

    Logged In: YES
    user_id=3660

    Veirfied (ran MacPerl test suite without moving TEST file
    around, as I normally did)

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks