From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 9IXsIG/zMmpuTAwAWB0awg (envelope-from ) for ; Wed, 17 Jun 2026 15:20:15 -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=M+LtKguw; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=xetOujfq; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=M+LtKguw; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=xetOujfq; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 6DC0A1E070; Wed, 17 Jun 2026 15:20:15 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.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 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 2937D1E070 for ; Wed, 17 Jun 2026 15:20:14 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4F64A4BA23D6 for ; Wed, 17 Jun 2026 19:20:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4F64A4BA23D6 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=M+LtKguw; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=xetOujfq; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=M+LtKguw; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=xetOujfq 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 E4D704BA23C2 for ; Wed, 17 Jun 2026 19:19:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E4D704BA23C2 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 E4D704BA23C2 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=1781723954; cv=none; b=wxNHmg+nCIFpkpv/TQ/+rW8149v3KoZHzBO5s47nLz7XfiIPhxd3w8mR/ZmtqjxlYBu6WHifIR5CfguFUAqe/9Em6bk3hwBAlqWILF8WpAGHb5sz69cIPWFkitIE+sEamhWy051nueotixQh3kUbfNd7VUNjeTO6WyMUHCyxEAU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1781723954; c=relaxed/simple; bh=HmnR822HXAAoPNlSE765KsNhLA/I4LuhVy6s8cvyILI=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:To:From; b=Y0cfKU69ve43gl95GOJvCW6UlfbeHGZiASOporx/OYY9LZdE0X5lXPOEZTnKA47R0IwsD2qI9in+uepAxqz3DgU3B8/XnL4DZcDsgWXVL5dOXuuIJzeUjbaTuH7QbQ3OQbmeP+9y+Im5+LHkmroFa1qok7FJLXSx12FTwX9T67w= 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=M+LtKguw; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=xetOujfq; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=M+LtKguw; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=xetOujfq DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E4D704BA23C2 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 C9DAE75951; Wed, 17 Jun 2026 19:19:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1781723951; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YRkizf0r/CY6mLUUSli3XAekUGqYVkimxV2kHTmCBtU=; b=M+LtKguwCbwl9/ecwvw9GrimoYxw3A2jg/yMLKstrxGdTimVAJfYa2l7ZuotzGWMOSXrbv 4BTs0hFdlvRvlX1QlNtTfaIhJXaVcmsKftc8Z9NHENVeW3sjOGRl6e4iGJuG/ZaIaSBOkE DPjFurBNUr03U4tbx+OLhVnFJ6jU2k8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1781723951; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YRkizf0r/CY6mLUUSli3XAekUGqYVkimxV2kHTmCBtU=; b=xetOujfqveIvZSZuy2fXKzQpZCbroidbv9tvDicsZ9EDwrbY0ezJsHTvGp+Ec2ZEP7HSxf ca24IJI/4j7jAEDA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1781723951; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YRkizf0r/CY6mLUUSli3XAekUGqYVkimxV2kHTmCBtU=; b=M+LtKguwCbwl9/ecwvw9GrimoYxw3A2jg/yMLKstrxGdTimVAJfYa2l7ZuotzGWMOSXrbv 4BTs0hFdlvRvlX1QlNtTfaIhJXaVcmsKftc8Z9NHENVeW3sjOGRl6e4iGJuG/ZaIaSBOkE DPjFurBNUr03U4tbx+OLhVnFJ6jU2k8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1781723951; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YRkizf0r/CY6mLUUSli3XAekUGqYVkimxV2kHTmCBtU=; b=xetOujfqveIvZSZuy2fXKzQpZCbroidbv9tvDicsZ9EDwrbY0ezJsHTvGp+Ec2ZEP7HSxf ca24IJI/4j7jAEDA== 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 B4E1B779A8; Wed, 17 Jun 2026 19:19:11 +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 AkLzKi/zMmpHQAAAD6G6ig (envelope-from ); Wed, 17 Jun 2026 19:19:11 +0000 Message-ID: Date: Wed, 17 Jun 2026 21:19:11 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC] [pre-commit] Add check-new-file-license To: Tom Tromey Cc: gdb-patches@sourceware.org References: <20260605141051.881518-1-tdevries@suse.de> <87a4st5adc.fsf@tromey.com> Content-Language: en-US From: Tom de Vries In-Reply-To: <87a4st5adc.fsf@tromey.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-0.995]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo, suse.de:email, suse.de:mid] 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 On 6/17/26 7:45 PM, Tom Tromey wrote: >>>>>> "Tom" == Tom de Vries writes: > > Tom> I forgot to add a copyright notice to a file. > Tom> I came across gdb/contrib/license-check-new-files.sh, and ran it out of > Tom> curiosity, and it pointed out the file. > > I didn't know about this file. Weird that it has a '.sh' extension. > Yeah. Renaming it to .py show some pre-commit errors: ... gdb/contrib/license-check-new-files.py:58:5: E722 do not use bare 'except' gdb/contrib/license-check-new-files.py:106:9: E722 do not use bare 'except' ... > Tom> Add a pre-commit check check-new-file-license that runs the script. > > Tom> The check is only run for new files, because it's fairly slow, about 2 seconds > Tom> for an empty file: > > Hmm that really is quite slow. Is it 2 seconds per invocation or per > new file? > I did an experiment with 10 empty files: ... $ for n in $(seq 1 10); do f=gdb/bla-$n.c; touch $f; git add $f; done $ pre-commit run check-new-file-license -v check-new-file-license...................................................Passed - hook id: check-new-file-license - duration: 3.18s gdb/bla-1.c: None gdb/bla-10.c: None gdb/bla-2.c: None gdb/bla-3.c: None gdb/bla-4.c: None gdb/bla-5.c: None gdb/bla-6.c: None gdb/bla-7.c: None gdb/bla-8.c: None gdb/bla-9.c: None ... So, its seems it's per invocation. If there is a significant cost per file we could parallelize it, the current approach is serial. An invocation without new files is fairly quick: ... $ pre-commit run check-new-file-license -v check-new-file-license...................................................Passed - hook id: check-new-file-license - duration: 0.24s ... > Also the script seems to run git but I wonder if that's even necessary > in this setup. Git is used to detect the new files using a diff command. Maybe running this directly rather than going through a git interfacing library would be faster: ... $ git diff --name-only --cached --diff-filter=A ... Thanks, - Tom