public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/106932] New: Incorrect behavior of std::filesystem::copy() with overwrite_existing or update_existing options
@ 2022-09-13 18:41 thomas.allen at intel dot com
  2022-09-13 18:45 ` [Bug libstdc++/106932] " thomas.allen at intel dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: thomas.allen at intel dot com @ 2022-09-13 18:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106932

            Bug ID: 106932
           Summary: Incorrect behavior of std::filesystem::copy() with
                    overwrite_existing or update_existing options
           Product: gcc
           Version: 11.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: thomas.allen at intel dot com
  Target Milestone: ---

When using std::filesystem::copy_options::overwrite_existing or
std::filesystem::copy_options::update_existing as part of a call to
std::filesystem::copy(), no destination directory is created, and the source
directory is not copied. In addition, no exception is thrown. If neither of
these options are specified, the behavior is as expected, creating the
destination directory and copying all regular files into it.

This appears to be contrary to bullet 4.7.4 in Section 29.11.14.3 of the C++20
spec, where for regular files in a source directory, the effect should be
equivalent to passing any options through to a copy_file() call on each file.

This bug occurs on SUSE Linux Enterprise Server 12 SP5, running on an Intel
Xeon Gold 6136 CPU.

Additionally, testing with GCC 10.2.0 and 12.2.0 shows the same issue.

The build configuration options used with GCC 11.3.0 specifically were:
/nfs/orto/proj/tapeout/cit_rep/ImagingToolsSupport/v2/bootstrap/build/sles12/gcc920/gcc/11.3.0/default/extract/gcc-11.3.0/configure
--prefix=/nfs/orto/proj/tapeout/cit_rep/ImagingToolsSupport/v2/bootstrap/install/sles12/gcc920/gcc/11.3.0/default
--with-specs='%{!static:%x{-rpath=/nfs/orto/proj/tapeout/cit_rep/ImagingToolsSupport/v2/bootstrap/install/sles12/gcc920/gcc/11.3.0/default/lib64:/nfs/orto/proj/tapeout/cit_rep/ImagingToolsSupport/v2/bootstrap/install/sles12/gcc920/gcc/11.3.0/default/lib}}'
--enable-lto

The command line which triggers this bug is:
g++ -std=c++20 -Wall -o dir_copy_test dir_copy_test.cpp

No errors or warnings are emitted by the compiler, and the source directory for
the test case is identical in structure to the one shown in the Notes section
at https://en.cppreference.com/w/cpp/filesystem/copy, i.e.

copy_test/
`-- source
    |-- file1
    |-- file3
    `-- subdir
        `-- file2

To produce the issue:
cd copy_test
dir_copy_test source dest

The preprocessor output for the test code is attached.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-09-16 20:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-13 18:41 [Bug libstdc++/106932] New: Incorrect behavior of std::filesystem::copy() with overwrite_existing or update_existing options thomas.allen at intel dot com
2022-09-13 18:45 ` [Bug libstdc++/106932] " thomas.allen at intel dot com
2022-09-13 19:40 ` redi at gcc dot gnu.org
2022-09-13 19:43 ` redi at gcc dot gnu.org
2022-09-13 20:34 ` thomas.allen at intel dot com
2022-09-13 20:59 ` redi at gcc dot gnu.org
2022-09-13 21:43 ` thomas.allen at intel dot com
2022-09-14  9:17 ` redi at gcc dot gnu.org
2022-09-16 16:41 ` rs2740 at gmail dot com
2022-09-16 20:10 ` [Bug libstdc++/106932] [DR 3057] " redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).