Title
filesystem::copy() cannot copy symlinks
Status
c++17
Section
[fs.op.copy]
Submitter
Jonathan Wakely

Created on 2016-04-19.00:00:00 last changed 81 months ago

Messages

Date: 2016-08-04.02:52:49

Proposed resolution:

Modify paragraph 3 of [fs.op.copy] as shown:

Effects: Before the first use of f and t:

— If (options & copy_options::create_symlinks) != copy_options::none || (options & copy_options::skip_symlinks) != copy_options::none then auto f = symlink_status(from) and if needed auto t = symlink_status(to).

— Otherwise, if (options & copy_options::copy_symlinks) != copy_options::none then auto f = symlink_status(from) and if needed auto t = status(to).
— Otherwise, auto f = status(from) and if needed auto t = status(to).

Date: 2016-08-04.02:52:49

[ 2016-08 Chicago ]

Wed AM: Move to Tentatively Ready

Date: 2017-02-02.00:41:18

[ 2016-05 Issues Telecon ]

This is related to 2682; and should be considered together.

Date: 2016-04-19.00:00:00

[fs.op.copy] paragraph 3 bullet (3.4) says that if is_symlink(f) and copy_options is set in options then it should copy a symlink, but that case cannot be reached.

is_symlink(f) can only be true if f was set using symlink_status(from), but that doesn't happen unless one of create_symlinks or skip_symlinks is set in options. It should depend on copy_symlinks too.

I'm not sure what the correct behaviour is, but I don't think we want to simply add a check for copy_symlinks in bullet (3.1) because that would mean that t = symlink_status(to), and I don't think we want that. Consider 'touch file; mkdir dir; ln -s dir link;' and then filesystem::copy("file", "link", filesystem::copy_options::copy_symlinks). If t = symlink_status(to) then is_directory(t) == false, and we don't use bullet (3.5.4) but go to (3.5.5) instead and fail. So when copy_symlinks is set we still need to use t = status(to) as specified today.

History
Date User Action Args
2017-07-30 20:15:43adminsetstatus: wp -> c++17
2016-11-14 03:59:28adminsetstatus: pending -> wp
2016-11-14 03:55:22adminsetstatus: ready -> pending
2016-08-04 02:52:49adminsetmessages: + msg8382
2016-08-04 02:52:49adminsetstatus: new -> ready
2016-05-22 15:38:38adminsetmessages: + msg8133
2016-05-10 21:02:20adminsetmessages: + msg8117
2016-04-19 00:00:00admincreate