Subject: Re: [PATCH] ci: fix broken jobs on Ubuntu 25.10 caused by switch to sudo-rs(1)

From: Patrick Steinhardt <[email-masked]>
Date: Sat, 11 Oct 2025 12:57:52 +0200

On Fri, Oct 10, 2025 at 09:44:44AM -0700, Junio C Hamano wrote:
> Patrick Steinhardt <[email-masked]> writes:
> > @@ -65,6 +65,15 @@ ubuntu-*|i386/ubuntu-*|debian-*)
> >  		libsecret-1-dev libpcre2-dev meson ninja-build pkg-config cargo \
> >  		${CC_PACKAGE:-${CC:-gcc}} $PYTHON_PACKAGE
> >  
> > +	# Starting with Ubuntu 25.10, sudo can now be provided via either
> > +	# sudo(1) or sudo-rs(1), with the latter being the default. The problem
> > +	# is that it does not support `--preserve-env` though, which we rely on
> > +	# in our CI. We thus revert back to the C implementation.
> > +	if test -f /etc/alternatives/sudo
> > +	then
> > +		sudo update-alternatives --set sudo /usr/bin/sudo.ws
> > +	fi
> 
> So at least shouldn't we be limiting ourselves to do this only when
> /usr/bin/sudo.ws exists?  Or do it in the nested case "$distro" that
> immediately follows this one to limit the effect only to Ubuntu
> (which may need to make this into a helper function that is called
> for both ubuntu-* and i386/ubuntu-* arms)?

No other distro has this sudo.ws / sudo-rs split at the current point in
time, and because of this they don't have /etc/alternatives/sudo,
either. So for now at least the condition should be sufficient, I think.

If we want to tighten this we could probably make this something like
"if test -f /etc/alternatives/sudo && test -f /usr/bin/sudo.ws". But to
be honest, I feel like all variants are somewhat brittle here and
there's scenarios where all of them will fail with upstream changes. So
I feel like the current version is good enough, but I'm happy to adjust
if you continue to feel otherwise.

Also, we don't have to do this for i386/ubuntu. Ubuntu has dropped 32
bit support, so it won't ever adopt this split. I have a patch series
pending that'll convert this CI job to instead use i386/debian, which
still continues to maintain 32 bit.

Thanks!

Patrick