zsh-workers
 help / color / mirror / code / Atom feed
From: Frank Terbeck <ft@bewatermyfriend.org>
To: zsh-workers@zsh.org
Subject: PATCH: PATCH: More sanity checks for vcs_info
Date: Fri,  6 Nov 2009 15:24:41 +0100	[thread overview]
Message-ID: <1257517481-20963-1-git-send-email-ft@bewatermyfriend.org> (raw)

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


                 reply	other threads:[~2009-11-06 14:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1257517481-20963-1-git-send-email-ft@bewatermyfriend.org \
    --to=ft@bewatermyfriend.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).