Boost logo

Boost :

From: Jeremy Maitin-Shepard (jbms_at_[hidden])
Date: 2004-02-01 23:19:35

Beman Dawes <bdawes_at_[hidden]> writes:

> At 05:51 PM 2/1/2004, Jeremy Maitin-Shepard wrote:

> [snip]

>> I would suggest that the function throw an exception if either file
>> does not exist. The exception would allow the user to determine
>> exactly which paths exist or do not exist. Any other behavior, given
>> that the function can return only true or false, would in some
>> circumstances give the user less information than desired.

> Regardless of what the function does, the user can always call
> exists() beforehand if a complete understanding of what is present and
> what isn't is required.

Yes, but using two separate calls introduces race conditions.
Filesystem race conditions, which can be a source of security
vulnerabilities in programs, are extremely common, and I think it is
important for this library to discourage them.

>>> Question 3: The implementation on Windows (see below) leaves a small
>>> hole in that duplicated media (such as two CD's) mounted on devices
>>> with the same device id on two different networked machines would be
>>> reported as equivalent.
>> Does Windows actually assign networked devices device ids which are
>> also used for local devices?

> Yes, and I confirmed that by testing. The device id is just an ordinal
> number corresponding to the drive letter. a=0, b=1, c=2, etc. So two
> networked machines have the same device id for their c: drives.

Hmm okay, in that case I would agree that the use of things like volume
serial numbers and file times is warranted.

> [snip]

>> As with Windows, do you know of any POSIX platforms that sometimes give
>> two devices the same device id?

> Not for sure, but knowing the history of device id's and volume serial numbers,
> it wouldn't surprise me if that happened when Unix was first ported to
> mainframes. In a world where there may be dozens of mounts per second, performed
> by robotic tape librarians on a drive available basis, only volume serial
> numbers are seen as reliable to establish media identity, while device id's are
> seen as physical hardware addresses which should be accurately
> reported. Networking hadn't been invented yet. If that happened, then that
> existing practice could have been preserved right to this day.


Jeremy Maitin-Shepard

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