From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7CA813857357; Thu, 28 Apr 2022 13:26:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7CA813857357 From: "mpie@msc-ge.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/105422] New: filesystem::copy does not throw exceptions when a subdirectory exists Date: Thu, 28 Apr 2022 13:26:36 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 11.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mpie@msc-ge.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Apr 2022 13:26:36 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105422 Bug ID: 105422 Summary: filesystem::copy does not throw exceptions when a subdirectory exists Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: mpie@msc-ge.com Target Milestone: --- Created attachment 52895 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D52895&action=3Dedit Example file to reproduce behaviour Hi, in Ubuntu 21.10 a recursive filesystem::copy() does correctly throw an exception if a file can't be read. But it will not throw an exception if th= ere is an empty subdirectory. The destination will therefore miss a file withou= t a report. Also the error code will be empty. See the output of the attached copy_bug.cpp $ c++ copy_bug.cpp -o copy_bug --std=3Dc++17 $ ./copy_bug Copytest with withSubDir=3D0 Exception: filesystem error: cannot copy: Permission denied [test/source] [test/dest] Error code: Permission denied Copytest with withSubDir=3D1 $ tree -p test=20=20=20=20=20=20=20 test =E2=94=9C=E2=94=80=E2=94=80 [drwxrwxr-x] dest =E2=94=82=C2=A0=C2=A0 =E2=94=94=E2=94=80=E2=94=80 [drwxrwxr-x] subdir =E2=94=9C=E2=94=80=E2=94=80 [drwxrwxr-x] dest_ec =E2=94=82=C2=A0=C2=A0 =E2=94=94=E2=94=80=E2=94=80 [drwxrwxr-x] subdir =E2=94=94=E2=94=80=E2=94=80 [drwxrwxr-x] source =E2=94=9C=E2=94=80=E2=94=80 [drwxrwxr-x] subdir =E2=94=94=E2=94=80=E2=94=80 [----------] test.txt=