This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.
copy_options::unspecified
underspecifiedSection: 31.12.13.4 [fs.op.copy] Status: C++20 Submitter: Tim Song Opened: 2017-08-24 Last modified: 2021-02-25
Priority: 3
View all other issues in [fs.op.copy].
View all issues with C++20 status.
Discussion:
31.12.13.4 [fs.op.copy]/4.8.2 says in the copy-a-directory case filesystem::copy
performs:
Presumably this does not actually mean that the implementation is free to set whateverfor (const directory_entry& x : directory_iterator(from)) copy(x.path(), to/x.path().filename(), options | copy_options::unspecified);
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.9.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.
Edit 31.12.13.4 [fs.op.copy] p4, bullet 4.8.2 as indicated:
(4.7) — Otherwise, if
is_regular_file(f)
, then:[…](4.8) — Otherwise, if
is_directory(f) && ((options & copy_options::recursive) != copy_options::none || options == copy_options::none)then:
(4.8.1) — If
exists(t)
isfalse
, thencreate_directory(to, from)
.(4.8.2) — Then, iterate over the files in
from
, as if byfor (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 ofcopy_options
that is not one of the elements in 31.12.8.3 [fs.enum.copy.opts].(4.9) — Otherwise, for the signature with argument
ec
,ec.clear()
.(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.
Edit 31.12.13.4 [fs.op.copy] p4, bullet 4.8.2 as indicated:
(4.7) — Otherwise, if
is_regular_file(f)
, then:[…](4.8) — Otherwise, if
is_directory(f) && ((options & copy_options::recursive) != copy_options::none || options == copy_options::none)then:
(4.8.1) — If
exists(t)
isfalse
, thencreate_directory(to, from)
.(4.8.2) — Then, iterate over the files in
from
, as if byfor (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 ofcopy_options
that is not one of the elements in 31.12.8.3 [fs.enum.copy.opts].(4.9) — Otherwise, for the signature with argument
ec
,ec.clear()
.(4.10) — Otherwise, no effects.