about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-03-17 16:55:04 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-03-17 16:55:04 +0000
commit9cfc991811c9affc47efec7a58bcf1df16790f53 (patch)
tree9db86b28e23a4b5c4d9126888925939fccd40102
parentc977b0125d562732ad62d9e0b682d2e271a9c3ee (diff)
downloadzsh-9cfc991811c9affc47efec7a58bcf1df16790f53.tar.gz
zsh-9cfc991811c9affc47efec7a58bcf1df16790f53.tar.xz
zsh-9cfc991811c9affc47efec7a58bcf1df16790f53.zip
unposted: calendar -s was broken by file locking change
-rw-r--r--ChangeLog7
-rw-r--r--Functions/Calendar/calendar16
2 files changed, 19 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 985bc468e..b7d1e8a38 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-03-17  Peter Stephenson  <pws@csr.com>
+
+	* unposted: Functions/Calendar/calendar: fix embarrassing bug in
+	calendar scheduling introduced by new file locking, 27756.
+
 2010-03-16  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
 	* unposted: Doc/Zsh/calsys.yo: age now uses zstat.
@@ -12915,5 +12920,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.4934 $
+* $Revision: 1.4935 $
 *****************************************************
diff --git a/Functions/Calendar/calendar b/Functions/Calendar/calendar
index baf6b36da..a7aa08595 100644
--- a/Functions/Calendar/calendar
+++ b/Functions/Calendar/calendar
@@ -42,6 +42,8 @@ if [[ -n $warnstr ]]; then
   fi
 fi
 
+local myschedcmds="${TMPPREFIX:-/tmp/zsh}.sched.$$"
+
 [[ -f $calendar ]] || return 1
 
 # We're not using getopts because we want +... to refer to a
@@ -394,8 +396,10 @@ fi
     if [[ $next -ge 0 ]]; then
       # Remove any existing calendar scheduling.
       i=${"${(@)zsh_scheduled_events#*:*:}"[(I)calendar -s*]}
-      (( i )) && sched -$i
-      $sched $next calendar "${calopts[@]}" $next $next
+      {
+        (( i )) && print sched -$i
+        print $sched $next calendar "${calopts[@]}" $next $next
+      } >$myschedcmds
     else
       $showprog $start $stop \
 "No more calendar events: calendar not rescheduled.
@@ -427,4 +431,10 @@ Old calendar left in $calendar.old." >&2
 }
 
 exit $rstat
-)
+) && {
+  # Tasks that need to be in the current shell
+  if [[ -f $myschedcmds ]]; then
+    . $myschedcmds
+    rm -f $myschedcmds
+  fi
+}