Bruno Haible <[email protected]> writes:

> Collin Funk wrote:
>> Unfortunely, GitHub Actions uses an distribution which I will leave
>> unnamed, whos leadership has decided their primary purpose is to replace
>> GNU coreutils over the past year and a half.
>
> The choice of distro is not dictated by the GitHub Actions. It was my choice:
> I chose Ubuntu 26.04 because that contains a reasonably modern 'clang'.
> which is essential for the ASAN+UBSAN test. I did not pay attention to the
> other packages installed.

No worries at all; I wasn't blaming you for anything. Your rationale is
perfectly sound. :)

My complaint about GitHub Actions was that they only support one
distribution for GNU/Linux jobs. I guess their answer, which is
perfectly reasonable, is that they support container images, which would
allow you to use any distribution as long as they have container images,
which they all do nowadays. But containers have some gotchas in
coreutils test suite, so I don't think it is worth the hassle.

> But I can make sure it has GNU coreutils installed, like this:
>
>   # apt remove --allow-remove-essential coreutils-from-uutils
>   Create /etc/apt/preferences.d/uutils with contents:
>     Package: coreutils-from-uutils
>     Pin: release a=*
>     Pin-Priority: -10
>
> Should I?

TLDR: it is probably not worth the effort. A longer explanation is below
if you are interested in the rationale:

I'd caution you that it is an absolute pain to use GNU coreutils there.
If you were to do that, you would still have a 'coreutils' binary that
is not GNU coreutils anyway, so it wouldn't have helped in this specific
instance:

    $ podman run --rm -it ubuntu:26.04
    $ apt update -y && apt upgrade -y && echo $?
    [...]
    0
    $ apt remove --allow-remove-essential coreutils-from-uutils
    [...]
    $ coreutils --version
    coreutils 0.10.0 (multi-call binary)
    $ command -v coreutils
    /usr/bin/coreutils
    $ podman run --rm -it redhat/ubi8
    $ coreutils --version | head -n 3
    coreutils (GNU coreutils) 8.30
    Copyright (C) 2018 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later 
<https://gnu.org/licenses/gpl.html>.
    $ command -v coreutils
    /usr/bin/coreutils

Even more annoyingly, your strategy would prevent you from installing
the build-essential package if the CI uses it:

    $ podman run --rm -it ubuntu:26.04
    $ apt update -y && apt upgrade -y && echo $?
    [...]
    0
    $ apt remove --allow-remove-essential coreutils-from-uutils
    [...]
    $ cat <<\EOF > /etc/apt/preferences.d/uutils
    Package: coreutils-from-uutils
    Pin: release a=*
    Pin-Priority: -10
    EOF
    $ apt install build-essential 
    Solving dependencies... Error!  
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
    
    Unsatisfied dependencies:
     build-essential : Depends: coreutils-from-uutils but it is not installable
    Error: Unable to satisfy dependencies. Reached two conflicting assignments:
       1. coreutils-from-uutils:amd64 is selected for install because:
          1. build-essential:amd64=12.12ubuntu2.26.04.2 is selected for install
          2. build-essential:amd64 Depends coreutils-from-uutils
       2. coreutils-from-uutils:amd64 is available in version 0.0.0~ubuntu25
          but none of the choices are installable:
          - coreutils-from-uutils:amd64=0.0.0~ubuntu25 is not selected for 
install

That would be okay if build-essential was used as intended, i.e., only
packages required for building Debian packages depended on it, but that
is not the case in practice. See a few notable examples that make it
unlikely that you can actually use GNU coreutils on that distribution:

    cuda-crt-13-1
    cuda-nvcc-13-1
    cuda-crt-13-1
    python3-virtualenv
    python3-torch-rocm
    python3-torch
    python3-pip
    pyenv
    opam
    nim
    gnulib
    flex

Those were taken from the output of the following command:

    $ apt-cache rdepends build-essential

Perhaps 'flex' will cause problems for some packages you maintain CI
for; the rest shouldn't affect it. But they are annoying for actual
users. AFAIK, there is a change that is a WIP to fix that, but who knows
if it will be blessed by an SRU, let alone be a solution that satisfies
them.

In the meantime, here is the only way I have found to use GNU coreutils
there:

    $ podman run --rm -it ubuntu:26.04
    $ apt update -y && apt upgrade -y && echo $?
    [...]
    0
    $ apt install equivs
    [...]
    $ mkdir -p tmp; cd tmp
    $ apt remove --allow-remove-essential coreutils-from-uutils
    [...]
    $ cat <<\EOF > uutils
    Source: coreutils-from
    Section: utils
    Priority: optional
    Standards-Version: 4.6.2

    Package: coreutils-from-uutils
    Description: :)
    EOF
    $ equivs-build uutils
    [...]
    $ dpkg -i coreutils-from-uutils_1.0_all.deb
    $ dpkg -l | grep coreutils-from                      
    ii  coreutils-from-gnu               0.0.0~ubuntu25                     all 
         coreutils from the GNU coreutils project
    ii  coreutils-from-uutils            1.0                                all 
         Dummy package to fulfill package dependencies

Of course, that is a complete hack and may break your system in strange
and unexpected ways, if not now, then sometime in the unforeseen future.
I'm not really sharing it to advocate for doing so, just more so as an
example of how painful the process is, so you do not waste your time
figuring that out on your own, as I have.

Collin

Reply via email to