|Filesystem Release History|
|Home Tutorial Reference FAQ Releases Portability V4 V3 Intro V3 Design Deprecated Bug Reports|
ERROR_ACCESS_DENIEDerror. This may allow
symlink_statusto succeed for system files and directories that are not reparse points or symlinks. (#234)
ERROR_INVALID_PARAMETERwhen querying file attributes. This affected
symlink_status, which reported that files do not exist, and directory iterators, which failed to construct, as well as other dependent operations. (#236, #237)
ENOSYSin runtime. The
sendfilefallback implementation used to skip the filesystem type check and could fail for some filesystems.
openatand related APIs defined in POSIX.1-2008 and on Windows Vista and later, improved protection of
remove_allagainst CVE-2022-21658 that was implemented in the previous release. The previous fix could still result in removing unintended files in certain conditions. Other systems remain vulnerable.
path::replace_extensionnow works in terms of v3 definition of
path::extensionrather than v4.
pathor compatible string type. (#223)
O_NOFOLLOWand on Windows,
remove_allis now protected against CVE-2022-21658. The vulnerability is a race condition that allows a third party process to replace a directory that is being concurrently processed by
remove_allwith a directory symlink and cause
remove_allto follow the symlink and remove files in the linked directory instead of removing the symlink itself. (#224)
remove_allimplementation, use POSIX semantics for file removal, when supported by the OS (Windows 10 1709 and later). When POSIX semantics is supported, the file name is removed from the filesystem namespace as soon as the file is marked for deletion, even if it is still open and in use. With legacy Windows semantics, the file name remains present in the the filesystem namespace until the last file handle to the file is closed, which allows the file marked for deletion to be opened and prevents creating new files with the same name. (#216)
remove_allnow support deleting read-only directories. Support for removing read-only non-directory files was added previously.
directory_iteratorinternal implementation has been reworked to better utilize modern Windows APIs, which may improve performance while handling symlinks.
resize_fileshould no longer fail with an error if the file to be resized is opened.
statxsyscall on Android prior to 11.0 (API version 30). The syscall is blacklisted by seccomp and causes process termination in runtime. (#229)
boost/filesystem/string_file.hppheader is deprecated and will be removed in a future release. The header is no longer included by
boost/filesystem.hppby default. Users are advised to implement the functionality themselves or migrate to other implementations.
path::iteratorno longer return an implicit trailing dot (".") element if the path ends with a directory separator. Instead, an empty path is returned, similar to C++17 std::filesystem. This also affects other methods that are defined in terms of iterators or filename, such as
lexicographical_compare. For example,
path("a/b/") == path("a/b/.")no longer holds true. (#193)
path::lexically_normalno longer produce a trailing dot (".") element and omits a directory separator after a trailing dot-dot ("..") element in the normalized paths.
pathappend operations now consider root name and root directory in the appended path. If the appended path is absolute, or root name is present and differs from the source path, the resulting path is equivalent to the appended path. If root directory is present, the result is the root directory and relative path rebased on top of the root name of the source path. Otherwise, the behavior is similar to v3. (#214)
path::lexically_normalnow converts directory separators to preferred separators in the root name of the normalized paths.
path::concatand the corresponding operators to avoid unnecessary path copying and reduce the amount of code redundancy.
absolute(p, base)returning a path with root name
pstarts with a root directory. In such a case
pis already an absolute path and should be returned as is.
create_directoriesno longer reports an error if the input path consists entirely of dot (".") and dot-dot ("..") elements. The implementation is no longer using recursion internally and therefore is better protected from stack overflow on extremely long paths.
removenow supports deleting read-only files. The operation will attempt to reset the read-only attribute prior to removal. Note that this introduces a possibility of the read-only attribute being left unset, if the operation fails and the original value of the attribute fails to be restored. This also affects
static_cast< uintmax_t >(-1)in case of error, similar to C++17 std::filesystem.
boost/container_hash/hash.hppand the compiler is set to preserve unused inline functions. (#215)
BOOST_FILESYSTEM_VERSIONmacro to either 3 or 4 when compiling their code. There is no need to separately compile Boost.Filesystem for each library version — a single binary supports both v3 and v4. Users should avoid using both v3 and v4 in the same application as this can lead to subtle bugs. Currently, v3 is the default. In a future release v4 will become the default, and eventually v3 will be removed. v4 is functional, but it is still a work in progress and there may be breaking API changes in the future.
path::extensionno longer consider root name or root directory of the path as a filename if the path only consists of those components. For example, on Windows
path("C:").filename()used to return "C:" and
path("C:\\").filename()used to return "\" and both will return an empty path now. (#88, #194)
path::extensionno longer treat a filename that starts with a dot and has no other dots as an extension. Filenames starting with a dot are commonly treated as filenames with an empty extension. The leading dot is used to indicate a hidden file on most UNIX-like systems. (#88)
path("\\\\.\\").stem() == "\\\\"). It is recommended to use the prefixes only with Boost.Filesystem v4.
path::lexically_normalimplementation to eliminate some cases of duplicate dot (".") elements in the normalized paths.
getrandomsystem calls on Linux. This can be useful if the syscall is present at compile time but fails with
ENOSYSat run time (for example, in Docker containers that restrict the syscall, even if available on the host). (#172)
copy_options::synchronizeoptions for the
copy_fileoperation. These options allow to synchronize the written data and attributes with the permanent storage. These options are expensive in terms of performance, but allow to ensure reliability of the copied data. Note that
copy_fileperformed implicit data synchronization on POSIX systems since Boost.Filesystem 1.74.0. This release adds support for more platforms and disables data synchronization by default while allowing the caller to explicitly request it. (#186)
EINTRerror code on POSIX systems for some system calls issued internally. In particular,
EINTRcould have been ignored on
close, which on HP-UX would result in a leaked file descriptor.
copy_fileimplementations based on Linux
copy_file_rangesystem calls, added handling of error codes indicating that a particular filesystem does not support the system call and fall back to the generic
writeloop. This should fix
copy_filefailing on eCryptFS and possibly other filesystems. (#184)
copy_file_rangesystem call is now used since Linux kernel 4.5, whereas previously it was only enabled since 5.3. The
copy_fileimplementation will fall back to
copy_file_rangefails to copy a given file across filesystems.
copy_fileimplementations based on Linux
copy_file_rangesystem calls will not be used on filesystems that are known to contain files with generated content. These system calls are incompatible with such files, and copying them would result in zero-sized files. The generic
writeloop will be used instead. Currently, the blacklisted filesystems are: procfs, sysfs, tracefs and debugfs.
copy_fileimplementation based on
writeloop, increased the maximum size of the buffer used for temporary storage and take into account the target filesystem block size for more optimal performance.
current_pathto obtain the current path for a process will now fail with an error instead of returning successfully with a root path. This platform does not support current directory. Changing the current path was already failing similarly in previous releases of Boost.Filesystem.
canonical, fixed the check for a symlink referencing a directory above root, if an earlier symlink was resolved to an absolute path with a different root from the original path.
canonical, added a limit for the maximum number of symlinks that can be resolved during the call. The limit is currently at least 40 symlinks.
weakly_canonicalwill now use
path::preferred_separatorfor the root directory separator in the resulting paths. This fixes "file not found" errors caused by Windows API not handling generic separators in UNC paths and paths that start with the Win32 filesystem prefix ("\\?\"). (#87, #187)
basepath as an argument.
weakly_canonicalno longer fails with an error if the input path contains elements that do not exist in the filesystem but are cancelled by a subsequent dot-dot ("..") element. For example,
weakly_canonical("C:\\a\\..")would previously fail if "C:\a" directory did not exist. (#201)
read_symlinkon Windows, corrected reparse point handling. The operation would return an empty path for some mount points (for example, created by Box cloud storage driver) and directory junction points that had empty print names. The new implementation now parses substitute name of the reparse point and attempts to reconstruct a Win32 path from it. (#187)
boost/filesystem/fstream.hppwill use wide character paths on libc++ versions 7.0 and higher, when the standard library supports opening files with wide character paths. (#181)
path::imbue. The supported compilers include MSVC, GCC and Clang, as well as other compilers that support customizing program initialization order through
#pragma section(for MSVC-compatible compilers) or
__attribute__ ((init_priority))(for GCC-compatible compilers).
path::remove_filenameif the path is "////". (#176)
create_directoriesdisregarding errors from file status query operations issued internally. This could result in incorrect error codes returned by
creation_timeoperation, which allows to obtain file creation time. (Inspired by PR#134)
last_write_time(p, ec)operation in case of failure has been changed to a minimal value representable by
std::time_tinstead of -1.
hard_link_count(p, ec)operation in case of failure has been changed to
static_cast<uintmax_t>(-1)instead of 0.
file_sizewill now indicate error code
errc::function_not_supportedif the path resolves to a non-regular file. Previously,
statxsystem call internally, when possible, which allows to reduce the amount of information queried from the filesystem and potentially improve performance. The
statxsystem call was introduced in Linux kernel 4.11.
const-qualification from return types of some
pathmethods. This could prevent move construction and move assignment at the call site in some cases. (#160)
statvfssystem call to obtain filesystem space information. (Inspired by PR#162)
spacenow returns with an error if the provided path does not idendify an existing file. (#167)
read_symlinkon Windows. This also affects other algorithms that involve
read_symlinkin their implementation. (PR#100, #85, #99, #123, #125)
read_symlinkon Windows could potentially fail or cause failures elsewhere with a sharing violation error, if the same symlink was opened concurrently. (#138)
is_symlink(directory_entry)would always return
false, even if the directory entry actually referred to a symlink. (PR#148)
is_directory(directory_entry, error_code&)). Removed incorrect
noexceptspecifications for the overloads not taking the
copy_fileimplementation has been updated to perform checks on the source and target files, as required by C++20 ([fs.op.copy.file]/4.1). In particular, the operation will fail if the source or target file is not a regular file or the source and target paths identify the same file.
copy_fileon POSIX systems will now also copy the source file permissions to the target file, if the target file is overwritten.
copy_fileimplementations based on
copy_file_rangesystem calls on Linux, which may improve file copying performance, especially on network filesystems.
copy_optionenumeration that is used with the
copy_fileoperation is deprecated. As a replacement, the new enum
copy_options(note the trailing 's') has been added. The new enum contains values similar to the
copy_optionsenum from C++20. The old enum values are mapped onto the new enum. The old enum will be removed in a future release.
copy_options::skip_existingoption, which allows
copy_fileoperation to succeed without overwriting the target file, if it exists.
copy_options::update_existingoption, which allows
copy_fileoperation to conditionally overwrite the target file, if it exists, if its last write time is older than that of the replacement file.
bool, which indicates whether the file was copied.
copyoperation has been extended and reworked to implement behavior specified in C++20 [fs.op.copy]. This includes support for
copy_options::create_hard_linksoptions. The operation performs additional checks based on the specified options. Applying
copyto a directory with default
copy_optionswill now also copy files residing in that directory (but not nested directories or files in those directories).
create_directoryoverload taking two paths. The second path is a path to an existing directory, which is used as a source of permission attributes to use in the directory to create.
copy_directoryoperation has been deprecated in favor of the new
create_directoryoverload. Note that the two operations have reversed order of the path arguments.
equivalenton POSIX systems now returns the actual error code from the OS if one of the paths does not resolve to a file. Previously the function would return an error code of 1. (#141)
equivalentno longer considers file size and last modification time in order to test whether the two paths refer to the same file. These checks could result in a false negative if the file was modified during the
current_path()as the default value of their arguments and also have an
error_codeargument will use the
current_path(error_code& ec)overload to obtain the current path, so that its failure is reported via the
error_codeargument instead of an exception.
spacenow initializes the
space_infostructure members to -1 values on error, as required by C++20 ([fs.op.space]/1).
spaceon Windows now accepts paths referring to arbitrary files, not only directories. This is similar to POSIX systems and corresponds to the operation description in C++20. (#73)
temp_directory_pathfor Windows CE. (PR#25)
unique_pathoperation based on
arc4random_buf(OpenBSD/FreeBSD/CloudABI) and BCrypt (Windows) system APIs.
file_statusand associated enums and functions to
operations.hppstill includes the new headers
BOOST_FILESYSTEM_NO_DEPRECATEDmacro is defined. These implicit includes are considered deprecated and will be removed in a future release. Users are encouraged to include the new headers directly or include
filesystem_errorexception is now implemented in the compiled library of Boost.Filesystem. Users may need to add linking with Boost.Filesystem library in their projects.
utimeis declared obsolete in POSIX.1-2008 and can be disabled e.g. in uClibc-ng. (PR#115)
directory_iteratoris now left in the end state on memory allocation errors.
directory_iteratoron POSIX systems, support for
readdir_rhas been reworked to avoid memory allocations for
readdiris used. This reduces memory consumption and eliminates the possibility of buffer overruns in case if
readdirproduces a very long directory name.
directory_optionsenum, which reflects the same named enum from C++20. The enum is supported in
recursive_directory_iteratorto customize iteration behavior. In particular, the iterators now support skipping directories that can't be opened due to insufficient permissions. The
symlink_optionenum is now deprecated and should be replaced with
recursive_directory_iteratoris now reset to the end state in case of errors, as required by C++20. (#112)
directory_options::pop_on_erroroption, which configures
recursive_directory_iteratorso that it attempts to recover from iteration errors by repeatedly invoking
pop()until it succeeds or the end state is reached. (#113)
directory_options::skip_dangling_symlinksoption, which configures
recursive_directory_iteratorso that it doesn't follow dangling directory symlinks and continues iteration instead of reporting an error.
recursive_directory_iteratorare now marked as deprecated:
no_push(). Users are advised to replace their use with the standard counterparts:
disable_recursion_pending(). Note that
recursion_pending()has the opposite meaning compared to
no_push_request(). Deprecated methods will be removed in a future release.
path::lexically_relative(and any dependent algorithms) to correctly handle empty, dot and dot-dot path elements in its argument. The behavior is made closer to C++17
std::path::lexically_relativein that empty and dot path elements are ignored and dot-dot path elements are accounted by decreasing the number of dot-dot path elements to generate in the resulting relative path. (#76)
error_codereturned from directory iterator increment when
path, fixed rvalue-aware
operator/return type to return an rvalue instead of rvalue reference. This fixes leaving a dangling reference in the user's code if the result of
operator/is bound to a const reference. (#110)
std::string::end()in path implementation.
read_symlinkimplementation to avoid possible memory exhaustion on broken or tampered with filesystems. The functions now have an internal limit of the path size they will accept from the OS, which is currently 16 MiB.
readdir_ron Linux and Android since the
readdirfunction is already thread-safe. (PR#68, #72)
boost::filesystem::copydue to undefined behavior in the implementation. (PR#71)
error_codeparameter should not throw on error. Thanks to ldqrk for pull request #42
space(p, ec). Thanks to cmuellner for pull request #39.
operations_testfailure on MinGW: MinGW defines __MINGW32__ rather than _MSC_VER, so also test for __MINGW32__ to see if setenv/unsetenv workaround needed.
generic() function name: The undocumented experimental class
path member function
generic() has been renamed
gives problems in C++/CLI. Unless the macro BOOST_FILESYSTEM_NO_DEPRECATED
is defined, the original
generic() will continue to be supplied
as a workaround for existing user code. But
deprecated. User code should migrate to the new name.
pathadds constexpr constants
dotof the type appropriate for the platform, and adds query functions
filename_is_dot_dot. These add convenience and the implementations may be more efficient that user coded equivalent functions.
recursive_directory_iteratorequality testing has existed more than a dozen years. Nowadays test driven development would likely have detected the problem in early development. Sigh.
create_directories()crashes when passed empty string as path, from Samantha Ritter. Also affected
create_directory(). Charles Olivi submitted a pull request with some particularly helpful test cases.
pathstem(), extension() member functions. Thanks to faithandbrave for pull request #31
push_directory()internal logic so it is easier to reason about.
New: Added functions
weakly_canonical. Many thanks to Jamie Allsop for his help and
perseverance. Resolves tickets
noexceptsupplied as specified in the Filesystem TS if supported by the compiler.
size()function to class
path. Resolves #6874, Path should have a size() member function.
unique_pathby applying pull request #15 from Sebastian Redl. Also fixes #7506,
unique_pathFails on Windows for Temporary User Profiles.
recursive_directory_iterator: C++ turns an explicit constructor with all arguments except first defaulted into non-explicit single argument constructor.
Fix #11288, A patch to avoid redundant string allocations, by applying a patch submitted by Yevhen Ivannikov.
create_directories returns false if the path ends with a slash.
Also fix related issues if path contains dot or dot-dot
elements, and added test cases to the test suite.
Reference docs editorial cleanups: Use same style sheet as the rest of the documentation. Tweak tab font size. Fix excessively long lines in tables, synopsis.
filename()sections of the reference docs.
pathreverse iteration feature. The reference documentation has also been updated with a note warning about the limitations of class
temp_directory_path()doesn't return valid temp path on Android.
temp_directory_path()to (1) avoid
GetTempPath()failure if path length > 130 (ticket #5300) and (2) provide a more sensible sequence of directories than provided by
GetTempPath(), per boost list discussion "[filesystem] temp_directory_path() behavior on Windows". The new sequence is:
pathlocale and codecvt implementation for increased reliability. This change was SVN revision 83021, which should have gone into 1.56.0 but unfortunately the merge didn't happen until too late.
mklink /j link target". There is no plan for Boost.Filesystem to be able to create them directly other than by calling
recursive_directory_iterator::increment, adding an invariant that progress is always made, even if an error is reported by exception or error_code. Add a manually executed test,
test/issues/recurse_dir_iter_5403.cpp. Adjust regular regression tests as needed. Thanks to Claudio Bley for the pull request - the change was incorporated into the reorganized code. Fixes #5403 and #6821.
canonical()to treat parent of root as root. (Christian Hammerl) Fixes #9683 and #10187.
__sunmacro which is defined on Solaris 10. (Chris Stylianou)
const char colonto clear clang warning. (J?gen Hunold)
perms::perms_maskto absolute values to quiet intellisense warnings, and conform to C++11.
path::imbue()with portable code that is intended to be much more robust and maintainable. A section on path usage concerns has been added to the reference documentation describing several concerns that arise in the context of multithreading and
create_directories(":D"). The reported problem was a symptom of an internal bug that caused
path::parent_path()to fail on Windows for
path(":"), and that in turn caused other functions that depend on
parent_path()to fail, such as
constexpr value_type preferred_separatorto class path.
replace_extensiondoesn't work as specified in documentation. The documentation, implementation, and test cases have all had fixes applied. The documentation had failed to mention that any existing extension is removed. The behavior for simple cases has been reverted to the Version 2 behavior, but with corrections so that complex replacements now work. Two test cases from #5118 have been added.
comparefor consistency with std::string.
recursive_directory_iterator, allowing control over recursion into directory symlinks. Note that the default is changed to not recurse into directory symlinks.
© Copyright Beman Dawes, 2011
© Copyright Andrey Semashev, 2019-2021
Use, modification, and distribution are subject to the Boost Software License, Version 1.0. See www.boost.org/LICENSE_1_0.txt