Title
[filesys.ts] [PDTS] Copying equivalent paths effects not specified
Status
open
Section
[fs.op.copy_file]
Submitter
CH-15

Created on 2014-01-20.00:00:00 last changed 89 months ago

Messages

Date: 2016-01-28.01:00:35

Proposed resolution:

Change 15.4 [fs.op.copy_file]:

Precondition: At most one constant from each copy_options option group ([enum.copy_options]) is present in options.

Effects:

If  exists(to) && !(options & (copy_options::skip_existing | copy_options::overwrite_existing | copy_options::update_existing)) report a file already exists error as specified in Error reporting (7).

If !exists(to) || (options & copy_options::overwrite_existing) || ((options & copy_options::update_existing) && last_write_time(from) > last_write_time(to)) || !(options & (copy_options::skip_existing | copy_options::overwrite_existing | copy_options::update_existing)) copy the contents and attributes of the file from resolves to the file to resolves to.

Report a file already exists error as specified in Error reporting (7) if:

  • exists(to) and equivalent(from, to), or
  • exists(to) and (options & (copy_options::skip_existing | copy_options::overwrite_existing | copy_options::update_existing)) == copy_options::none.

Otherwise copy the contents and attributes of the file from resolves to to the file to resolves to if:

  • !exists(to), or
  • exists(to) and (options & copy_options::overwrite_existing) != copy_options::none , or
  • exists(to) and (options & copy_options::update_existing) != copy_options::none and from is more recent than to, determined as if by use of the last_write_time function.

Otherwise no effects.

Returns: true if the from file was copied, otherwise false. The signature with argument ec return false if an error occurs.

Throws: As specified in Error reporting (7).

Complexity: At most one direct or indirect invocation of status(to).

Date: 2016-01-28.01:00:35

[ 17 Jun 2014 Rapperswil LWG moves to Immediate. Jonathan Wakely will provide editorial changes to improve the presentation of bitmask values. ]

Date: 2014-04-09.00:00:00

[ 2014-04-09 Beman provided wording as requested. The Effects were rewritten to increase clarity. Behavior remains unchanged except for treating equivalence as an error. ]

Date: 2014-02-13.00:00:00

[ 2014-02-13 LWG/SG-3 Issaquah: LWG/SG-3 decided to treat equivalence in this case as an error. Beman to provide wording. ]

Date: 2014-02-15.00:00:00

[ 2014-02-09, Beman Dawes: Need advice on this issue: ]

What do existing implentations do?

Possible resolutions:

  1. Treat it as an error.
  2. Once equivalence is determined, take no further action and return true? false?
  3. Don't bother to detect a file overwriting itself. This will likely result in an error, anyhow.
Date: 2016-01-31.20:31:05

Addresses: filesys.ts

Even if to and from are different paths, they may be equivalent.

Specify what happens if (options & copy_options::overwrite_existing) but from and to resolve to the same file.

History
Date User Action Args
2017-07-30 20:10:41adminsetstatus: wp -> open
2016-01-28 01:00:35adminsetmessages: + msg7780
2016-01-28 01:00:35adminsetmessages: + msg7779
2016-01-28 01:00:35adminsetmessages: + msg7778
2016-01-28 01:00:35adminsetmessages: + msg7777
2016-01-28 01:00:35adminsetmessages: + msg7776
2014-01-20 00:00:00admincreate