diff --git a/ChangeLog b/ChangeLog index 4dc041060..de3524351 100644 --- a/ChangeLog +++ b/ChangeLog @@ -33,6 +33,8 @@ recurring tasks. This column can be added to any custom report. + Added support for "color.recurring" configuration variable which specifies the color of recurring tasks. + + Added support for "locking" configuration variable that controls whether + file locking is used. ------ old releases ------------------------------ diff --git a/html/config.html b/html/config.html index 20b211fcf..c614f3ad0 100644 --- a/html/config.html +++ b/html/config.html @@ -325,6 +325,21 @@ ID Project Pri Description whenever the shadow file is updated by some task command. +
+ Determines whether task uses file locking when accessing the pending.data + and completed.data files. Default to "on". Solaris users who store + the task data files on an NFS mount may need to set locking to "off". +
+ ++ Note that setting this value to "off" is dangerous. It means that + another program may write to the task.pending file when task is + attempting to do the same. +
+Note that the command:
diff --git a/html/task.html b/html/task.html index 04bc81f96..9f4ef60cc 100644 --- a/html/task.html +++ b/html/task.html @@ -127,6 +127,8 @@ recurring tasks. This column can be added to any custom report.
diff --git a/src/Config.cpp b/src/Config.cpp
index 643c0ac16..7ac95b1a7 100644
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -132,6 +132,7 @@ void Config::createDefault (const std::string& home)
fprintf (out, "color=on\n");
fprintf (out, "due=7\n");
fprintf (out, "nag=You have higher priority tasks.\n");
+ fprintf (out, "locking=on\n");
fprintf (out, "color.overdue=bold_red\n");
fprintf (out, "color.due=bold_yellow\n");
@@ -222,11 +223,13 @@ bool Config::get (const std::string& key, bool default_value)
{
std::string value = lowerCase ((*this)[key]);
- if (value == "t" ||
- value == "true" ||
- value == "1" ||
- value == "yes" ||
- value == "on")
+ if (value == "t" ||
+ value == "true" ||
+ value == "1" ||
+ value == "yes" ||
+ value == "on" ||
+ value == "enable" ||
+ value == "enabled")
return true;
return false;
diff --git a/src/TDB.cpp b/src/TDB.cpp
index 98a67e119..c77febb7a 100644
--- a/src/TDB.cpp
+++ b/src/TDB.cpp
@@ -38,6 +38,7 @@ TDB::TDB ()
: mPendingFile ("")
, mCompletedFile ("")
, mId (1)
+, mNoLock (false)
{
}
@@ -289,6 +290,9 @@ bool TDB::modifyT (const T& t)
////////////////////////////////////////////////////////////////////////////////
bool TDB::lock (FILE* file) const
{
+ if (mNoLock)
+ return true;
+
return flock (fileno (file), LOCK_EX) ? false : true;
}
@@ -300,8 +304,9 @@ bool TDB::overwritePending (std::vector