public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/108859] New: Exception thrown by std::filesystem::copy() is wrong
@ 2023-02-20 12:36 vini.ipsmaker at gmail dot com
2023-02-20 23:11 ` [Bug libstdc++/108859] " redi at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: vini.ipsmaker at gmail dot com @ 2023-02-20 12:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108859
Bug ID: 108859
Summary: Exception thrown by std::filesystem::copy() is wrong
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: vini.ipsmaker at gmail dot com
Target Milestone: ---
std::filesystem::filesystem_error::path1() and
std::filesystem::filesystem_error::path2() should contain the paths for the
most deeply-nested call, not the outermost call. It's discarding information
regarding the error that actually occurred.
#include <filesystem>
#include <iostream>
int main(int argc, char *argv[])
{
try {
std::filesystem::copy(std::filesystem::path{argv[1]},
std::filesystem::path{argv[2]},
std::filesystem::copy_options::recursive);
} catch (const std::filesystem::filesystem_error& e) {
std::cerr << e.what() << '\n' << e.path1() << '\n' << e.path2() <<
'\n';
}
}
If a file already exists, path1() should not be argv[1], but the file that
failed to copy. Same for path2().
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug libstdc++/108859] Exception thrown by std::filesystem::copy() is wrong
2023-02-20 12:36 [Bug libstdc++/108859] New: Exception thrown by std::filesystem::copy() is wrong vini.ipsmaker at gmail dot com
@ 2023-02-20 23:11 ` redi at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2023-02-20 23:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108859
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2023-02-20
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-02-20 23:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-20 12:36 [Bug libstdc++/108859] New: Exception thrown by std::filesystem::copy() is wrong vini.ipsmaker at gmail dot com
2023-02-20 23:11 ` [Bug libstdc++/108859] " redi at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).