Skip to content

Conversation

adombeck
Copy link
Contributor

@adombeck adombeck commented Sep 13, 2025

Some of our dependencies now require a newer Go version than 1.23.

Go 1.25 also allows us to use the new Output method of testing.T, making our test output easier to read.

The Noble archives only have Go 1.23, so we use our own Go PPA to install Go 1.25.

UDENG-8125

@adombeck adombeck force-pushed the go-1.25 branch 2 times, most recently from 2ac8111 to 5dfc53a Compare September 15, 2025 17:36
sudo apt-get update -y
sudo apt-get install -y golang-1.25
add-apt-repository ppa:ubuntu-enterprise-desktop/golang
apt-get install -y golang-1.25
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the install line should not be needed though, since we want to be picked automatically when doing apt build-dep no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed, see #1074 (comment)

Comment on lines 72 to 74
# Install Go 1.25 from our Go backports PPA
add-apt-repository ppa:ubuntu-enterprise-desktop/golang
apt-get install -y golang-1.25
Copy link
Contributor Author

@adombeck adombeck Sep 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, trying to install it here is too late, because the extra-source-build-script is run after apt build-dep ., which fails because golang-1.25 is not available in the APT sources. I'll create a PR in the desktop-engineering repo to add pre-deps-commands where we can add the PPA before the dependencies are installed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, good... or even better, I'd just scope to the repository--- So something like the PPAs does: apt-dependencies including a list of repositories we can add via add-apt-repository

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we also need to install software-properties-common before being able to use add-apt-repository (which is a bit unfortunate because it pulls in a lot of dependencies which we don't really need), so I added that to the pre-deps-commands.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return nil
}
var n C.int
tmp := C.copy_strv(strv, &n)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mh, that's unclear to me why this would work in a copied strv and not in the original one... 😱

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we actually just need to get the length of the array, we don't need to copy it. I pushed a fixup commit.

@adombeck adombeck force-pushed the go-1.25 branch 3 times, most recently from 4bf732f to e1255f2 Compare September 15, 2025 18:38
// Return the length of a NULL-terminated char** array.
size_t strv_len(char **strv) {
size_t n = 0;
while (strv && strv[n]) n++;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're checking for NULL value already in the caller (and in general a strv should never be null), so I'd just use: while (strv[n]) n++;

Ah, also take a const char *strv or even better const char * const * strv

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@adombeck adombeck force-pushed the go-1.25 branch 6 times, most recently from 85ae717 to 0a85010 Compare September 16, 2025 12:26
@adombeck adombeck marked this pull request as ready for review September 17, 2025 10:59
@adombeck adombeck requested a review from a team as a code owner September 17, 2025 10:59
@adombeck adombeck marked this pull request as draft September 17, 2025 10:59
@adombeck adombeck changed the title Bump go toolchain to 1.25.0 Use Go backports PPA in CI and bump go toolchain to 1.25.0 Sep 25, 2025
Some of our dependencies now require a newer Go version than 1.23.

Go 1.25 also allows us to use the new Output method of testing.T, making
our test output easier to read.
With Go 1.25, `go test -race` failed with:

    fatal error: checkptr: misaligned pointer conversion

    goroutine 72 gp=0xc0002281c0 m=8 mp=0xc00018a008 [running]:
    runtime.throw({0x16ece45?, 0x0?})
    	/home/user/go/pkg/mod/golang.org/[email protected]/src/runtime/panic.go:1094 +0x48 fp=0xc0002f7150 sp=0xc0002f7120 pc=0x489cc8
    runtime.checkptrAlignment(0xc0005fec1e, 0x1586820, 0x1)
    	/home/user/go/pkg/mod/golang.org/[email protected]/src/runtime/checkptr.go:20 +0x9a fp=0xc0002f7170 sp=0xc0002f7150 pc=0x41b8da
    github.com/ubuntu/authd/internal/users/localentries.strvToSlice(0xc0005fec1e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants