Changeset: 6a89e906f70d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6a89e906f70d
Modified Files:
        MonetDB.spec
        clients/R/MonetDB.R/DESCRIPTION
        clients/ruby/ruby-monetdb-sql-0.2.gemspec
        common/utils/msabaoth.c
Branch: embedded
Log Message:

Merge with default branch.


diffs (141 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -1,6 +1,6 @@
 %define name MonetDB
 %define version 11.22.0
-%{!?buildno: %define buildno %(date +%Y%m%d)}
+%{!?buildno: %global buildno %(date +%Y%m%d)}
 
 # groups of related archs
 %define all_x86 i386 i586 i686
@@ -422,7 +422,9 @@ program.
 %files -n rubygem-monetdb-sql
 %defattr(-,root,root)
 %docdir %{gem_dir}/doc/ruby-monetdb-sql-0.2
+%if (0%{?fedora} <= 23)
 %{gem_dir}/doc/ruby-monetdb-sql-0.2/*
+%endif
 %{gem_dir}/cache/ruby-monetdb-sql-0.2.gem
 # %dir %{gem_dir}/gems/ruby-monetdb-sql-0.2
 %{gem_dir}/gems/ruby-monetdb-sql-0.2
diff --git a/clients/R/MonetDB.R/DESCRIPTION b/clients/R/MonetDB.R/DESCRIPTION
--- a/clients/R/MonetDB.R/DESCRIPTION
+++ b/clients/R/MonetDB.R/DESCRIPTION
@@ -10,7 +10,7 @@ Depends: DBI (>= 0.3.1)
 Imports: digest (>= 0.6.4), methods, codetools
 Enhances: dplyr (>= 0.3.0), MonetDBLite
 Description: Allows to pull data from MonetDB into R. Includes a DBI 
implementation and a dplyr backend.
-License: MPL (== 1.1)
+License: MPL (== 2.0)
 URL: http://monetr.r-forge.r-project.org
 SystemRequirements: MonetDB, available from http://www.monetdb.org
 Collate: mapi.R dbi.R dbapply.R dplyr.R control.R
diff --git a/clients/ruby/ruby-monetdb-sql-0.2.gemspec 
b/clients/ruby/ruby-monetdb-sql-0.2.gemspec
--- a/clients/ruby/ruby-monetdb-sql-0.2.gemspec
+++ b/clients/ruby/ruby-monetdb-sql-0.2.gemspec
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
    s.date = %q{2015-10-29}
    s.authors = ["G Modena", "R Koopmanschap"]
    s.email = "i...@monetdb.org"
-   s.license = "MPL-1.1"
+   s.license = "MPL-2.0"
    s.summary = %q{Pure Ruby database driver for MonetDB/SQL}
    s.homepage = %q{http://www.monetdb.org/}
    s.description = %q{Pure Ruby database driver for the MonetDB/SQL columnar 
database management system}
diff --git a/common/utils/msabaoth.c b/common/utils/msabaoth.c
--- a/common/utils/msabaoth.c
+++ b/common/utils/msabaoth.c
@@ -30,6 +30,7 @@
 #include <time.h>
 #include <string.h> /* for getting error messages */
 #include <assert.h>
+#include <stddef.h>
 
 #include "msabaoth.h"
 #include "mutils.h"
@@ -93,6 +94,35 @@ getDBPath(char *pathbuf, size_t size, co
        return(NULL);
 }
 
+static inline int
+msab_isuuid(const char *restrict s)
+{
+       int hyphens = 0;
+
+       /* correct length */
+       if (strlen(s) != 36)
+               return 0;
+
+       /* hyphens at correct locations */
+       if (s[8] != '-' ||
+               s[13] != '-' ||
+               s[18] != '-' ||
+               s[23] != '-')
+               return 0;
+       /* only hexadecimals and hypens */
+       while (*s) {
+               if (!('a' <= *s && *s <= 'f') && !('0' <= *s && *s <= '9')) {
+                       if (*s == '-')
+                               hyphens++;
+                       else
+                               return 0;
+               }
+               s++;
+       }
+       /* correct number of hyphens */
+       return hyphens == 4;
+}
+
 /**
  * Initialises this Sabaoth instance to use the given dbfarm and dbname.
  * dbname may be NULL to indicate that there is no active database.  The
@@ -102,6 +132,8 @@ static void
 msab_init(const char *dbfarm, const char *dbname)
 {
        size_t len;
+       DIR *d;
+       char *tmp;
 
        assert(dbfarm != NULL);
 
@@ -134,6 +166,39 @@ msab_init(const char *dbfarm, const char
        } else {
                _sabaoth_internal_dbname = strdup(dbname);
        }
+
+       /* clean out old UUID files in case the database crashed in a
+        * previous incarnation */
+       if (_sabaoth_internal_dbname != NULL &&
+               (tmp = malloc(strlen(_sabaoth_internal_dbfarm) + 
strlen(_sabaoth_internal_dbname) + 2)) != NULL) {
+               sprintf(tmp, "%s%c%s", _sabaoth_internal_dbfarm, DIR_SEP, 
_sabaoth_internal_dbname);
+               if ((d = opendir(tmp)) != NULL) {
+                       struct dbe {
+                               struct dbe *next;
+                               char path[FLEXIBLE_ARRAY_MEMBER];
+                       } *dbe = NULL, *db;
+                       struct dirent *e;
+                       len = offsetof(struct dbe, path) + strlen(tmp) + 2;
+                       while ((e = readdir(d)) != NULL) {
+                               if (msab_isuuid(e->d_name) &&
+                                       (db = malloc(strlen(e->d_name) + len)) 
!= NULL) {
+                                       db->next = dbe;
+                                       dbe = db;
+                                       sprintf(db->path, "%s%c%s", tmp, 
DIR_SEP, e->d_name);
+                               }
+                       }
+                       closedir(d);
+                       /* unlink in a separate loop after reading the 
directory,
+                        * so as to not have any interference */
+                       while (dbe != NULL) {
+                               unlink(dbe->path);
+                               db = dbe;
+                               dbe = dbe->next;
+                               free(db);
+                       }
+               }
+               free(tmp);
+       }
 }
 void
 msab_dbpathinit(const char *dbpath)
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to