Why does !is_regular_file(from) cause copy_file to report a "file already exists" error?
Tim Song

Created on 2016-12-17.00:00:00 last changed 23 months ago


Date: 2018-03-18.16:03:30

Proposed resolution:

This wording is relative to N4713.

  1. Edit [fs.op.copy_file]/4 as indicated:

    bool copy_file(const path& from, const path& to, copy_options options);
    bool copy_file(const path& from, const path& to, copy_options options,
                   error_code& ec) noexcept;

    -4- Effects: As follows:

    1. (4.1) — Report a file already existsan error as specified in [fs.err.report] if:

      1. (4.1.1) —[…]

    2. (4.2) —[…]

Date: 2018-03-17.00:00:00

[ 2018-3-17 Adopted in Jacksonville ]

Date: 2018-01-23.00:00:00

[ 2018-01-23 Moved to Tentatively Ready after 6 positive votes on c++std-lib. ]

Date: 2018-01-15.00:00:00

[ 2018-01-16, Jonathan comments ]

I said I'd provide updated wording because I wanted to preserve the requirement that the reported error is "file already exists" for some of the error cases. I no longer think that's necessary, so I think the current P/R is fine. Please note that I don't think new wording is needed.

Date: 2017-01-27.00:00:00

[ 2017-01-27 Telecon ]

Priority 2; Jonathan to provide updated wording.

Date: 2016-12-17.00:00:00

[fs.op.copy_file]/4 says that copy_file reports "a file already exists error as specified in [fs.err.report] if" any of several error conditions exist.

It's not clear how some of those error conditions, such as !is_regular_file(from), can be sensibly described as "file already exists". Pretty much everywhere else in the filesystem specification just says "an error" without further elaboration.

Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2018-03-18 16:03:30adminsetmessages: + msg9727
2018-03-18 16:03:30adminsetstatus: voting -> wp
2018-02-12 01:13:49adminsetstatus: ready -> voting
2018-01-23 20:58:58adminsetmessages: + msg9625
2018-01-23 20:58:58adminsetstatus: new -> ready
2018-01-20 15:37:53adminsetmessages: + msg9613
2017-01-30 15:36:02adminsetmessages: + msg8825
2017-01-22 19:14:09adminsetmessages: + msg8777
2016-12-17 00:00:00admincreate