Changeset: 7bb409f3c36a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/7bb409f3c36a
Modified Files:
        gdk/gdk_bbp.c
        gdk/gdk_logger.c
        gdk/gdk_storage.c
        monetdb5/modules/atoms/json.c
        sql/backends/monet5/UDF/capi/capi.c
Branch: Mar2025
Log Message:

In the unlikely event that GDKfilepath fails, don't report silly errors.
GDKfilepath reports what was wrong, and in no case that was an
allocation failure.


diffs (116 lines):

diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -1190,7 +1190,6 @@ fixhashashbat(BAT *b)
        char srcdir[MAXPATH];
 
        if (GDKfilepath(srcdir, sizeof(srcdir), NOFARM, BATDIR, nme, NULL) != 
GDK_SUCCEED) {
-               TRC_CRITICAL(GDK, "GDKfilepath failed\n");
                return GDK_FAIL;
        }
        char *s;
@@ -1406,7 +1405,6 @@ jsonupgradebat(BAT *b, json_storage_conv
        char srcdir[MAXPATH];
 
        if (GDKfilepath(srcdir, sizeof(srcdir), NOFARM, BATDIR, nme, NULL) != 
GDK_SUCCEED) {
-               TRC_CRITICAL(GDK, "GDKfilepath failed\n");
                return GDK_FAIL;
        }
 
@@ -1755,14 +1753,12 @@ BBPinit(bool allow_hge_upgrade, bool no_
                BBPtmlock();
 
                if (GDKfilepath(bbpdirstr, sizeof(bbpdirstr), 0, BATDIR, "BBP", 
"dir") != GDK_SUCCEED) {
-                       TRC_CRITICAL(GDK, "GDKmalloc failed\n");
                        BBPtmunlock();
                        ATOMIC_SET(&GDKdebug, dbg);
                        return GDK_FAIL;
                }
 
                if (GDKfilepath(backupbbpdirstr, sizeof(backupbbpdirstr), 0, 
BAKDIR, "BBP", "dir") != GDK_SUCCEED) {
-                       TRC_CRITICAL(GDK, "GDKmalloc failed\n");
                        BBPtmunlock();
                        ATOMIC_SET(&GDKdebug, dbg);
                        return GDK_FAIL;
@@ -1921,7 +1917,6 @@ BBPinit(bool allow_hge_upgrade, bool no_
                char jsonupgradestr[MAXPATH];
 
                if (GDKfilepath(jsonupgradestr, sizeof(jsonupgradestr), 0, 
BATDIR, "jsonupgradeneeded", NULL) != GDK_SUCCEED) {
-                       TRC_CRITICAL(GDK, "GDKfilepath failed\n");
                        ATOMIC_SET(&GDKdebug, dbg);
                        return GDK_FAIL;
                }
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1193,7 +1193,6 @@ log_open_output(logger *lg)
                        return GDK_FAIL;
                }
                if (GDKfilepath(filename, sizeof(filename), 
BBPselectfarm(PERSISTENT, 0, offheap), lg->dir, LOGFILE, id) != GDK_SUCCEED) {
-                       TRC_CRITICAL(GDK, "allocation failure\n");
                        GDKfree(new_range);
                        return GDK_FAIL;
                }
@@ -1998,7 +1997,6 @@ static gdk_return
 log_filename(logger *lg, char bak[FILENAME_MAX], char filename[FILENAME_MAX])
 {
        if (GDKfilepath(filename, FILENAME_MAX, 0, lg->dir, LOGFILE, NULL) != 
GDK_SUCCEED) {
-               GDKerror("Logger filename path is too large\n");
                return GDK_FAIL;
        }
        if (bak) {
diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c
--- a/gdk/gdk_storage.c
+++ b/gdk/gdk_storage.c
@@ -63,8 +63,10 @@ GDKfilepath(char *path, size_t pathlen, 
        const char *sep;
 
        if (GDKinmemory(farmid)) {
-               if (strcpy_len(path, ":memory:", pathlen) >= pathlen)
+               if (strcpy_len(path, ":memory:", pathlen) >= pathlen) {
+                       GDKerror("buffer too small\n");
                        return GDK_FAIL;
+               }
                return GDK_SUCCEED;
        }
 
diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c
--- a/monetdb5/modules/atoms/json.c
+++ b/monetdb5/modules/atoms/json.c
@@ -629,7 +629,7 @@ JSONprelude(void)
        char jsonupgrade[MAXPATH];
        struct stat st;
        if (GDKfilepath(jsonupgrade, sizeof(jsonupgrade), 0, BATDIR, 
"jsonupgradeneeded", NULL) != GDK_SUCCEED)
-               throw(MAL, "json.prelude", "cannot allocate filename for json 
upgrade signal file");
+               throw(MAL, "json.prelude", GDK_EXCEPTION);
        int r = stat(jsonupgrade, &st);
        if (r == 0) {
                /* The file exists so we need to run the upgrade code */
diff --git a/sql/backends/monet5/UDF/capi/capi.c 
b/sql/backends/monet5/UDF/capi/capi.c
--- a/sql/backends/monet5/UDF/capi/capi.c
+++ b/sql/backends/monet5/UDF/capi/capi.c
@@ -686,7 +686,7 @@ static str CUDFeval(Client cntxt, MalBlk
                }
                buf[i] = '\0';
                if (GDKfilepath(fname, sizeof(fname), 0, BATDIR, buf, "c") != 
GDK_SUCCEED) {
-                       msg = createException(MAL, "cudf.eval", 
MAL_MALLOC_FAIL);
+                       msg = createException(MAL, "cudf.eval", GDK_EXCEPTION);
                        goto wrapup;
                }
                oname = GDKstrdup(fname);
@@ -701,13 +701,13 @@ static str CUDFeval(Client cntxt, MalBlk
                memcpy(buf + prefix_size, SO_PREFIX, sizeof(char) * 
strlen(SO_PREFIX));
                char libname[MAXPATH];
                if (GDKfilepath(libname, sizeof(libname), 0, BATDIR, buf, 
SO_EXT[0] == '.' ? &SO_EXT[1] : SO_EXT) != GDK_SUCCEED) {
-                       msg = createException(MAL, "cudf.eval", 
MAL_MALLOC_FAIL);
+                       msg = createException(MAL, "cudf.eval", GDK_EXCEPTION);
                        goto wrapup;
                }
 
                // if TEMPDIR directory does not exist, create it
                if (GDKfilepath(tempdirpath, sizeof(tempdirpath), 0, NULL, 
TEMPDIR, NULL) != GDK_SUCCEED) {
-                       msg = createException(MAL, "cudf.eval", 
MAL_MALLOC_FAIL);
+                       msg = createException(MAL, "cudf.eval", GDK_EXCEPTION);
                        goto wrapup;
                }
                if (MT_mkdir(tempdirpath) < 0 && errno != EEXIST) {
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to