public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/106932] Incorrect behavior of std::filesystem::copy() with overwrite_existing or update_existing options
Date: Tue, 13 Sep 2022 19:40:40 +0000	[thread overview]
Message-ID: <bug-106932-4-iEUDEb4Ffj@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106932-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I think this is the correct behaviour according to the standard.

Where f is status("source") and t is status("dest").

Effects are then as follows:

- If f.type() or t.type() is an implementation-defined file type ...

[they're not]

- Otherwise, an error is reported as specified in 31.12.5 if:

[list of conditions that are not true]

- Otherwise, if is_symlink(f), then:

[it's not]

- Otherwise, if is_regular_file(f), then:

[it's not]

- Otherwise, if
  is_directory(f) &&
  (options & copy_options::create_symlinks) != copy_options::none

[create_symlinks is not set in the options]

- Otherwise, if
  is_directory(f) &&
  ((options & copy_options::recursive) != copy_options::none ||
    options == copy_options::none)

[this is the case we want to hit, but the condition is false because recursive
is not set and options != none]

- Otherwise, for the signature with argument ec, ec.clear().

[You didn't pass an erroc_code]

- Otherwise, no effects.

[Bingo]

So you need to use copy_options::recursive to get the effects you want.

  parent reply	other threads:[~2022-09-13 19:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-13 18:41 [Bug libstdc++/106932] New: " 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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-106932-4-iEUDEb4Ffj@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).