Opened 13 years ago

Closed 12 years ago

#3867 closed Bugs (fixed)

[filesystem] filesystem::exists() improperly throws on windows when path specifies an empty CD/DVD drive

Reported by: David Grigsby Owned by: Beman Dawes
Milestone: Boost 1.42.0 Component: filesystem
Version: Boost 1.41.0 Severity: Problem
Keywords: Cc:

Description

If you call filesystem::exists() with a path pointing to an empty cd/dvd drive on windows, a filesystem exception will be thrown due to status_template returning fs::status_unknown.

Boost 1.41.0 returns fs::file_not_found for "USB card reader with no card inserted" (operations.cpp, line 195).

The comment is "these are not considered errors; the status is considered not found".

I believe an empty cd/dvd drive should be treated analogously to an empty USB card reader, that is, no exception should be thrown.

The exception is occurring because the error code returned by windows (ERROR_NOT_READY) is not in the list of codes that are specifically checked.

I am attaching a patch.

Thanks!

Attachments (1)

patchfile.patch (701 bytes ) - added by David Grigsby <dgrigsby@…> 13 years ago.
patch top operations.cpp with proposed fix

Download all attachments as: .zip

Change History (2)

by David Grigsby <dgrigsby@…>, 13 years ago

Attachment: patchfile.patch added

patch top operations.cpp with proposed fix

comment:1 by Beman Dawes, 12 years ago

Resolution: fixed
Status: newclosed

(In [62218]) Fix #3867, both for ERROR_NOT_READY and ERROR_INVALID_DRIVE. These happen when CD/DVD drive has no disc and USB card reader has no card, respectively.

Note: See TracTickets for help on using tickets.