From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Af0ANE2xImrm5jUAWB0awg (envelope-from ) for ; Fri, 05 Jun 2026 07:21:49 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=NxPVimay; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=knFq/bGr; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=NxPVimay; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=knFq/bGr; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id D01061E062; Fri, 05 Jun 2026 07:21:49 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.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 CF54C1E062 for ; Fri, 05 Jun 2026 07:21:48 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 98A874BAE7DB for ; Fri, 5 Jun 2026 11:21:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 98A874BAE7DB Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=NxPVimay; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=knFq/bGr; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=NxPVimay; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=knFq/bGr Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id BBB6F4BA2E06 for ; Fri, 5 Jun 2026 11:21:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BBB6F4BA2E06 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BBB6F4BA2E06 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780658480; cv=none; b=pnvQJS0WSj5mTpcGNyF3+Tb/pUrnLbwlKlWSCVT7Dqg+XeuFZPBddq7Xni52pg1d4Wh4hJaqDQ6E0Wu6CSeffnyKkiMvYSumkg3AW8dVRincPY/ZvF0lVfKMbWGC0U9D3MPgPDor0Eoj62nYE/KthS9CpmIjB95a6LajP0TLEuk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780658480; c=relaxed/simple; bh=22iDExGajgLlPKzLPLLmJ6edc9mPD/iwT/dokFI/nIk=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-ID:MIME-Version; b=wO/fAhP9j27haCKxfQI0lIRJ7HNWIzoaNQ6K6z1iQgFVwsE5t9lXttSXNO41IRr14ihbsymp9AaoH7pHIMwDJSxV+GZifjTeFPc4xFRWdyMPrXgvxg3GwPIso1FTBUPmcXF/sW2LUJdRy6Nl9a0f58UkX9SqZYjYW7b3DkFi2CM= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=NxPVimay; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=knFq/bGr; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=NxPVimay; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=knFq/bGr DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BBB6F4BA2E06 Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id AF0F35C12C for ; Fri, 5 Jun 2026 11:21:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1780658478; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=bmZoArwWQOg5thUa9KbTzsyz9Mogcsaz5ndJg+Tb+2g=; b=NxPVimayZwVpyitBafKFKByS5fl7pliQGNVbZnfOJBCEhQdfIk13PBrFq9wflOs8wqMJ3G VSSZXhGXpxP6+TAA1b2lrIYZjrJj+GnPQa6EUvzvMQaWHa4lwQDuWwDtALdQLDheWcLriN fHw+kpgLRRVbRq0hyxQevD/YUURpd3k= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1780658478; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=bmZoArwWQOg5thUa9KbTzsyz9Mogcsaz5ndJg+Tb+2g=; b=knFq/bGrvMetHK0xN19T9DSTZQR+uXGCBlM+GyA4LCRyeu7bspx7P7i83HD12LpybRzMVm FGMccI+upjC816Ag== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1780658478; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=bmZoArwWQOg5thUa9KbTzsyz9Mogcsaz5ndJg+Tb+2g=; b=NxPVimayZwVpyitBafKFKByS5fl7pliQGNVbZnfOJBCEhQdfIk13PBrFq9wflOs8wqMJ3G VSSZXhGXpxP6+TAA1b2lrIYZjrJj+GnPQa6EUvzvMQaWHa4lwQDuWwDtALdQLDheWcLriN fHw+kpgLRRVbRq0hyxQevD/YUURpd3k= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1780658478; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=bmZoArwWQOg5thUa9KbTzsyz9Mogcsaz5ndJg+Tb+2g=; b=knFq/bGrvMetHK0xN19T9DSTZQR+uXGCBlM+GyA4LCRyeu7bspx7P7i83HD12LpybRzMVm FGMccI+upjC816Ag== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 98BDC779A9 for ; Fri, 5 Jun 2026 11:21:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 9k32Iy6xImquFQAAD6G6ig (envelope-from ) for ; Fri, 05 Jun 2026 11:21:18 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH v2] [pre-commit] Add file mode check Date: Fri, 5 Jun 2026 13:21:18 +0200 Message-ID: <20260605112118.854544-1-tdevries@suse.de> X-Mailer: git-send-email 2.51.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DBL_BLOCKED_OPENRESOLVER(0.00)[gnu.org:url,imap1.dmz-prg2.suse.org:helo,sourceware.org:url,suse.de:mid]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; RCVD_TLS_ALL(0.00)[] 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 Claude Code mentioned in a review that a source file was marked executable. I've submitted a patch to fix this [1]. Detect this problem using pre-commit to prevent it from re-occurring. The state before commit 15363a3be77 ("[gdb] Drop executable mode in some files") gives us (abbreviated output using "..."): ... $ pre-commit run check-file-mode --all-files check-file-mode.........................................................Failed - hook id: check-file-mode - exit code: 1 100755 ... gdb/testsuite/gdb.base/jump_multiple_objfiles.h 100755 ... gdb/testsuite/gdb.fortran/nested-funcs.f90 100755 ... gdb/testsuite/gdb.fortran/oop_extend_type.f90 100755 ... gdb/amd64-tdep.c 100755 ... gdb/testsuite/lib/compiler.cc 100755 ... gdb/testsuite/gdb.fortran/nested-funcs.exp 100755 ... gdb/testsuite/gdb.fortran/vla-type.f90 100755 ... gdb/testsuite/gdb.arch/amd64-lam.c 100755 ... gdb/testsuite/gdb.base/jump_multiple_objfiles.exp 100755 ... gdb/testsuite/gdb.testsuite/gdb_test_multiple-lbl.gdb 100755 ... gdb/testsuite/gdb.btrace/exception.exp 100755 ... gdb/testsuite/gdb.fortran/vla-type.exp 100755 ... gdb/testsuite/gdb.base/jump_multiple_objfiles.c 100755 ... gdb/testsuite/gdb.base/jump_multiple_objfiles-foo.c 100755 ... gdb/testsuite/gdb.fortran/oop_extend_type.exp 100755 ... gdb/testsuite/gdb.fortran/print_type.exp ... Shell-checked new script gdb/contrib/check-file-mode.sh. Changes in v2: - make sure git failure makes the script fail - make case statement more readable Versions: - v1 https://sourceware.org/pipermail/gdb-patches/2026-June/227791.html [1] https://sourceware.org/pipermail/gdb-patches/2026-June/227780.html --- .pre-commit-config.yaml | 5 ++++ gdb/contrib/check-file-mode.sh | 47 ++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100755 gdb/contrib/check-file-mode.sh diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fe8466433ac..d75468d0b48 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -112,6 +112,11 @@ repos: additional_dependencies: ["pyyaml"] always_run: true require_serial: true + - id: check-file-mode + name: check-file-mode + language: script + entry: gdb/contrib/check-file-mode.sh + files: '^(gdb|gdbserver|gdbsupport)/.*$' - repo: https://github.com/nmoroze/tclint rev: v0.8.0 hooks: diff --git a/gdb/contrib/check-file-mode.sh b/gdb/contrib/check-file-mode.sh new file mode 100755 index 00000000000..a6e05535e73 --- /dev/null +++ b/gdb/contrib/check-file-mode.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +# Copyright (C) 2026 Free Software Foundation, Inc. +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +set -e +set -o pipefail + +no_exec_files=() +for f in "$@"; do + case $f in + */*.py \ + | */*.sh \ + | */configure \ + | gdb/gstack-1.in \ + | gdb/gcore-1.in \ + | gdb/po/gdbtext \ + | gdb/make-init-c \ + | gdb/testsuite/lib/notty-wrap \ + | gdb/testsuite/lib/pdtrace.in ) + continue + ;; + *) + no_exec_files=("${no_exec_files[@]}" "$f") + ;; + esac +done + +if [ ${#no_exec_files[@]} -eq 0 ]; then + exit 0 +fi + +# Flag files that are executable, but not meant to be executable. + +git ls-files --stage -- "${no_exec_files[@]}" \ + | (! grep '^100755 ') base-commit: 3a5657bd3f26111214e70d3882150b06c9e45dff -- 2.51.0