|
Boost : |
From: james_at_[hidden]
Date: 2006-03-10 11:32:08
Hi,
There appears to be problems with boost::filesystem::rename with respect to the information returned by
boost:filesystem::filesystem_error exception.
See the 2 tests below and attached source code examples.
Test 1:
Precondition:
The "Source" file does not exist and the "Destination" file does exist.
Test:
Perform rename(Source,Destination);
Expected Result:
The rename fails because the Source file does not exist.
Actual Result:
A boost filesystem exception is thrown and the output is
what text: boost::filesystem::rename: "Source", "Destination": Success
error_code: 1
native_error: 0
The exception information suggests the command was successful.
The result of a UNIX "mv" with the same scenario is
"mv: cannot stat `Source': No such file or directory"
Note that a similar output is displayed if the "Source" and "Destination"
files exist before the test is run.
Test 2:
Precondition:
The "Source" and "Destination" files exist.
The directory DirWithNoWritePermission exists and has permissions 555.
Tests:
Perform rename(Source,DirWithNoWritePermission/Anything);
Perform rename(Source,Destination);
Expected Result:
The first rename fails because the directory permissions forbid the rename.
The second rename fails because the destination file exists.
Actual Result:
A boost filesystem exception is thrown and the output is
what text: boost::filesystem::rename: "Source", "DirWithNoWritePermission/Anything": Permission denied
error_code: 3
native_error: 13
and is the same in both cases. It appears that the exception information displayed for the
second test has been "recalled" from the first test. This may be related to the problem
shown in Test 1.
Test programs run under Suse Enterprise Linux 9 with gcc version 3.3.3, boost 1_33_0 and 1_33_1
Regards
James Massey
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk