Commit Graph

1549 Commits

Author SHA1 Message Date
Andrey Semashev
d316a9d3aa Use std::less to detect string overlap in path::append.
Pointer ordering is unspecified if the pointers are to unrelated
objects, which triggers ASAN warnings. Use std::less to avoid this.

Closes https://github.com/boostorg/filesystem/issues/335.
boost-1.89.0
2025-06-21 03:32:25 +03:00
Andrey Semashev
a737b1947e Simplified path_algorithms::append_separator_if_needed. 2025-06-21 03:32:17 +03:00
Andrey Semashev
8dc455e00b Made has-config-flag more flexible.
The has-config-flag rule now matches any value of the checked macro and
is able to test multiple macros in one call.
2025-06-19 02:51:11 +03:00
Andrey Semashev
f7ed6b5ea9 Change searched-lib to lib in the Jamfile.
Apparently, searched-lib was not supposed to be used in libraries,
and the simple lib target is the preferred way to declare external
libraries.

https://github.com/bfgroup/b2/issues/431#issuecomment-2985057673
2025-06-19 02:44:26 +03:00
Andrey Semashev
3fa413e5f9 Removed MinGW-w64 gcc 6 AppVeyor job.
The compiler doesn't provide synchronization lib, which is needed by
Boost.Atomic.
2025-06-14 12:08:06 +03:00
Andrey Semashev
5a7e76d556 Extend the dllimport workaround to any gcc 12.
At least, gcc on Cygwin also emits the same bogus warnings about
missing dllimport attributes. Presumably, this may also be the case
for visibility attributes, so just disable the warning universally
on any gcc 12.
2025-06-13 18:36:55 +03:00
Andrey Semashev
1be9ea7f04 Disable the gcc 12 warning about dllimport in directory.hpp.
The warnings suppressed in header.hpp can be force-enabled by the user,
so disable the buggy warning in directory.hpp instead. Also make the
workaround more specific to MinGW.
2025-06-13 03:18:50 +03:00
Andrey Semashev
9e11731148 Work around bogus warning in MinGW-w64 gcc 12 about missing dllimport.
Disable the warning for gcc 12.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106395
2025-06-13 03:06:39 +03:00
Andrey Semashev
4a1a4658c4 Added new gcc and clang jobs to GitHub Actions. 2025-06-13 02:57:07 +03:00
Andrey Semashev
53d0780142 Use Azure mirrors of Ubuntu .deb repositories in containers.
This reduces the likelihood of spurious CI failures caused by DDoS filters
being triggered by massive numbers of concurrent CI jobs.
2025-06-13 02:11:52 +03:00
Andrey Semashev
133df3b03b Removed windows-2019 GitHub Actions jobs.
The windows-2019 image is deprecated and is about to be removed.
2025-06-13 02:09:14 +03:00
Andrey Semashev
f4bb6d0f3e Removed usage of obsolete ubuntu-20.04 GHA image. 2025-04-19 18:23:12 +03:00
Andrey Semashev
c7e1448803 Moved symloop_max constant into POSIX-specific section.
The constant is not used in the Windows-specific code and causes
clang warnings.

Closes https://github.com/boostorg/filesystem/pull/332.
2025-04-05 15:29:00 +03:00
Andrey Semashev
30b312e5c0 Removed clang-15 with libc++ job.
We're already testing libc++ with clang-19, so remove the job with clang-15
to save some CI time.
boost-1.88.0.beta1 boost-1.88.0
2024-12-16 00:45:03 +03:00
Andrey Semashev
6a0efe79c2 Updated GitHub Actions CI.
Removed macos-12 job as the image has been removed from GHA. Added
new compilers and updated the old ones to avoid using external
package repositories. Added CMake testing with MinGW-w64.
2024-12-15 21:36:43 +03:00
Andrey Semashev
59433a9984 Added max CMake version 3.16.
This should resolve CMake warnings.
2024-12-15 19:23:28 +03:00
Andrey Semashev
0848f5347b Canonicalize root paths in tests.
Since the current and initial paths on Windows may have non-canonical
root paths (i.e. "c:\" instead of "C:\"), path comparisons may fail
because of the case differences between the canonicalized paths and
the expected paths. To avoid these spurious failures, canonicalize root
paths in all expected paths.
boost-1.87.0.beta1 boost-1.87.0
2024-10-11 16:00:39 +03:00
Andrey Semashev
cf92e38f2f Corrected comments. 2024-10-03 13:47:07 +03:00
Andrey Semashev
bf29b81a36 Added a workaround for dirfd being a macro on FreeBSD 9 and older.
Fixes https://github.com/boostorg/filesystem/issues/328.
2024-10-03 13:26:18 +03:00
Andrey Semashev
fbd23ee0e0 Prevent templated path members from accepting args convertible to path.
This forces the non-templated overloads accepting path to be chosen instead
of the templated members that expect arguments converible to Source.

This resolves overload resolution ambiguities, when the argument of a
user-defined type is convertible to path and multiple other types that qualify
as Source. By preferring the conversion to path we avoid testing other
conversion paths that may be ambiguous.

Fixes https://github.com/boostorg/filesystem/issues/326.
2024-09-30 02:53:06 +03:00
René Ferdinand Rivera Morell
5746b3f0d6 Add support for modular build structure. (#318)
* Make the library modular usable.

* Use searched-lib targets for external/OS/Windows libraries to avoid trying to refer to mangled names for them. And hence failing to find them.

* Use the OS temp dir for creating test dir to avoid putting dirs in random location based on where one runs tests from.

* Switch to library requirements instead of source. As source puts extra source in install targets.

* Updated dependencies.

* Add missing NO_LIB usage requirements.

* Add missing import-search for cconfig/predef checks.

* Add requires-b2 check to top-level build file.

* Bump B2 require to 5.2

* Change all <source> references to <library>.

* Update copyright dates.

* Move inter-lib dependencies to a project variable and into the build targets.

* Split b2 dependencies into public and private.

* Undo temp dir for test change.

* Make winapi dep target-os specific. And remove direct atomic dep as it is already handled by conditional rule.

* Remove bug targets from all build as that's not a regular project.
2024-09-22 19:57:37 +03:00
Andrey Semashev
dc94c80f4b Specify _WIN32_WINNT=0x0A00 in build system scripts to target Windows 10. 2024-09-16 23:55:58 +03:00
Andrey Semashev
11beaba974 Reimplement canonical in terms of GetFinalPathNameByHandleW on Windows.
This moves the common part of v3 and v4 canonical() to a separate
function and changes the Windows implementation to use
GetFinalPathNameByHandleW system call. As a side effect, this converts
drive names to upper case, which makes paths more interoperable.

Additionally, on POSIX systems, avoid adding a trailing directory
separator if the input path has one (which may be the case in v4). This
is consistent with libstdc++ and MSVC implementations of std::filesystem.

Fixes https://github.com/boostorg/filesystem/issues/325.
2024-09-16 21:19:10 +03:00
Andrey Semashev
01cadd08e4 Added C++23 testing to MSYS2 jobs. 2024-08-26 15:16:13 +03:00
Andrey Semashev
c4ffb7bf47 Merge pull request #323 from Flamefire/function-ptr-cast
Avoid -Wcast-function-type in get_proc_addr
2024-08-26 15:14:50 +03:00
Alexander Grund
4a687b1bc1 Avoid -Wcast-function-type in get_proc_addr 2024-08-26 13:32:18 +02:00
Andrey Semashev
35f348ad00 Merge pull request #322 from Flamefire/mingw
Add CI jobs for MinGW32/64
2024-08-26 14:13:04 +03:00
Alexander Grund
51b6ae06a6 Remove actions/checkout and Boost.CI 2024-08-25 20:02:52 +02:00
Alexander Grund
f1bf0e01e2 Fix build on MinGW-w64 x86
32 bit version of MinGW-64 __MINGW64__ is not defined
2024-08-25 18:56:45 +02:00
Alexander Grund
3f26465afb Remove C++03 build 2024-08-25 18:56:45 +02:00
Alexander Grund
ac94c483e5 Add CI jobs for MinGW32/64 2024-08-25 17:55:38 +02:00
Andrey Semashev
5dc58be3cd Changed suppression of signed/unsigned mismatch to explicit casts.
Turns out, suppressing -Wsign-compare doesn't work on gcc 8 in MinGW-w64
at least in one instance. So we have to do it the hard way and explicitly
cast NTSTATUS values on every comparison.
2024-08-25 18:09:53 +03:00
Andrey Semashev
bfb06365b3 Disable -Wsign-compare on Windows.
STATUS_* constants defined in ntstatus.h are defined as DWORDs, and NTSTATUS
is long. This results in signed/unsigned mismatch warnings emitted by gcc and
clang. Consider that a platform bug and disable the warning.

Closes https://github.com/boostorg/filesystem/issues/321.
2024-08-25 16:12:07 +03:00
Andrey Semashev
41a990ef14 Fix weakly_canonical with relative input paths.
When weakly_canonical was called with a relative input path, the operation
would test path elements for existence, which meant resolving them relative
to the current path instead of the base path specified in the call. To
mitigate this, make the source path absolute using the specified base path.

As a side effect, this fixes incorrect path produced on Windows if the
input path started with "..". The algorithm was unable to remove the last
element of the head path because there was none. As a result, the remaining
elements of the input path were appended to the full base path by canonical.

Fixes to https://github.com/boostorg/filesystem/issues/311.
boost-1.86.0.beta1 boost-1.86.0
2024-07-03 15:02:47 +03:00
Andrey Semashev
c8093eeb7a Update test order to avoid spurious test failures due to timing.
copy_file_tests with copy_options::update_existing used to fail sometimes,
when the last modification timestamps on the test files were close enough.
Run the tests after a pause to make sure the timestamps are far enough apart.
2024-06-29 14:39:56 +03:00
Andrey Semashev
9f8dea7353 Don't throw in directory_entry::refresh if the file doesn't exist.
This makes directory_entry::status, directory_entry::symlink_status, as well
as related methods behave similarly to the equivalent standalone operations.

std::filesystem specification for directory_entry::refresh doesn't explicitly
say that the file not existing is not an error, but it does say that
directory_entry::status and directory_entry::symlink_status should behave
the same way as the standalone operations. Currently, libstdc++, libc++
and MSVC standard library all avoid throwing the exception from
directory_entry::refresh if the file doesn't exist.

Closes https://github.com/boostorg/filesystem/issues/314.
2024-06-29 14:00:49 +03:00
Andrey Semashev
7ff9487376 Corrected test console output. 2024-06-19 13:48:26 +03:00
Andrey Semashev
5d16e6bd00 Fixed file_size and is_empty for symlinks on Windows. Reworked is_empty.
GetFileAttributesExW that was used to implement file_size and is_empty
on Windows returns information about the symlink rather than the file
the symlink refers to. Fix this by opening the file and using
GetFileInformationByHandle to obtain the file size and attributes.

Additionally, reworked is_empty implementation to reuse the file handle
(and fd on POSIX systems) to create the directory iterator if the
operation is invoked on a directory. On POSIX systems, implement a
more lightweight version of is_empty_directory when readdir is safe
to use. Reusing the file handle/fd improves protection against
filesystem races, when the file that is being tested by is_empty
is initially a directory and then, when we create a directory
iterator, it is not.

Fixes https://github.com/boostorg/filesystem/issues/313.
2024-06-18 22:33:20 +03:00
Andrey Semashev
3274d64e2a Added macos-12 and 13 testing in addition to latest (which is 14). 2024-05-21 01:09:26 +03:00
Andrey Semashev
94132ebe49 Use macos-latest image as macos-11 is being removed. 2024-05-21 01:01:59 +03:00
Andrey Semashev
a0c8edba38 Documentation fixes. boost-1.85.0 2024-03-24 00:10:13 +03:00
Andrey Semashev
6f174ba143 Moved Boost.Core to private dependencies in CMakeLists.txt. boost-1.85.0.beta1 2024-02-20 04:10:50 +03:00
Andrey Semashev
4fa79df681 Removed unnecessary include. 2024-02-20 04:07:33 +03:00
Andrey Semashev
7bdccb0d2f Use <type_traits>, when possible. 2024-02-20 01:38:29 +03:00
Andrey Semashev
46af0a9514 Use unique_ptr instead of Boost.SmartPtr scoped_* pointers. 2024-02-20 01:04:32 +03:00
Andrey Semashev
8dd5b0e0ad Use unique_resource on Windows to wrap HANDLEs. 2024-02-20 00:55:43 +03:00
Andrey Semashev
e9621c0585 Reworked directory iterator construction with parameters.
Instead of passing a base directory fd, pass the directory fd to iterate over.
This simplifies code a little and makes it closer to Windows version.

Also, use unique_fd from Boost.Scope instead of a custom fd wrapper. Also
added handling of EINTR returned from open/openat in more places.
2024-02-19 02:57:16 +03:00
Andrey Semashev
9f6bf1a433 Use openat-style APIs on Windows to implement recursive_dir_iterator.
This makes recursive_directory_iterator more protected against filesystem
changes during iteration.
2024-02-18 03:25:47 +03:00
Andrey Semashev
081d00509b Added more NTSTATUS errors. 2024-02-17 20:16:42 +03:00
Andrey Semashev
7eece0064a On POSIX systems, use *at APIs in recursive_directory_iterator.
This makes the iterator more resilient to concurrent filesystem
modifications.
2024-02-12 01:07:44 +03:00