These implement DR resolutions and fix bugs. Fix error handling in filesystem::is_empty * src/filesystem/ops.cc (is_empty): Fix error handling. * testsuite/experimental/filesystem/operations/is_empty.cc: New test. PR71337 fix filesystem::temp_directory_path error handling PR libstdc++/71337 * src/filesystem/ops.cc (temp_directory_path): Pass error_code argument to other filesystem operations. * testsuite/experimental/filesystem/operations/temp_directory_path.cc: Add testcase for inaccessible directory. Make directory iterators become end iterator on error * src/filesystem/dir.cc (open_dir): Return same value for errors whether ignored or not. (_Dir::advance(error_code*, directory_options)): Return false on error. (directory_iterator(const path&, directory_options, error_code*)): Create end iterator on error (LWG 2723). (recursive_directory_iterator(const path&, directory_options, error_code*)): Likewise. * testsuite/experimental/filesystem/iterators/directory_iterator.cc: Update expected behaviour on error. * testsuite/experimental/filesystem/iterators/ recursive_directory_iterator.cc: Likewise. Do not retry failed close(3) in filesystem::copy * src/filesystem/ops.cc (close_fd): Remove. (do_copy_file): Just use close(3) instead of close_fd, to prevent retrying on error. Implement DR resolutions for filesystem::copy * src/filesystem/ops.cc (do_copy_file): Return an error if either source or destination is not a regular file. (copy): Update comment to refer to LWG 2681. Implement 2682 and 2683 resolutions. (read_symlink): Add missing ec.clear(). * testsuite/experimental/filesystem/operations/copy.cc: Update expected behaviour for copying directories with create_symlinks. Verify that error_code arguments are cleared if there's no error. * testsuite/experimental/filesystem/operations/read_symlink.cc: * New. Tested x86_64-linux, commiitted to trunk. I'm going to do some mass backports for all filesystem fixes to the branches this week as well.