Opened 10 years ago
Closed 6 years ago
#7307 closed Bugs (fixed)
boost::filesystem::remove_all(dirname,ec) throws on write protected directories
Reported by: | Owned by: | Beman Dawes | |
---|---|---|---|
Milestone: | To Be Determined | Component: | filesystem |
Version: | Boost 1.50.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Hi there,
according to the documentation, functions with error_code should not throw except if storage cannot be allocated.
The following throws if directory "bla" exists but is write protected:
string bla("bla"); boost::system::error_code ec; boost::filesystem::remove_all(bla,ec);
The bla directory looks like this:
ls -l bla d--------- 2 bach bach 4096 2012-08-30 23:56 bla
Output of the program is:
terminate called after throwing an instance of "boost::filesystem::filesystem_error" what(): boost::filesystem::directory_iterator::construct: Permission denied: "bla" Aborted
System: Ubuntu 9.10 Boost: 1.50, looking through change notes for 1.51 I did not see any entries for filesystem which could address this.
Best,
Bastien
Change History (4)
comment:1 by , 10 years ago
Component: | None → filesystem |
---|---|
Owner: | set to |
comment:3 by , 7 years ago
comment:5 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Hopefully fixed. Here is the commit message: Fix #7307, remove_all(dirname,ec) throws on write protected directories. This is a tough one to test. There are three internal function calls where errors might arise, and it would take too much time to write tests for each of those cases. Someday we will have Titus Winter's mock installable file system, but for now are relying on code inspection rather than testing.
Thanks for the bug report!
--Beman
Any update on when this will be fixed ? I am new to this code so apologies if I misunderstood anything.
remove_all_aux() may have forgotten to pass the error_code argument to the constructor to the constructor of directory_iterator().