about summary refs log tree commit diff
diff options
context:
space:
mode:
authorStephane Chazelas <stephane.chazelas@gmail.com>2013-05-21 14:45:52 +0100
committerPeter Stephenson <pws@zsh.org>2013-05-21 14:45:52 +0100
commit2989e4b66e5efc9a756f59a738f9de32bb4d62cf (patch)
tree77fe32bd344ae42a69ee8be2d2c8fc1a5843e8b5
parentaa7467b0bfcf1e28fd2b2b91a88040946c680e59 (diff)
downloadzsh-2989e4b66e5efc9a756f59a738f9de32bb4d62cf.tar.gz
zsh-2989e4b66e5efc9a756f59a738f9de32bb4d62cf.tar.xz
zsh-2989e4b66e5efc9a756f59a738f9de32bb4d62cf.zip
31417: age function needs protection against file names starting "-"
-rw-r--r--ChangeLog5
-rw-r--r--Functions/Calendar/age6
2 files changed, 8 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 6cdb25ae9..4a32773e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-05-21  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* Stephane: 31417: Functions/Calendar/age: needs --
+	to protect againts files starting with -.
+
 2013-05-14  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* unposted: Completion/Unix/Command/_perforce: Improve
diff --git a/Functions/Calendar/age b/Functions/Calendar/age
index 8f6278fa2..2348da51a 100644
--- a/Functions/Calendar/age
+++ b/Functions/Calendar/age
@@ -36,18 +36,18 @@ autoload -Uz calendar_scandate
 local -a vals tmp
 
 [[ -e $REPLY ]] || return 1
-zstat -A vals +mtime $REPLY || return 1
+zstat -A vals +mtime -- $REPLY || return 1
 
 if (( $# >= 1 )); then
   if [[ $1 = :* ]]; then
-    zstat -A tmp -F "%Y/%m/%d" +mtime ${1[2,-1]} || return 1
+    zstat -A tmp -F "%Y/%m/%d" +mtime -- ${1#:} || return 1
     local AGEREF=$tmp[1]
   else
     local AGEREF=$1
   fi
   # if 1 argument given, never use globally defined AGEREF2
   if [[ $2 = :* ]]; then
-    zstat -A tmp -F "%Y/%m/%d" +mtime ${2[2,-1]} || return 1
+    zstat -A tmp -F "%Y/%m/%d" +mtime -- ${2#:} || return 1
     local AGEREF2=$tmp[1]
   else
     local AGEREF2=$2