Commit Graph

1414 Commits

Author SHA1 Message Date
Andrey Semashev
ba864a1727 Removed trailing comma in enum.
Fixes compiler warnings.

Closes https://github.com/boostorg/filesystem/issues/143.
2020-05-06 15:39:41 +03:00
Andrey Semashev
a916a41602
Merge pull request #102 from stima/develop
Correct handling status of reparse point
2020-05-06 14:59:59 +03:00
Roman Savchenko
d3e3f46ce6 Correct handling of status() for reparse point when it is not a symlink. 2020-05-06 13:37:28 +03:00
Roman Savchenko
ed9e019b01 Add test for reparse point that is not symlink 2020-05-06 13:37:28 +03:00
Andrey Semashev
4dbea275e4 Use 20 instead of 2a to refer to C++20 in Travis CI. 2020-05-05 23:08:09 +03:00
Andrey Semashev
9182b4caa3 Added copy_file implementations based on sendfile and copy_file_range on Linux.
This may improve file copying performance.
2020-05-05 20:31:41 +03:00
Andrey Semashev
87ca86f823 Fixed potential errno clobber on close in copy_file. 2020-05-05 18:57:07 +03:00
Andrey Semashev
611c585cf5 Added clang-10 CI build jobs. 2020-05-05 18:47:33 +03:00
Andrey Semashev
f199152b7d Refactored copy_file, added copy_options, deprecated copy_option.
The copy_file operation implementation has been inlined into the
detail::copy_file function. The part that copies the file body has been
extracted to a separate function, so that addition of specialized copy
implementations later is possible.

Added copy_options enum, which reflects the enum from C++20. Currently,
only overwrite_existing option is supported. Other options will be added
later.

The old enum copy_option is deprecated in favor of copy_options.

Updated docs to reflect recent changes to copy_file behavior.
2020-05-05 18:34:20 +03:00
Andrey Semashev
4f3d762a31 Added BOOST_OVERRIDE markup for virtual methods.
Closes https://github.com/boostorg/filesystem/issues/135.
2020-05-05 14:54:06 +03:00
Andrey Semashev
6be120a079 Fixed space test failure for files.
The test used to fail because the path to the file was empty.
2020-05-05 14:35:41 +03:00
Andrey Semashev
fcbdae1581 Added temp_directory_path implementation for Windows CE. Refactor POSIX version.
The Windows CE implementation is based on the code proposed in
https://github.com/boostorg/filesystem/pull/25, updated and corrected.

Closes https://github.com/boostorg/filesystem/pull/25.
2020-05-05 01:54:35 +03:00
Andrey Semashev
a26ead7402 Updated space() behavior to match C++20. Add support for file paths on Windows.
space() now initializes space_info members to -1 values, which is used when the
structure is returned in case of error.

On Windows, check if the path refers to a directory, and use the parent
directory if not. In order to make sure we return space information for the
target filesystem, we have to resolve symlinks in this case.

Fixes https://github.com/boostorg/filesystem/issues/73.
2020-05-05 01:14:00 +03:00
Andrey Semashev
ee6604657d Fix 99_canonical_with_junction_point test not removing temp directory.
The test used to swich the current directory inside the temp directory
structure, which prevented it from removing it on exit.
2020-05-04 23:04:11 +03:00
Andrey Semashev
689e00d238 Dynamically allocate REPARSE_DATA_BUFFER in all operations.
Since max size of the REPARSE_DATA_BUFFER structure (with the variable storage)
is quite large, it makes sense to dynamically allocate it rather than store it
on the stack.
2020-05-04 22:42:52 +03:00
Andrey Semashev
ddb864a455 Don't request read ext. attrs access when testing if reparse point is a symlink. 2020-05-04 21:02:28 +03:00
Andrey Semashev
89b5152e86 Fixed check for mklink on Windows.
For some unknown reason, Windows 8.1 system shell returns error code 1 when
invoking mklink to test if it exists. To work around this we now analyze
output of the command in the Jamfile. As an added bonus, the test is not
compiled when mklink is not supported.
2020-05-04 20:00:40 +03:00
Andrey Semashev
ef819fe699 Avoid requesting read access for the reparse point in read_symlink on Windows.
Read access to the file does not seem to be needed to read the reparse point,
so dropping it works in favor of reducing the likelihood of a sharing violation.
2020-05-03 21:30:26 +03:00
Andrey Semashev
726d2bfa35 Specify file sharing flags in read_symlink on Windows.
This fixes potential sharing violation errors when the same file
is opened concurrently by read_symlink and someone else.

Fixes https://github.com/boostorg/filesystem/issues/138.
2020-05-03 20:29:19 +03:00
Andrey Semashev
eedaa1f565 Set S_IWUSR perm on the file created by copy_file and copy source perms on completion.
This ensures that the files overwritten or created by copy_file have the same
permission bits as the source file, as required by C++20. Also, for the duration
of the copy operation we ensure the target file has writing permission set.
This is important e.g. for NFS, which checks the permission on the server,
so a writable file descriptor on the client is not enough for the write
operation to succeed.

Notably, this doesn't save the case of overwriting the file with no write
permission set. In this case the operation will fail with EPERM.

Also, use fsync/fdatasync to guarantee that the target file is written
completely without errors before closing the file descriptor.
2020-05-03 19:43:55 +03:00
Andrey Semashev
1f06d4f064 Added release notes for the fixes in canonical, read_symlink and equivalent. 2020-05-02 21:41:15 +03:00
Andrey Semashev
70915432ee
Merge pull request #100 from Flamefire/junction_points
Fix canonical and read_symlink for junction points
2020-05-02 20:06:00 +03:00
Alexander Grund
37dd08caa5
Address review comments 2020-05-02 18:39:21 +02:00
Andrey Semashev
389de86331 Moved missing macro definitions earlier in the code. 2020-05-01 22:07:31 +03:00
Andrey Semashev
a5fc1faf28 Add source and target file checks to copy_file, simplify file equivalence checks
The POSIX copy_file implementation has beed reworked to perform checks for
whether the source and target files are regilar files and whether the source
and target paths identify the same file. Also, the implementation has been fixed
to report the correct error code from the failed operation to the caller
in case of failure. The implementation is now also protected against EINTR
errors and uses O_CLOEXEC when possible to avoid leaking file descriptors
if the caller process forks.

Also, the file equivalence test is now simplified to not test the file size
and last modification time. These tests had a potential of causing a false
negative, if the file that is being tested was modified between the stat()
calls that were used to obtain file information from the paths.

Closes https://github.com/boostorg/filesystem/pull/48.
2020-05-01 20:09:37 +03:00
Andrey Semashev
79e8d844f5 Added a release note about removing compile-time checks for symlinks and hardlinks on Windows. 2020-05-01 20:09:37 +03:00
Alexander Grund
1638dd366d
More descriptive error on failure 2020-05-01 17:03:05 +02:00
Flamefire
decaa9db39
Don't resolve the root_name for symlinks in canonical
Fixes #99
2020-05-01 17:03:05 +02:00
Flamefire
595ca0d7b6
Fix read_symlink for junction points
Read the correct struct member depending on the tag
2020-05-01 17:03:05 +02:00
Flamefire
ccb22fc517
Add test to trigger bug #99
Resolving junction points in read_symlink and canonical is wrong
2020-05-01 17:02:48 +02:00
Andrey Semashev
ccf3411b44
Merge pull request #130 from eldiener/develop
Changes for Embarcadero C++ clang-based compilers, targeting Boost 1.74
2020-05-01 17:40:40 +03:00
Andrey Semashev
4642ac8e03 Nonessential code formatting cleanup. 2020-05-01 17:22:31 +03:00
Andrey Semashev
1dc3225920
Merge pull request #142 from Flamefire/symlink_runtime_checks
Remove API level checks in symlink functions in favor of runtime checks
2020-05-01 17:20:42 +03:00
Alexander Grund
f05c428d70
Consistently use MAXIMUM_REPARSE_DATA_BUFFER_SIZE for the reparse buffer size 2020-04-25 17:18:28 +02:00
Alexander Grund
1dd143e37d
Test for mklink existance before running junction tests 2020-04-25 16:03:52 +02:00
Alexander Grund
b760094234
Define SYMBOLIC_LINK_FLAG_DIRECTORY if not defined 2020-04-25 16:03:51 +02:00
Alexander Grund
cee149e338
Remove API level checks in symlink functions in favor of runtime checks
Often enough the API functions are available and the runtime checks do
detect those well enough, so don't cripple the functionality just
because the user forget to define a reasonable API level (default is
often even less then WinXP)
2020-04-25 16:03:39 +02:00
Alexander Grund
d75baa987f
Enable read_symlink for all Windows API levels
DeviceIoControl is already used in other places so just use it.
Should be available too:
https://docs.microsoft.com/en-us/windows/desktop/api/ioapiset/nf-ioapiset-deviceiocontrol
2020-04-25 16:02:44 +02:00
Andrey Semashev
a33b7ad41f Fixed error handling on POSIX equivalent().
When stat() failed for both paths passed to equivalent(), the latter
would set an invalid error code of 1 instead of errno before returning.
Use one of the error codes returned by stat() to set the error_code.

Also changed Windows variant of equivalent() to report the actual
Windows error code for the failed operation of creating a file handle.

Fixes https://github.com/boostorg/filesystem/issues/141.
2020-04-24 20:14:43 +03:00
Andrey Semashev
8b138a9955
Merge pull request #131 from boostorg/feature/fix_link
Fix link to use Boost ML archive instead of GMANE
2020-04-09 15:30:10 +03:00
Glen Fernandes
aaf54ada48 Fix link to use Boost ML archive instead of GMANE 2020-04-09 08:23:40 -04:00
Edward Diener
b454be058b Directory of utime.h is the same in the Embarcadero clang-based compilers as it is in the legacy compiler. 2020-04-02 12:53:24 -04:00
Edward Diener
3709d7c71e Change __BORLANDC__ to BOOST_BORLANDC, which is defined in Boost config for the Embarcadero non-clang-based compilers. 2020-03-31 07:19:05 -04:00
Andrey Semashev
971b2caed6 Updated README.md with better representation of build status. 2020-03-10 22:53:24 +03:00
Andrey Semashev
0fcfd93407 Updated lightweight_test.hpp includes to the new location. 2020-03-04 00:49:27 +03:00
Andrey Semashev
b33598605c Updated deprecated uses of boost::bind to silence warnings. 2020-03-04 00:45:48 +03:00
Andrey Semashev
f0bcfe57e1
Merge pull request #126 from glenfe/develop
Include the public quoted header from IO
2019-12-17 20:34:46 +03:00
Glen Fernandes
45e06be049 Include the public quoted header from IO 2019-12-16 19:43:21 -05:00
Andrey Semashev
d27d4ce3c5 Disabled clang-win CI because of linking failures (not caused by Boost.Filesystem). 2019-12-12 11:39:22 +03:00
Andrey Semashev
93f0c76869 Added a note about moving filesystem_error implementation to the compiled library. 2019-10-26 01:06:44 +03:00