From: Simon Marchi <simark@simark.ca>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [PATCH] [pre-commit] Stop using deprecated language script
Date: Tue, 16 Jun 2026 11:46:15 -0400 [thread overview]
Message-ID: <e6b3b72d-5757-4448-b923-d96ce7e897c0@simark.ca> (raw)
In-Reply-To: <88bdbbf9-7ff3-4eb6-832a-1df7c785458f@suse.de>
On 6/16/26 11:32 AM, Tom de Vries wrote:
> On 6/16/26 3:46 PM, Simon Marchi wrote:
>> On 6/16/26 5:23 AM, Tom de Vries wrote:
>>> In v4.4.0, pre-commit renamed language script to unsupported_script.
>>>
>>> The rename was done to stress that pre-commit doesn't provide an environment
>>> for the script to run in [1].
>>>
>>> The language script is now a deprecated alias for unsupported_script, and the
>>> plan seems to be to initially produce a deprecation warning, and eventually
>>> remove support for the alias completely.
>>>
>>> Start using the new name: unsupported_script.
>>>
>>> Furthermore, the check-include-guards hook uses language python, and indeed it
>>> uses a python script, but it doesn't really need a virtual environment. It
>>> imports modules fnmatch, re, sys and typing, all of which are available in
>>> python 3.10 and later, which is the environment pre-commit itself requires
>>> (because we require pre-commit v4.5.1 or later, and pre-commit requires python
>>> 3.10 since v4.4.0). So while we're at it, use unsupported_script for this
>>> hook as well, reducing the amount of environments pre-commit has to manage.
>>>
>>> Tested using "pre-commit run --all-files" with python 3.10, as well as 3.13.
>>>
>>> [1] https://github.com/pre-commit/pre-commit/pull/3577
>>
>> From reading the pre-commit doc, I didn't understand the difference
>> between "unsupported_script" and "unsupported", did you?
>
> Not really.
>
> The difference seems to be that for unsupported_script "the entry should be a path relative to the root of the hook repository".
>
> Concretely, a hook like this using unsupported_script works:
> ...
> - id: bla
> name: bla
> language: unsupported
> entry: sh -c "echo bla; exit 1"
> ...
>
> Changing the language to unsupported_script gets us: "Executable `/data/vries/gdb/binutils-gdb.git/sh"` not found.
>
> To get the same effect, we need:
> ...
> - id: bla
> name: bla
> language: unsupported_script
> entry: /usr/bin/sh -c "echo bla; exit 1"
> ...
>
> Note that this version also works fine with language unsupported.
>
> The intent seems to be that unsupported_script is reserved for in-repo scripts, and unsupported is the fallback that supports anything else.
Ok, make sense. LGTM then.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Simon
prev parent reply other threads:[~2026-06-16 15:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 9:23 Tom de Vries
2026-06-16 13:46 ` Simon Marchi
2026-06-16 15:32 ` Tom de Vries
2026-06-16 15:46 ` Simon Marchi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e6b3b72d-5757-4448-b923-d96ce7e897c0@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox