zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: PATCH: More sanity checks for vcs_info
@ 2009-11-06 14:24 Frank Terbeck
  0 siblings, 0 replies; only message in thread
From: Frank Terbeck @ 2009-11-06 14:24 UTC (permalink / raw)
  To: zsh-workers

Before, this could screw you:
cd /tmp; mkdir test; cd test; sudo chown root .; sudo chmod 700 .
---
 Functions/VCS_Info/VCS_INFO_bydir_detect |    1 +
 Functions/VCS_Info/vcs_info              |    2 ++
 2 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/Functions/VCS_Info/VCS_INFO_bydir_detect b/Functions/VCS_Info/VCS_INFO_bydir_detect
index 7985b69..0b5996f 100644
--- a/Functions/VCS_Info/VCS_INFO_bydir_detect
+++ b/Functions/VCS_Info/VCS_INFO_bydir_detect
@@ -8,6 +8,7 @@ local basedir="." realbasedir
 
 realbasedir="$(VCS_INFO_realpath ${basedir})"
 while [[ ${realbasedir} != '/' ]]; do
+    [[ -r ${realbasedir} ]] || return 1
     if [[ -n ${vcs_comm[detect_need_file]} ]] ; then
         [[ -d ${basedir}/${dirname} ]] && \
         [[ -e ${basedir}/${dirname}/${vcs_comm[detect_need_file]} ]] && \
diff --git a/Functions/VCS_Info/vcs_info b/Functions/VCS_Info/vcs_info
index a821e4d..4344d0b 100644
--- a/Functions/VCS_Info/vcs_info
+++ b/Functions/VCS_Info/vcs_info
@@ -41,6 +41,8 @@ vcs_info () {
     emulate -L zsh
     setopt extendedglob
 
+    [[ -r . ]] || return 0
+
     local pat
     local -i found
     local -a enabled disabled dps
-- 
1.6.5.rc2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-11-06 14:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-06 14:24 PATCH: PATCH: More sanity checks for vcs_info Frank Terbeck

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).