From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id fx24LJ8de2rPZh0AWB0awg (envelope-from ) for ; Tue, 11 Aug 2026 09:03:27 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=jFqFO0QL; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id A4CD41E033; Tue, 11 Aug 2026 09:03:27 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id F1BD11E033 for ; Tue, 11 Aug 2026 09:03:25 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D83184BA79A5 for ; Tue, 11 Aug 2026 13:03:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D83184BA79A5 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=jFqFO0QL Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 054B34BA79AC for ; Tue, 11 Aug 2026 13:02:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 054B34BA79AC Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 054B34BA79AC Authentication-Results: sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1786453355; cv=none; b=vKzU5PXsxr4wgGv8ItZVs8F84yVz8sOEqo4X9w83eg5+6samdhNGXHtzxnG0aWLOnXv/SVMFE7h+0usnvDUJoHoOhm2spk+SI4fbk3Jz2TQpMhmt2168fvJJZKBA0CHSxpSrgmTTzyaOlM+brGyNkqJ/chtP7FEScbc/o2HxprU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1786453355; c=relaxed/simple; bh=3iybJ1bf7+CxlzKfpytKFPj/voTBfYW+l5LEI27nJ48=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=ENqNeC9PDPcmcrah6Zc3exXHBPhw2wrXkxNCnTp5w7jNCl67K/ZhY3OXaJFNRLobiPfZY0fMY1iGcY8dBeXLMYn3ruMo/zrOKZIjO8X670Ao4SjdFXqYMjwO2sezHkulbDdyReYjdYCyFShmTNIhz0MhiTazB/5upNzk1Rtxpcw= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=jFqFO0QL DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 054B34BA79AC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786453354; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=H//boTjtsc2sbZ8PGDBy1tAFj+u/LXc5eYRExiusHoA=; b=jFqFO0QLDV34uUe9oCMyEBok1DzfYiEHRk6vOC6zw/NL/0snilONmjowJMCwAYI9UIuXAE 1WfnrtKvamTrvVlQeo76kW1tkoiPLp54TOyE5rMA/kvxhm1hB/IuJN9bcHacryu/jI/NmP E3hH4E4FpXvOZqw0anvmBiNh43ibeRk= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-397-nHRfpBhLOYO2eO34wvJGfw-1; Tue, 11 Aug 2026 09:02:32 -0400 X-MC-Unique: nHRfpBhLOYO2eO34wvJGfw-1 X-Mimecast-MFC-AGG-ID: nHRfpBhLOYO2eO34wvJGfw_1786453351 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-47f8398ed9fso2530977f8f.0 for ; Tue, 11 Aug 2026 06:02:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786453351; x=1787058151; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=H//boTjtsc2sbZ8PGDBy1tAFj+u/LXc5eYRExiusHoA=; b=ino/FFYFO8kd2rVK9FLiQvdCUZQYYQhI7feDCNkmqpdLdbUPD8/gnWMtke8ljwNkWN ap1NehYIWfEdK1uQkRneyHqTHPrc0LVH7VsrdJaD9HX3H0ns9xaLKitjySIEdJG5a8Yp 65j3mKJHT6v69uqBQrCDrjEYA7pqANyClDput0vi9bVu0XCLjRAbSEnVqy8pU144h8w/ yIPvrLqI+jVjyAr95G5x++wdaptgJVIH/6mIgHnmAlvzNk0oYK0ty2QesPnZQgK6mC0l lkuAJ5vdZcTc1v7agtRT8XHU6X4ozlkEBPZvgOesarDZlTB95t62sDntTcAdm+d4kN+g vkvw== X-Gm-Message-State: AOJu0YyTx0jkm9ZLSIHMV1eoUljzH/qq6aVdorLuy7zZw/NcMpaW9uPm XT1FH86GqTkKK6S8McVCKYdFd1WGNbzCkEXP03AZoTlyhA3z7TQ1h4wrlC2ubWBOuItZ0iytZa1 sIpA/ECgaTVo0BraLJLoC8b/ReczqbmngqNCvAxVw4/cUQMgPOy+S/0DgxwV1YhYr1sPoSgKQcL wRSAFbEFyh8vPPy/UqDawh8hTD2/Roh2ngeveHe3fsK7GBRJE= X-Gm-Gg: AR+sD10v6JAMqucmliLaCv/cxMkjtSxLAS4SpgqLihYqqXSfL7OuuDE7wP1ZHBUwzpV rm62GCJ+337mAeKm8qaDOJao+IIYq259Jv9tiQfE24QEs5v5o8DVEEy5OD8kX6cckw8vWz2ZACw h8I4cixF0MRy3ZKRiWp21SPAMTQoqZ1jB8oHxLsk3S0B1ii7VzwVi0xLE43DGtdaUo/qI+I4UCj Ag73drp8CRCg7xGh6zTR7R1MaKgepGolJqJ1uUhiQy6grnR+nQb6mjtiaLdArwGnTmEK9efc3p2 3kQZPPb7v9IYgeyP7uLWCBSQY2vqC/kpLQO0XGD+3/RxlhEPBF6TGG43J8AdA8sKXvhlpizo X-Received: by 2002:a05:6000:25ca:b0:47f:93b4:2def with SMTP id ffacd0b85a97d-4814ade8026mr3942558f8f.28.1786453346283; Tue, 11 Aug 2026 06:02:26 -0700 (PDT) X-Received: by 2002:a05:6000:25ca:b0:47f:93b4:2def with SMTP id ffacd0b85a97d-4814ade8026mr3941050f8f.28.1786453335636; Tue, 11 Aug 2026 06:02:15 -0700 (PDT) Received: from localhost ([31.111.209.128]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4814a5ac6cfsm3907528f8f.4.2026.08.11.06.02.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Aug 2026 06:02:15 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Eli Zaretskii , Andrew Burgess Subject: [PATCH] [GDB 18] gdb/configure: fix string quoting in AC_MSG_WARN and AC_MSG_ERROR Date: Tue, 11 Aug 2026 14:02:06 +0100 Message-Id: <14328877dfdc53dcfad582dd2b56861dc92396fd.1786453193.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: UrExxQw9k8r82cdr_oNb74BJ1jraHo5_vpf96GDwcWE_1786453351 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org If / when approve I plan to push this to both master and gdb-18-branch. Thanks, Andrew --- Eli pointed out an issue with --enable-binary-file-formats, when GDB is built with --enable-binary-file-formats='coff,xcoff,elf,macho' on a target that doesn't support Mach-O, then GDB would configure correctly, but then fail to build with an error like: CXXLD gdb.exe d:/usr/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: machoread.o: in function `macho_check_dsym': d:\gnu\gdb-18.0.90\gdb/machoread.c:738:(.text+0xb16): undefined reference to `bfd_mach_o_lookup_command' d:/usr/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: d:\gnu\gdb-18.0.90\gdb/machoread.c:757:(.text+0xbe6): undefined reference to `bfd_mach_o_lookup_command' collect2.exe: error: ld returned 1 exit status See the original report here: https://inbox.sourceware.org/gdb-patches/865x1j1z61.fsf@gnu.org It turns out the problem was incorrect quoting in an AC_MSG_ERROR call within the configure script. The current code is structured like this: if CONDITION_1; then AC_MSG_ERROR("some message, some more message") elif CONDITION_2; then AC_MSG_ERROR("some message, some more message") fi As "..." is not recognized as quoting by m4, the comma inside is interpreted as an m4 argument separator, so 'some more message"' including the trailing quote becomes the exit status and '"some message' becomes the error message. Configure understands to quote the '"' in the error message, but the '"' in the exit status is not quoted, which leaves an unbalanced quote in the configure script. Luckily the second AC_MSG_ERROR line also has the same problem, which adds a second unbalanced '"' into the configure script, which closes the string started by the first unbalanced quote. The string formed by these two unbalanced quotes just happens to include the entire CONDITION_2 `if` check. Fix this by replacing the use of '"..."' with '[...]' instead. This issue was introduced in commit: commit 809c1abc19d487daeed75842da867ce633159210 Date: Wed Aug 21 11:10:50 2024 -0300 gdb, configure: Add enable-binary-file-format option for configure As well as the two AC_MSG_ERROR calls the above commit introduced an incorrectly quoted AC_MSG_WARN call, I've fixed that too. The above commit also added an unnecessary ';' at the end of the two AC_MSG_ERROR lines, I've removed them in this commit. While reviewing the above commit I spotted a couple of issues with the error messages themselves. First 'elf' should be 'ELF' when talking about the file format, so I fixed that. And second, AC_MSG_ERROR calls normally don't have a trailing period, so I removed these from the error messages added by 809c1abc19d487da. Now when configuring with --enable-binary-file-formats='coff,xcoff,elf,macho' on a target that doesn't support Mach-O, e.g. GNU/Linux, the configure will stop like this: checking for ELF support in BFD... yes checking for library containing dlopen... (cached) none required checking for Mach-O support in BFD... no configure: error: Mach-O support was requested, but BFD does not support it make: *** [Makefile:13461: configure-gdb] Error 1 Finally, during a final review of this patch I spotted another place in our configure script where we were not quoting the argument to AC_MSG_WARN correctly. In this case the error was added in commit e76c5d173bbf7137. The problem line is: AC_MSG_WARN(disabling guile support, $GUILD fails compiling for $host) As AC_MSG_WARN expects only a single argument, everything after the comma will be discarded. Quote the string with '[...]' to ensure the full string is printed. --- gdb/configure | 12 ++++++------ gdb/configure.ac | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gdb/configure b/gdb/configure index 303d6ea011c..633004d3f70 100755 --- a/gdb/configure +++ b/gdb/configure @@ -29315,8 +29315,8 @@ $as_echo "$ac_cv_guild_ok" >&6; } if test "$ac_cv_guild_ok" = no; then have_libguile=no - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: disabling guile support" >&5 -$as_echo "$as_me: WARNING: disabling guile support" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: disabling guile support, $GUILD fails compiling for $host" >&5 +$as_echo "$as_me: WARNING: disabling guile support, $GUILD fails compiling for $host" >&2;} fi fi @@ -32080,8 +32080,8 @@ if test "$enable_binary_file_formats" != "all"; then # Do nothing. ;; *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"$req is required to support one or more requested targets. Adding it\"" >&5 -$as_echo "$as_me: WARNING: \"$req is required to support one or more requested targets. Adding it\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $req is required to support one or more requested targets. Adding it" >&5 +$as_echo "$as_me: WARNING: $req is required to support one or more requested targets. Adding it" >&2;} enable_binary_file_formats="${enable_binary_file_formats},$req" ;; esac @@ -32101,9 +32101,9 @@ enable_binary_file_formats=$(echo $enable_binary_file_formats | sed 's/,/ /g') for format in $enable_binary_file_formats do if test "$format" = "elf" && test "$bfd_supports_elf" != "yes"; then - as_fn_error but BFD does not support it." "\"elf support was requested" "$LINENO" 5; + as_fn_error $? "ELF support was requested, but BFD does not support it" "$LINENO" 5 elif test "$format" = "macho" && test "$bfd_supports_macho" != "yes"; then - as_fn_error but BFD does not support it." "\"Mach-O support was requested" "$LINENO" 5; + as_fn_error $? "Mach-O support was requested, but BFD does not support it" "$LINENO" 5 fi if test "$format" = "all"; then diff --git a/gdb/configure.ac b/gdb/configure.ac index e55a733fba7..943b2218a41 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1298,7 +1298,7 @@ if test "${have_libguile}" != no; then dnl If not, disable guile support. if test "$ac_cv_guild_ok" = no; then have_libguile=no - AC_MSG_WARN(disabling guile support, $GUILD fails compiling for $host) + AC_MSG_WARN([disabling guile support, $GUILD fails compiling for $host]) fi fi @@ -2080,7 +2080,7 @@ if test "$enable_binary_file_formats" != "all"; then # Do nothing. ;; *) - AC_MSG_WARN("$req is required to support one or more requested targets. Adding it") + AC_MSG_WARN([$req is required to support one or more requested targets. Adding it]) enable_binary_file_formats="${enable_binary_file_formats},$req" ;; esac @@ -2097,9 +2097,9 @@ enable_binary_file_formats=$(echo $enable_binary_file_formats | sed 's/,/ /g') for format in $enable_binary_file_formats do if test "$format" = "elf" && test "$bfd_supports_elf" != "yes"; then - AC_MSG_ERROR("elf support was requested, but BFD does not support it."); + AC_MSG_ERROR([ELF support was requested, but BFD does not support it]) elif test "$format" = "macho" && test "$bfd_supports_macho" != "yes"; then - AC_MSG_ERROR("Mach-O support was requested, but BFD does not support it."); + AC_MSG_ERROR([Mach-O support was requested, but BFD does not support it]) fi if test "$format" = "all"; then base-commit: a80fede20bc1330eca5e419392c6595bb3a6ac1d -- 2.25.4