public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Revert "gdb/compile: Use std::filesystem::remove_all in cleanup"
@ 2024-04-03 14:44 Lancelot SIX
  2024-04-03 14:59 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Lancelot SIX @ 2024-04-03 14:44 UTC (permalink / raw)
  To: gdb-patches, tdevries; +Cc: Lancelot SIX

This reverts commit 7bba0ad08576309763e3f41193eaa93025e10b8b.

Tom de Vries reported that 7bba0ad0857 (gdb/compile: Use
std::filesystem::remove_all in cleanup) broke builds with gcc-7.5.0
which mostly supports c++17, but not std::filesystem[1].  As this change
is not critical, revert it to maintain compatibility.

[1] https://inbox.sourceware.org/gdb-patches/a06e6483-aa2e-4b8a-854f-e369a1e961ea@suse.de/

Change-Id: I58150bd27600c95052bdf1bbbd6b44718a5a0bbf
---
 gdb/compile/compile.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index bff69a5092d..2d97a1b2005 100644
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -39,9 +39,7 @@
 #include "osabi.h"
 #include "gdbsupport/gdb_wait.h"
 #include "valprint.h"
-#include <filesystem>
 #include <optional>
-#include <system_error>
 #include "gdbsupport/gdb_unlinker.h"
 #include "gdbsupport/pathstuff.h"
 #include "gdbsupport/scoped_ignore_signal.h"
@@ -451,11 +449,15 @@ get_compile_file_tempdir (void)
   tempdir_name = xstrdup (tempdir_name);
   add_final_cleanup ([] ()
     {
-      std::error_code error;
-      if (std::filesystem::remove_all (tempdir_name, error)
-	  == static_cast<std::uintmax_t> (-1))
-	warning (_("Could not remove temporary directory %s (%s)"),
-		 tempdir_name, error.message ().c_str ());
+      char *zap;
+      int wstat;
+
+      gdb_assert (startswith (tempdir_name, TMP_PREFIX));
+      zap = concat ("rm -rf ", tempdir_name, (char *) NULL);
+      wstat = system (zap);
+      if (wstat == -1 || !WIFEXITED (wstat) || WEXITSTATUS (wstat) != 0)
+	warning (_("Could not remove temporary directory %s"), tempdir_name);
+      XDELETEVEC (zap);
     });
   return tempdir_name;
 }

base-commit: 7bba0ad08576309763e3f41193eaa93025e10b8b
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Revert "gdb/compile: Use std::filesystem::remove_all in cleanup"
  2024-04-03 14:44 [PATCH] Revert "gdb/compile: Use std::filesystem::remove_all in cleanup" Lancelot SIX
@ 2024-04-03 14:59 ` Tom Tromey
  2024-04-03 15:35   ` Lancelot SIX
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2024-04-03 14:59 UTC (permalink / raw)
  To: Lancelot SIX; +Cc: gdb-patches, tdevries

>>>>> "Lancelot" == Lancelot SIX <lancelot.six@amd.com> writes:

Lancelot> This reverts commit 7bba0ad08576309763e3f41193eaa93025e10b8b.
Lancelot> Tom de Vries reported that 7bba0ad0857 (gdb/compile: Use
Lancelot> std::filesystem::remove_all in cleanup) broke builds with gcc-7.5.0
Lancelot> which mostly supports c++17, but not std::filesystem[1].  As this change
Lancelot> is not critical, revert it to maintain compatibility.

Thanks.  Could you put the 'Bug:' tag into this so it's recorded in
bugzilla?

Sorry to say it but this is ok.  I appreciate your quick turnaround on
it.

Approved-By: Tom Tromey <tom@tromey.com>

Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Revert "gdb/compile: Use std::filesystem::remove_all in cleanup"
  2024-04-03 14:59 ` Tom Tromey
@ 2024-04-03 15:35   ` Lancelot SIX
  0 siblings, 0 replies; 3+ messages in thread
From: Lancelot SIX @ 2024-04-03 15:35 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches, tdevries

> 
> Thanks.  Could you put the 'Bug:' tag into this so it's recorded in
> bugzilla?
> 
> Sorry to say it but this is ok.  I appreciate your quick turnaround on
> it.
> 
> Approved-By: Tom Tromey <tom@tromey.com>
> 
> Tom

I have added the Bug tag and pushed to master.  This should fix the 
issues for builders with older toolchains.

Thanks,
Lancelot.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-03 15:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-03 14:44 [PATCH] Revert "gdb/compile: Use std::filesystem::remove_all in cleanup" Lancelot SIX
2024-04-03 14:59 ` Tom Tromey
2024-04-03 15:35   ` Lancelot SIX

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).