Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2005-03-17 20:58:03

At 11:59 AM 3/17/2005, Martin Bonner wrote:
>----Original Message----
>From: Robert Mathews [mailto:rmathews_at_[hidden]]
>Sent: 17 March 2005 14:56
>To: boost_at_[hidden]
>Subject: [boost] Re: [Boost-bugs] [ boost-Bugs-1164057
>]boost::filesystem::exists has bugs with UNC paths
>>> Initial Comment:
>>> boost::filesystem::exists(path("//computer")) always
>>> fails, even if the computer exists.
>I shall call this, Issue A.
>>> boost::filesystem::exists(path("//computer/share"))
>>> always succeeds, even if the share doesn't exist.
>... and this Issue B.
>> Can anyone actually comment on when or if this bug might actually get
>> fixed? It's an obvious bug, the fix is a trivial amount of work - it
>> comes with a patch that I've tested on Win32 ....
>Well, as I have indicated above, there are two separate and distinct


>Issue B does seem like a bug to me. On the other hand, does your fix
>it so that //computer/printer is reported as a filesystem? That would be
>step backwards.

A true return from exists() doesn't make any claim that the path is to a
filesystem. Consider this program:

#include <iostream>
#include <fstream>

int main( int argc, char * argv[] )
   std::ofstream os( argv[1] );
   if ( !os )
     std::cout << "Could not open " << argv[1] << std::endl;
     return 1;
   os << "Hello, printer!\n";
   return 0;

The network name of my machine is "bgd". It has a shared printer named
"NECSuper". If I invoke the above program (named "test") like this:

>test \\bgd\NECSuper

A page gets printed with text: "Hello, printer!"


>test con:
    Hello, printer!


>test \\bgd
    Could not open \\bgd

>test \\bgd\no_such
    Could not open \\bgd\no_such

So I would likewise expect calls to exists("//bgd/NECSuper" ) and
exists("con:") to return true, and a call to exists("//bgd/no_such") to
return false.

My initial feeling about exists("//bgd") is that it should return false,
but I'm not very sure about that one and would like to hear more opinions.

Thanks for the comments,


Boost list run by bdawes at, gregod at, cpdaniel at, john at