Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 864618 Details for
Bug 909163
sys-fs/ncdu: Consider refraining from using compgen in the ebuild
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
001-sys-fs-ncdu-refrain-from-using-compgen-to-locate-zig.patch
0001-sys-fs-ncdu-refrain-from-using-compgen-to-locate-zig.patch (text/plain), 3.99 KB, created by
kfm
on 2023-06-26 02:00:13 UTC
(
hide
)
Description:
001-sys-fs-ncdu-refrain-from-using-compgen-to-locate-zig.patch
Filename:
MIME Type:
Creator:
kfm
Created:
2023-06-26 02:00:13 UTC
Size:
3.99 KB
patch
obsolete
>From bf97f084f575c3baae7dc0cf46026d2eabb0dbfd Mon Sep 17 00:00:00 2001 >From: Kerin Millar <kfm@plushkava.net> >Date: Mon, 26 Jun 2023 03:46:43 +0200 >Subject: [PATCH] sys-fs/ncdu: refrain from using compgen to locate zig > >The availability of the compgen builtin depends on whether bash was >compiled with --enable-readline. As such, it is sensible to avoid it in >scripts intended for non-interactive shells. > >Though it would have been straightforward to mimic the behaviour of >compgen -c, let's just search ${BROOT}/usr/bin instead. From what I can >gather, both dev-lang/zig and dev-lang/zig-bin install a (versioned) >symlink to /usr/bin, with there being no apparent need to search >elsewhere. > >While at it, address an error of logic whereby ZIG_VER was defined as >the value of ver, rather than selected_ver (though it is unclear to me >why ZIG_VER is exported at all). > >Signed-off-by: Kerin Millar <kfm@plushkava.net> >Bug: https://bugs.gentoo.org/909163 >--- > sys-fs/ncdu/ncdu-2.2.2-r1.ebuild | 88 ++++++++++++++------------------ > 1 file changed, 37 insertions(+), 51 deletions(-) > >diff --git a/sys-fs/ncdu/ncdu-2.2.2-r1.ebuild b/sys-fs/ncdu/ncdu-2.2.2-r1.ebuild >index 74c745fa8f..1bc1210d4c 100644 >--- a/sys-fs/ncdu/ncdu-2.2.2-r1.ebuild >+++ b/sys-fs/ncdu/ncdu-2.2.2-r1.ebuild >@@ -42,65 +42,51 @@ QA_FLAGS_IGNORED="usr/bin/ncdu" > # Adapted from https://github.com/gentoo/gentoo/pull/28986 > # Set the EZIG environment variable. > zig-set_EZIG() { >- [[ -n ${EZIG} ]] && return >+ local candidate selected selected_ver ver > >- if [[ -n ${EZIG_OVERWRITE} ]]; then >- export EZIG="${EZIG_OVERWRITE}" >+ if [[ ${EZIG} ]]; then >+ return >+ elif [[ ${EZIG_OVERWRITE} ]]; then >+ export EZIG=${EZIG_OVERWRITE} > return > fi > >- local candidates candidate selected selected_ver >- >- candidates=$(compgen -c zig-) >- >- for candidate in ${candidates}; do >- if [[ ! ${candidate} =~ zig(-bin)?-([.0-9]+) ]]; then >- continue >- fi >- >- local ver >- if (( ${#BASH_REMATCH[@]} == 3 )); then >- ver="${BASH_REMATCH[2]}" >- else >- ver="${BASH_REMATCH[1]}" >- fi >- >- if [[ -n ${EZIG_EXACT_VER} ]]; then >- ver_test "${ver}" -ne "${EZIG_EXACT_VER}" && continue >- >- selected="${candidate}" >- selected_ver="${ver}" >- break >+ for candidate in "${BROOT}"/usr/bin/zig-*; do >+ if [[ -L ${candidate} && ${candidate} == */zig?(-bin)-+([0-9.]) ]]; then >+ ver=${candidate##*-} >+ if [[ ${EZIG_EXACT_VER} ]]; then >+ if ver_test "${ver}" -ne "${EZIG_EXACT_VER}"; then >+ continue >+ else >+ selected=${candidate} >+ selected_ver=${ver} >+ break >+ fi >+ elif [[ ${EZIG_MIN} ]] && >+ ver_test "${ver}" -lt "${EZIG_MIN}"; then >+ # Candidate does not satisfy EZIG_MIN condition. >+ continue >+ elif [[ ${EZIG_MAX_EXCLUSIVE} ]] && >+ ver_test "${ver}" -ge "${EZIG_MAX_EXCLUSIVE}"; then >+ # Candidate does not satisfy EZIG_MAX_EXCLUSIVE condition. >+ continue >+ elif [[ ${selected_ver} ]] && >+ ver_test "${selected_ver}" -gt "${ver}"; then >+ # Candidate is older than the currently selected candidate. >+ continue >+ else >+ selected=${candidate} >+ selected_ver=${ver} >+ fi > fi >- >- if [[ -n ${EZIG_MIN} ]] \ >- && ver_test "${ver}" -lt "${EZIG_MIN}"; then >- # Candidate does not satisfy EZIG_MIN condition. >- continue >- fi >- >- if [[ -n ${EZIG_MAX_EXCLUSIVE} ]] \ >- && ver_test "${ver}" -ge "${EZIG_MAX_EXCLUSIVE}"; then >- # Candidate does not satisfy EZIG_MAX_EXCLUSIVE condition. >- continue >- fi >- >- if [[ -n ${selected_ver} ]] \ >- && ver_test "${selected_ver}" -gt "${ver}"; then >- # Candidate is older than the currently selected candidate. >- continue >- fi >- >- selected="${candidate}" >- selected_ver="${ver}" > done > >- if [[ -z ${selected} ]]; then >- die "Could not find (suitable) zig installation in PATH" >+ if [[ ! ${selected} ]]; then >+ die "Could not find (suitable) zig installation in ${BROOT}/usr/bin" >+ else >+ export EZIG=${selected} >+ export EZIG_VER=${selected_ver} > fi >- >- export EZIG="${selected}" >- export EZIG_VER="${ver}" > } > > # Invoke zig with the optionally provided arguments. >-- >2.39.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 909163
:
864618
|
864624
|
864625