Title
copy_options::unspecified underspecified
Status
c++20
Section
[fs.op.copy]
Submitter
Tim Song

Created on 2017-08-24.00:00:00 last changed 38 months ago

Messages

Date: 2018-03-18.16:03:30

Proposed resolution:

This wording is relative to N4687.

  1. Edit [fs.op.copy] p4, bullet 4.8.2 as indicated:

    1. (4.7) — Otherwise, if is_regular_file(f), then:

      […]
    2. (4.8) — Otherwise, if

      is_directory(f) &&
      ((options & copy_options::recursive) != copy_options::none ||
      options == copy_options::none)
      

      then:

      1. (4.8.1) — If exists(t) is false, then create_directory(to, from).

      2. (4.8.2) — Then, iterate over the files in from, as if by

        for (const directory_entry& x : directory_iterator(from))
          copy(x.path(), to/x.path().filename(), options | copy_options::unspecifiedin-recursive-copy);
        

        where in-recursive-copy is an bitmask element of copy_options that is not one of the elements in [fs.enum.copy.opts].

    3. (4.9) — Otherwise, for the signature with argument ec, ec.clear().

    4. (4.10) — Otherwise, no effects.

Date: 2018-03-17.00:00:00

[ 2018-3-17 Adopted in Jacksonville ]

Date: 2018-01-26.00:00:00

[ 2018-1-26 issues processing telecon ]

Status to 'Tentatively Ready' after striking the words 'Exposition-only' from the added text

Date: 2017-11-08.00:00:00

[ 2017-11-08 ]

Priority set to 3 after five votes on the mailing list

Previous resolution: [SUPERSEDED]

This wording is relative to N4687.

  1. Edit [fs.op.copy] p4, bullet 4.8.2 as indicated:

    1. (4.7) — Otherwise, if is_regular_file(f), then:

      […]
    2. (4.8) — Otherwise, if

      is_directory(f) &&
      ((options & copy_options::recursive) != copy_options::none ||
      options == copy_options::none)
      

      then:

      1. (4.8.1) — If exists(t) is false, then create_directory(to, from).

      2. (4.8.2) — Then, iterate over the files in from, as if by

        for (const directory_entry& x : directory_iterator(from))
          copy(x.path(), to/x.path().filename(), options | copy_options::unspecifiedin-recursive-copy);
        

        where in-recursive-copy is an exposition-only bitmask element of copy_options that is not one of the elements in [fs.enum.copy.opts].

    3. (4.9) — Otherwise, for the signature with argument ec, ec.clear().

    4. (4.10) — Otherwise, no effects.

Date: 2017-08-24.00:00:00

[fs.op.copy]/4.8.2 says in the copy-a-directory case filesystem::copy performs:

for (const directory_entry& x : directory_iterator(from))
  copy(x.path(), to/x.path().filename(), options | copy_options::unspecified);

Presumably this does not actually mean that the implementation is free to set whatever copy_option element it wishes (directories_only? recursive? create_hard_links?), or none at all, or – since unspecified behavior corresponds to the nondeterministic aspects of the abstract machine ([intro.execution]/3) – a nondeterministically picked element for every iteration of the loop. That would be outright insane.

I'm fairly sure that what's intended here is to set an otherwise-unused bit in options so as to prevent recursion in the options == copy_options::none case.

History
Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2018-03-18 16:03:30adminsetmessages: + msg9742
2018-03-18 16:03:30adminsetstatus: voting -> wp
2018-02-12 01:13:49adminsetstatus: ready -> voting
2018-01-28 19:43:07adminsetmessages: + msg9657
2018-01-28 19:43:07adminsetstatus: new -> ready
2017-11-09 15:13:04adminsetmessages: + msg9517
2017-08-27 13:52:21adminsetmessages: + msg9455
2017-08-24 00:00:00admincreate