[Pkg-zsh-devel] [PATCH 1/3…3/3] Several tweaks to d/zshrc's new completion enablement

Daniel Shahaf danielsh at apache.org
Mon Feb 17 10:48:40 GMT 2020


Three patches follow.

I'm not sure I understand why the Debian package has code that will only
run on Ubuntu.  It requires the Ubuntu maintainers to go through Debian
whenever they want to make Ubuntu-specific changes.  Wouldn't it be
better to have a standard way for downstream distros to add their
hooks?  For example, «() { [[ -e $1 ]] && source $1 } /etc/zsh/zshrc.$(lsb_release -si)»?

Cheers,

Daniel

[[[
From 27b153692be1157857e5f727f6ad1f1953a41600 Mon Sep 17 00:00:00 2001
From: Daniel Shahaf <danielsh at apache.org>
Date: Mon, 17 Feb 2020 10:32:25 +0000
Subject: [PATCH 1/3] Fix advice in comment: zprofile isn't sourced by
 non-login interactive shells.

---
 debian/zshrc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/zshrc b/debian/zshrc
index e184b6a6b..5f975c373 100644
--- a/debian/zshrc
+++ b/debian/zshrc
@@ -105,7 +105,7 @@ autoload -Uz run-help
 
 # If you don't want compinit called here, place the line
 # skip_global_compinit=1
-# in your $ZDOTDIR/.zshenv or $ZDOTDIR/.zprofile
+# in your $ZDOTDIR/.zshenv
 if grep -q 'ID.*=.*ubuntu' /etc/os-release && [[ -z "$skip_global_compinit" ]]; then
   autoload -U compinit
   compinit

From 43df82a3b729d50e2a638aeca21ae920679f996e Mon Sep 17 00:00:00 2001
From: Daniel Shahaf <danielsh at apache.org>
Date: Mon, 17 Feb 2020 10:32:56 +0000
Subject: [PATCH 2/3] Rearrange condition to take advantage of
 short-circuiting.

---
 debian/zshrc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/zshrc b/debian/zshrc
index 5f975c373..ecaced1f9 100644
--- a/debian/zshrc
+++ b/debian/zshrc
@@ -106,7 +106,7 @@ autoload -Uz run-help
 # If you don't want compinit called here, place the line
 # skip_global_compinit=1
 # in your $ZDOTDIR/.zshenv
-if grep -q 'ID.*=.*ubuntu' /etc/os-release && [[ -z "$skip_global_compinit" ]]; then
+if [[ -z "$skip_global_compinit" ]] && grep -q 'ID.*=.*ubuntu' /etc/os-release; then
   autoload -U compinit
   compinit
 fi

From e1c6b6886f9556c419a4f2370a4086f2dd10b57e Mon Sep 17 00:00:00 2001
From: Daniel Shahaf <danielsh at apache.org>
Date: Mon, 17 Feb 2020 10:38:06 +0000
Subject: [PATCH 3/3] d/zshrc: Tighten regex

It matched VERSION_ID and might match other keys or values as well.
---
 debian/zshrc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/zshrc b/debian/zshrc
index ecaced1f9..e0d80faf5 100644
--- a/debian/zshrc
+++ b/debian/zshrc
@@ -106,7 +106,7 @@ autoload -Uz run-help
 # If you don't want compinit called here, place the line
 # skip_global_compinit=1
 # in your $ZDOTDIR/.zshenv
-if [[ -z "$skip_global_compinit" ]] && grep -q 'ID.*=.*ubuntu' /etc/os-release; then
+if [[ -z "$skip_global_compinit" ]] && grep -q '^ID.*=.*ubuntu' /etc/os-release; then
   autoload -U compinit
   compinit
 fi
]]]



More information about the Pkg-zsh-devel mailing list