This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of WP status.

3015. copy_options::unspecified underspecified

Section: 28.11.14.3 [fs.op.copy] Status: WP Submitter: Tim Song Opened: 2017-08-24 Last modified: 2018-03-24

Priority: 3

View all other issues in [fs.op.copy].

View all issues with WP status.

Discussion:

28.11.14.3 [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 (6.8.1 [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.

[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 28.11.14.3 [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 28.11.9.3 [fs.enum.copy.opts].

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

    4. (4.10) — Otherwise, no effects.

[2018-1-26 issues processing telecon]

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

[2018-3-17 Adopted in Jacksonville]

Proposed resolution:

This wording is relative to N4687.

  1. Edit 28.11.14.3 [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 28.11.9.3 [fs.enum.copy.opts].

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

    4. (4.10) — Otherwise, no effects.