From 4b79f6106c46c7314e89f98af9a30fd8702050f0 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Wed, 19 Oct 2022 12:26:14 -0400 Subject: [PATCH] NetAuth: fix generation of manpages & completions on cross --- srcpkgs/NetAuth/patches/default-entity.patch | 28 ++++++++++++++++++++ srcpkgs/NetAuth/template | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 srcpkgs/NetAuth/patches/default-entity.patch diff --git a/srcpkgs/NetAuth/patches/default-entity.patch b/srcpkgs/NetAuth/patches/default-entity.patch new file mode 100644 index 00000000000..3a881143e07 --- /dev/null +++ b/srcpkgs/NetAuth/patches/default-entity.patch @@ -0,0 +1,28 @@ +From b1d12b4b7956d25fd4b23a92d1683cc389d163a2 Mon Sep 17 00:00:00 2001 +From: classabbyamp +Date: Wed, 19 Oct 2022 12:17:37 -0400 +Subject: [PATCH] internal/ctl/root.go: only set the default entity if no error + +when using qemu-user-static to run netauth in the xbps-src chroot on +cross (for generating completions/manpages), netauth segfaults because +it tries to access a field in a nil value after `user.Current()` errors. +This patch makes it so that the field is only accessed when it exists. +--- + internal/ctl/root.go | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/internal/ctl/root.go b/internal/ctl/root.go +index b20c0d2..842815e 100644 +--- a/internal/ctl/root.go ++++ b/internal/ctl/root.go +@@ -67,8 +67,9 @@ func onInit() { + user, err := user.Current() + if err != nil { + fmt.Println("Could not get default user:", err) ++ } else { ++ viper.SetDefault("entity", user.Username) + } +- viper.SetDefault("entity", user.Username) + } + + // Execute serves as the entrypoint to the ctl package. diff --git a/srcpkgs/NetAuth/template b/srcpkgs/NetAuth/template index 75c15e6c500..c12a0eae0f4 100644 --- a/srcpkgs/NetAuth/template +++ b/srcpkgs/NetAuth/template @@ -1,7 +1,7 @@ # Template file for 'NetAuth' pkgname=NetAuth version=0.6.1 -revision=2 +revision=3 wrksrc=netauth-$version build_style="go" build_helper="qemu"