Fix libical

Libical searched zoneinfo in /usr/share/zoneinfo, and failed to find it.
This leads to, e.g., random Kontact freezes.
This commit is contained in:
Yury G. Kudryashov 2012-08-08 13:10:36 +04:00
parent 84e1da4b09
commit c03efbd8f9
2 changed files with 41 additions and 6 deletions

View File

@ -1,10 +1,13 @@
{stdenv, fetchurl, perl}:
{stdenv, fetchsvn, perl, cmake}:
stdenv.mkDerivation rec {
name = "libical-0.48";
src = fetchurl {
url = "mirror://sourceforge/freeassociation/${name}.tar.gz";
sha256 = "1w6znkh0xxhbcm717mbzfva9ycrqs2lajhng391i7pghaw3qprra";
name = "libical-0.48-p20120623";
src = fetchsvn {
url = "https://freeassociation.svn.sourceforge.net/svnroot/freeassociation/trunk/libical";
rev = "1130";
sha256 = "56caf19abdf44807fda75a67ef0886319551e53c4e4ece4da4fc862e34c64e1a";
};
buildNativeInputs = [ perl ];
buildNativeInputs = [ perl cmake ];
patches = [ ./respect-env-tzdir.patch ];
}

View File

@ -0,0 +1,32 @@
* Remove /usr/*/zoneinfo from the default search path
* Respect $TZDIR
diff --git a/src/libical/icaltz-util.c b/src/libical/icaltz-util.c
index adf7598..d2fd5c8 100644
--- a/src/libical/icaltz-util.c
+++ b/src/libical/icaltz-util.c
@@ -108,7 +108,7 @@ typedef struct
static int r_pos [] = {1, 2, 3, -2, -1};
-static char *search_paths [] = {"/usr/share/zoneinfo","/usr/lib/zoneinfo","/etc/zoneinfo","/usr/share/lib/zoneinfo"};
+static char *search_paths [] = {"/etc/zoneinfo"};
static char *zdir = NULL;
#define NUM_SEARCH_PATHS (sizeof (search_paths)/ sizeof (search_paths [0]))
@@ -195,6 +195,16 @@ set_zonedir (void)
const char *fname = ZONES_TAB_SYSTEM_FILENAME;
int i;
+ const char *env_tzdir = strdup (getenv ("TZDIR"));
+ if (env_tzdir) {
+ sprintf (file_path, "%s/%s", env_tzdir, fname);
+ if (!access (file_path, F_OK|R_OK)) {
+ zdir = env_tzdir;
+ return;
+ }
+ free (env_tzdir);
+ }
+
for (i = 0;i < NUM_SEARCH_PATHS; i++) {
sprintf (file_path, "%s/%s", search_paths [i], fname);
if (!access (file_path, F_OK|R_OK)) {