Hi,

On Sun,  7 Apr 2024 11:24:36 +0000
Klemens Nanni <[email protected]> wrote:
> On Fri, Apr 05, 2024 at 09:18:12PM +0300, Mikhail Pchelin wrote:
>> [cc'ing maintainer]
>> 
>> Currently glab port doesn't properly handle terminal input, for example,
>> after 'glab auth login' (setup wizard) you won't be able to type
>> properly or choose the options, you will get ^[[B^[[A etc stuff.
>> 
>> This happens because survey library on which whole interface is based
>> still uses syscall.* interface, which was removed in OpenBSD.
> 
> gitlab-cli and github-cli have been broken in this regard for some time
> already, but I never investigated it, thanks for tracking it down.
> 
>> 
>> The library (https://github.com/AlecAivazis/survey/) was abandoned by
>> the author:
>> 
>> > This project is no longer maintained. For an alternative, please check
>> > out: https://github.com/charmbracelet/bubbletea 
>> 
>> Inlined patch for this library fixes everything for me, but I must admit
>> that I've spent only couple hours with Go, and even if the patch looks
>> simple it can contain stupid mistakes, I'd be appreciated if someone
>> more proficient in Go can take a look at it (especially this 'unsafe'
>> stuff).
>> 
>> What would be the best way to bring the fix into the ports tree?
> 
> Best would to have it fixed upstream, either via patched survey or by
> switching to whatever can replace it.

There is a github issue that replaces the "survey" module with the
"charm" module.

https://github.com/cli/cli/issues/8084

It is still opening and seems to be taking a long time.

> Otherwise patching MODULES=lang/go ports isn't possible as modules are
> extracted during build, i.e. not before the patch target.
> 
> One way is to build from a vendor tarball, such that the lang/go module
> doesn't do module-wise extraction and we can patch is like any other port.

I created a patch which makes the program use
https://github.com/bsdmp/survey .

If this way is ok, I'll create a diff for gitlab-cli.

Index: devel/github-cli/Makefile
===================================================================
RCS file: /cvs/ports/devel/github-cli/Makefile,v
diff -u -p -r1.72 Makefile
--- devel/github-cli/Makefile   4 Feb 2026 17:45:53 -0000       1.72
+++ devel/github-cli/Makefile   28 Feb 2026 06:50:55 -0000
@@ -6,6 +6,15 @@ MODGO_VERSION =        v${V}
 
 DISTNAME =     cli-${MODGO_VERSION}
 PKGNAME =      github-cli-${V}
+REVISION =     0
+
+GH_ACCOUNT_SURVEY =    bsdmp
+GH_PROJECT_SURVEY =    survey
+GH_TAGNAME_SURVEY =    vv2.3.8
+SITES.a =      
https://github.com/${GH_ACCOUNT_SURVEY}/${GH_PROJECT_SURVEY}/archive/refs/tags/${GH_TAGNAME_SURVEY}/
+DISTNAME.a =   ${GH_PROJECT_SURVEY}-${GH_TAGNAME_SURVEY}
+DISTFILES.a =  ${DISTNAME.a}.tar.gz
+EXTRACT_ONLY += ${DISTFILES.a}
 
 CATEGORIES =   devel
 HOMEPAGE =     https://cli.github.com/
@@ -23,6 +32,11 @@ MODGO_LDFLAGS +=     -X "${MODGO_MODNAME}/in
 TEST_TARGET =  ./...
 
 PORTHOME =     ${WRKDIR}
+WRKDIST=       ${WRKDIR}/github.com/cli/cli/[email protected]
+
+pre-build:
+       (cd ${WRKDIST}; ${MODGO_CMD} mod edit -replace \
+           github.com/AlecAivazis/survey/v2=${WRKDIR}/${DISTNAME.a})
 
 post-install:
        ${WRKDIR}/go/bin/gen-docs --doc-path ${PREFIX}/man/man1 --man-page
Index: devel/github-cli/distinfo
===================================================================
RCS file: /cvs/ports/devel/github-cli/distinfo,v
diff -u -p -r1.64 distinfo
--- devel/github-cli/distinfo   4 Feb 2026 17:45:53 -0000       1.64
+++ devel/github-cli/distinfo   28 Feb 2026 06:50:56 -0000
@@ -54,8 +54,6 @@ SHA256 (go_modules/filippo.io/edwards255
 SHA256 (go_modules/filippo.io/edwards25519/@v/v1.1.0.zip) = 
msQ6aG0G/evXGfevOGbIfrBpMCJy37ExAHrfRxwwi2U=
 SHA256 
(go_modules/github.com/!adam!korcz/go-fuzz-headers-1/@v/v0.0.0-20230919221257-8b5d3ce2d11d.mod)
 = y7Qla8MWTNynhxxpaEHZd8PFtn6SBr6F0p0FcxsTr20=
 SHA256 
(go_modules/github.com/!adam!korcz/go-fuzz-headers-1/@v/v0.0.0-20230919221257-8b5d3ce2d11d.zip)
 = xeIXfrc3i0TQqU5I75XzFXBQ7P36+DnrT8SWwl6Dhsw=
-SHA256 (go_modules/github.com/!alec!aivazis/survey/v2/@v/v2.3.7.mod) = 
CqqVsN6ZpSz1/LtFkAZHw+VXxCVpBCy+2askDBzB30E=
-SHA256 (go_modules/github.com/!alec!aivazis/survey/v2/@v/v2.3.7.zip) = 
YTpJyGyrabZ/vI+w8LGDwjv9wnABIjMMa1MCDgHrrWA=
 SHA256 
(go_modules/github.com/!azure!a!d/microsoft-authentication-library-for-go/@v/v1.5.0.mod)
 = sv0bTjTUPRlzEVNelnZ7/cMwr5mPWt0Nn5qqGoatX3M=
 SHA256 
(go_modules/github.com/!azure!a!d/microsoft-authentication-library-for-go/@v/v1.6.0.mod)
 = sv0bTjTUPRlzEVNelnZ7/cMwr5mPWt0Nn5qqGoatX3M=
 SHA256 
(go_modules/github.com/!azure!a!d/microsoft-authentication-library-for-go/@v/v1.6.0.zip)
 = tb08IPEVLucVRu19EUZoePhc753uNbR61iGOYh2cxNw=
@@ -1292,6 +1290,7 @@ SHA256 (go_modules/sigs.k8s.io/yaml/@v/v
 SHA256 (go_modules/sigs.k8s.io/yaml/@v/v1.6.0.zip) = 
z4hkikcVgYF7AKQu6NJP1z6w41A5mM9G2OY3h+EeUFI=
 SHA256 (go_modules/software.sslmate.com/src/go-pkcs12/@v/v0.4.0.mod) = 
+/Vbaah9WjkQgv2brl5MdYEEH+Cbi7k7D+Fs3f6FzpU=
 SHA256 (go_modules/software.sslmate.com/src/go-pkcs12/@v/v0.4.0.zip) = 
VQGaOR5TAqUbpi6YkJ4AYiS4EgeGbakL6vWC7A3uA28=
+SHA256 (survey-vv2.3.8.tar.gz) = fPcSUSZ4Kkovs52dRmmAtg+lX8R/EDkhLaLMZJCphMU=
 SIZE (cli-v2.86.0.zip) = 15478803
 SIZE (go_modules/al.essio.dev/pkg/shellescape/@v/v1.5.1.mod) = 113
 SIZE (go_modules/al.essio.dev/pkg/shellescape/@v/v1.6.0.mod) = 113
@@ -1348,8 +1347,6 @@ SIZE (go_modules/filippo.io/edwards25519
 SIZE (go_modules/filippo.io/edwards25519/@v/v1.1.0.zip) = 55809
 SIZE 
(go_modules/github.com/!adam!korcz/go-fuzz-headers-1/@v/v0.0.0-20230919221257-8b5d3ce2d11d.mod)
 = 820
 SIZE 
(go_modules/github.com/!adam!korcz/go-fuzz-headers-1/@v/v0.0.0-20230919221257-8b5d3ce2d11d.zip)
 = 31575
-SIZE (go_modules/github.com/!alec!aivazis/survey/v2/@v/v2.3.7.mod) = 595
-SIZE (go_modules/github.com/!alec!aivazis/survey/v2/@v/v2.3.7.zip) = 162357
 SIZE 
(go_modules/github.com/!azure!a!d/microsoft-authentication-library-for-go/@v/v1.5.0.mod)
 = 336
 SIZE 
(go_modules/github.com/!azure!a!d/microsoft-authentication-library-for-go/@v/v1.6.0.mod)
 = 336
 SIZE 
(go_modules/github.com/!azure!a!d/microsoft-authentication-library-for-go/@v/v1.6.0.zip)
 = 258557
@@ -2586,3 +2583,4 @@ SIZE (go_modules/sigs.k8s.io/yaml/@v/v1.
 SIZE (go_modules/sigs.k8s.io/yaml/@v/v1.6.0.zip) = 60719
 SIZE (go_modules/software.sslmate.com/src/go-pkcs12/@v/v0.4.0.mod) = 100
 SIZE (go_modules/software.sslmate.com/src/go-pkcs12/@v/v0.4.0.zip) = 45988
+SIZE (survey-vv2.3.8.tar.gz) = 125803
Index: devel/github-cli/modules.inc
===================================================================
RCS file: /cvs/ports/devel/github-cli/modules.inc,v
diff -u -p -r1.55 modules.inc
--- devel/github-cli/modules.inc        17 Jan 2026 01:13:53 -0000      1.55
+++ devel/github-cli/modules.inc        28 Feb 2026 06:50:56 -0000
@@ -21,7 +21,6 @@ MODGO_MODULES =       \
        dario.cat/mergo                                                         
                 v1.0.2 \
        filippo.io/edwards25519                                                 
                 v1.1.0 \
        github.com/!adam!korcz/go-fuzz-headers-1                                
                 v0.0.0-20230919221257-8b5d3ce2d11d \
-       github.com/!alec!aivazis/survey/v2                                      
                 v2.3.7 \
        github.com/!azure!a!d/microsoft-authentication-library-for-go           
                 v1.6.0 \
        github.com/!azure/azure-sdk-for-go/sdk/azcore                           
                 v1.20.0 \
        github.com/!azure/azure-sdk-for-go/sdk/azidentity                       
                 v1.13.1 \

Reply via email to