diff --git a/doc/tutorials/plugins.md b/doc/tutorials/plugins.md index a5e5aa5980e..5e7e3110476 100644 --- a/doc/tutorials/plugins.md +++ b/doc/tutorials/plugins.md @@ -340,7 +340,7 @@ Basically the implementation of `elektraLineSet` can be described with the follo // open the file if (error) { - ELEKTRA_SET_GENERAL_RESOURCE_ERROR( parentKey, keyString(parentKey)); + ELEKTRA_SET_RESOURCE_ERROR( parentKey, keyString(parentKey)); } for (/* each key */) { diff --git a/doc/tutorials/validation.md b/doc/tutorials/validation.md index 81842d62f70..b2b8f924860 100644 --- a/doc/tutorials/validation.md +++ b/doc/tutorials/validation.md @@ -46,7 +46,7 @@ sudo kdb mount validation.dump user/tests/together dump validation kdb vset user/tests/together/test 123 "[1-9][0-9]*" "Not a number" kdb set user/tests/together/test abc # STDERR: Sorry, module validation issued the error.* -# ERROR:C04100 +# ERROR:C03100 # RET:5 ``` @@ -265,7 +265,7 @@ you can run into [this](https://github.com/ElektraInitiative/libelektra/issues/2 kdb set /tests/tutorial/links/url "invalid url" # STDOUT-REGEX: Using name (user|system)/tests/tutorial/links/url # STDERR: .*Validation Syntactic.*not a valid URL.* -# ERROR: C04100 +# ERROR: C03100 # RET: 5 ``` @@ -298,13 +298,13 @@ There are many ways to do so directly supported by [the spec plugin](/src/plugin Another way is to trigger errors with the [error plugin](/src/plugins/error): ```sh -kdb setmeta /tests/tutorial/spec/should_not_be_here trigger/error C04200 +kdb setmeta /tests/tutorial/spec/should_not_be_here trigger/error C03200 #> Using keyname spec/tests/tutorial/spec/should_not_be_here kdb spec-mount /tests/tutorial kdb set /tests/tutorial/spec/should_not_be_here abc # STDOUT-REGEX: Using name (user|system)/tests/tutorial/spec/should_not_be_here # RET: 5 -# ERROR:C04200 +# ERROR:C03200 kdb get /tests/tutorial/spec/should_not_be_here # RET: 11 # STDERR: Did not find key '/tests/tutorial/spec/should_not_be_here' diff --git a/src/bindings/cpp/include/kdbplugin.hpp b/src/bindings/cpp/include/kdbplugin.hpp index 9e3a8732b95..930ae54fae1 100644 --- a/src/bindings/cpp/include/kdbplugin.hpp +++ b/src/bindings/cpp/include/kdbplugin.hpp @@ -77,7 +77,7 @@ class Delegator { #ifdef KDBERRORS_H // TODO: Correct? - ELEKTRA_ADD_BROKEN_PLUGIN_WARNINGF (errorKey, "Could not create C++ plugin: %s", msg); + ELEKTRA_ADD_PLUGIN_MISBHV_WARNINGF (errorKey, "Could not create C++ plugin: %s", msg); #endif return -1; } diff --git a/src/error/specification b/src/error/specification index df29d65aabd..c9d10051205 100644 --- a/src/error/specification +++ b/src/error/specification @@ -11,14 +11,14 @@ ignore:true :It is for errors which are not relevant anymore :an empty line will start the next error specification +number:C01100 +description:Resource +macro:RESOURCE + number:C01110 description:Out of Memory macro:OUT_OF_MEMORY -number:C01120 -description:General Resource -macro:GENERAL_RESOURCE - number:C01300 description:Installation macro:INSTALLATION @@ -32,25 +32,17 @@ description:Interface macro:INTERFACE number:C01430 -description:Broken plugin -macro:BROKEN_PLUGIN +description:Plugin Misbehavior +macro:PLUGIN_MISBHV number:C02000 description:Conflict macro:CONFLICTING_STATE -number:C03000 -description:Timeout -macro:TIMEOUT - -number:C04100 +number:C03100 description:Validation Syntactic macro:VALIDATION_SYNTACTIC -number:C04200 +number:C03200 description:Validation Semantic macro:VALIDATION_SEMANTIC - -number:C05000 -description:Out of Range -macro:OUT_OF_RANGE diff --git a/src/include/kdbmacros.h b/src/include/kdbmacros.h index cef217b81c2..c5471a26fcf 100644 --- a/src/include/kdbmacros.h +++ b/src/include/kdbmacros.h @@ -37,13 +37,13 @@ do \ { \ if (errno == EACCES) \ - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF ( \ + ELEKTRA_SET_RESOURCE_ERRORF ( \ parentKey, \ "Insufficient permissions to open configuration file for reading. Reason: %s. You might want " \ "to retry as root or change access using chmod.", \ strerror (errno)); \ else \ - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Could not open configuration file for reading. Reason: %s", \ + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Could not open configuration file for reading. Reason: %s", \ strerror (errno)); \ } while (0) @@ -51,16 +51,16 @@ do \ { \ if (errno == EACCES) \ - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF ( \ + ELEKTRA_SET_RESOURCE_ERRORF ( \ parentKey, \ "Insufficient permissions to open configuration file for writing. You might want to retry as " \ "root. Errno: %s", \ strerror (errno)); \ else \ - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, ":Could not open file for writing %s", strerror (errno)); \ + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, ":Could not open file for writing %s", strerror (errno)); \ } while (0) -#define ELEKTRA_MALLOC_ERROR(key, size) ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (key, "Unable to allocate %zu bytes.", size); +#define ELEKTRA_MALLOC_ERROR(key, size) ELEKTRA_SET_RESOURCE_ERRORF (key, "Unable to allocate %zu bytes.", size); /** * @brief Sets error if info != returned diff --git a/src/libs/elektra/kdb.c b/src/libs/elektra/kdb.c index 0f8f2cc01d5..16f153cb548 100644 --- a/src/libs/elektra/kdb.c +++ b/src/libs/elektra/kdb.c @@ -433,7 +433,7 @@ int kdbClose (KDB * handle, Key * errorKey) } else { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNING (errorKey, "Could not close modules: modules were not open"); + ELEKTRA_ADD_RESOURCE_WARNING (errorKey, "Could not close modules: modules were not open"); } if (handle->global) ksDel (handle->global); @@ -1077,7 +1077,7 @@ int kdbGet (KDB * handle, KeySet * ks, Key * parentKey) if (splitGet (split, parentKey, handle) == -1) { - ELEKTRA_ADD_BROKEN_PLUGIN_WARNINGF (parentKey, "Wrong keys in postprocessing: %s", keyName (ksCurrent (ks))); + ELEKTRA_ADD_PLUGIN_MISBHV_WARNINGF (parentKey, "Wrong keys in postprocessing: %s", keyName (ksCurrent (ks))); // continue, because sizes are already updated } ksClear (ks); @@ -1112,7 +1112,7 @@ int kdbGet (KDB * handle, KeySet * ks, Key * parentKey) /* Now post-process the updated keysets */ if (splitGet (split, parentKey, handle) == -1) { - ELEKTRA_ADD_BROKEN_PLUGIN_WARNINGF (parentKey, "Wrong keys in postprocessing: %s", keyName (ksCurrent (ks))); + ELEKTRA_ADD_PLUGIN_MISBHV_WARNINGF (parentKey, "Wrong keys in postprocessing: %s", keyName (ksCurrent (ks))); // continue, because sizes are already updated } diff --git a/src/libs/elektra/plugin.c b/src/libs/elektra/plugin.c index 26137705447..60e105c689e 100644 --- a/src/libs/elektra/plugin.c +++ b/src/libs/elektra/plugin.c @@ -297,7 +297,7 @@ Plugin * elektraPluginOpen (const char * name, KeySet * modules, KeySet * config { if ((handle->kdbOpen (handle, errorKey)) == -1) { - ELEKTRA_ADD_BROKEN_PLUGIN_WARNINGF ( + ELEKTRA_ADD_PLUGIN_MISBHV_WARNINGF ( errorKey, "Open of plugin returned unsuccessfully: %s. Reason contains plugin, see other warnings for details", name); elektraPluginClose (handle, errorKey); @@ -328,7 +328,7 @@ int elektraPluginClose (Plugin * handle, Key * errorKey) if (handle->kdbClose) { rc = handle->kdbClose (handle, errorKey); - if (rc == -1) ELEKTRA_ADD_GENERAL_RESOURCE_WARNING (errorKey, "kdbClose() failed"); + if (rc == -1) ELEKTRA_ADD_RESOURCE_WARNING (errorKey, "kdbClose() failed"); } ksDel (handle->config); diff --git a/src/libs/loader/dl.c b/src/libs/loader/dl.c index e4ba77fee76..143d6c007b3 100644 --- a/src/libs/loader/dl.c +++ b/src/libs/loader/dl.c @@ -137,7 +137,7 @@ int elektraModulesClose (KeySet * modules, Key * errorKey) } ret = -1; // TODO: Correct? - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (errorKey, "Could not close a module, dlclose failed: %s", dlerror ()); + ELEKTRA_ADD_RESOURCE_WARNINGF (errorKey, "Could not close a module, dlclose failed: %s", dlerror ()); ksAppendKey (newModules, cur); } diff --git a/src/libs/pluginprocess/pluginprocess.c b/src/libs/pluginprocess/pluginprocess.c index fcc5b3f2947..bf8490a97a9 100644 --- a/src/libs/pluginprocess/pluginprocess.c +++ b/src/libs/pluginprocess/pluginprocess.c @@ -199,7 +199,7 @@ void elektraPluginProcessStart (Plugin * handle, ElektraPluginProcess * pp) else { ELEKTRA_LOG_DEBUG ("Child: Unrecognized command %s", keyString (commandKey)); - ELEKTRA_SET_BROKEN_PLUGIN_ERRORF (key, "Received invalid command code or no KeySet: %s", keyString (commandKey)); + ELEKTRA_SET_PLUGIN_MISBHV_ERRORF (key, "Received invalid command code or no KeySet: %s", keyString (commandKey)); } errno = prevErrno; char * resultStr = longToStr (result); @@ -329,7 +329,7 @@ int elektraPluginProcessSend (const ElektraPluginProcess * pp, pluginprocess_t c long lresult = strtol (keyString (resultKey), &endPtr, 10); if (*endPtr != '\0' || errno == ERANGE || lresult > INT_MAX || lresult < INT_MIN) { - ELEKTRA_SET_BROKEN_PLUGIN_ERRORF (key, "Received invalid return code or no KeySet: %s", keyString (resultKey)); + ELEKTRA_SET_PLUGIN_MISBHV_ERRORF (key, "Received invalid return code or no KeySet: %s", keyString (resultKey)); lresult = ELEKTRA_PLUGIN_STATUS_ERROR; } else // Copy everything back into the actual keysets @@ -405,7 +405,7 @@ static int makePipe (ElektraPluginProcess * pp, Key * errorKey, const char * pip if ((ret = pipe (pipeRef))) { cleanupPluginData (pp, errorKey, 1); - ELEKTRA_SET_BROKEN_PLUGIN_ERRORF (errorKey, "Failed to initialize %s, pipe () returned %d", pipeName, ret); + ELEKTRA_SET_PLUGIN_MISBHV_ERRORF (errorKey, "Failed to initialize %s, pipe () returned %d", pipeName, ret); return 0; } return 1; @@ -496,7 +496,7 @@ ElektraPluginProcess * elektraPluginProcessInit (Key * errorKey) if (pp->pid < 0) { cleanupPluginData (pp, errorKey, 1); - ELEKTRA_SET_BROKEN_PLUGIN_ERRORF (errorKey, "Failed to fork the plugin process, fork () returned %d", pp->pid); + ELEKTRA_SET_PLUGIN_MISBHV_ERRORF (errorKey, "Failed to fork the plugin process, fork () returned %d", pp->pid); return NULL; } diff --git a/src/plugins/augeas/augeas.c b/src/plugins/augeas/augeas.c index 14c18129e92..a88e7cff9dc 100644 --- a/src/plugins/augeas/augeas.c +++ b/src/plugins/augeas/augeas.c @@ -415,7 +415,7 @@ static int saveTree (augeas * augeasHandle, KeySet * ks, const char * lensPath, memoryerror: elektraFree (keyArray); - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (parentKey, "Unable to allocate memory while saving the augeas tree"); + ELEKTRA_SET_RESOURCE_ERROR (parentKey, "Unable to allocate memory while saving the augeas tree"); return -1; } @@ -494,7 +494,7 @@ int elektraAugeasGet (Plugin * handle, KeySet * returned, Key * parentKey) if (content == 0) { fclose (fh); - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Error while reading file: %s", strerror (errno)); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Error while reading file: %s", strerror (errno)); } /* convert the string into an augeas tree */ @@ -578,7 +578,7 @@ int elektraAugeasSet (Plugin * handle, KeySet * returned, Key * parentKey) if (content == 0) { fclose (fh); - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Error while reading file: %s", strerror (errno)); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Error while reading file: %s", strerror (errno)); } /* convert the string into an augeas tree */ @@ -605,7 +605,7 @@ int elektraAugeasSet (Plugin * handle, KeySet * returned, Key * parentKey) ret = saveFile (augeasHandle, fh); fclose (fh); - if (ret < 0) ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Could not open file for writing: %s", strerror (errno)); + if (ret < 0) ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Could not open file for writing: %s", strerror (errno)); errno = errnosave; return 1; diff --git a/src/plugins/blockresolver/blockresolver.c b/src/plugins/blockresolver/blockresolver.c index 50c37f879b6..8fac07220f5 100644 --- a/src/plugins/blockresolver/blockresolver.c +++ b/src/plugins/blockresolver/blockresolver.c @@ -255,7 +255,7 @@ int elektraBlockresolverGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned E struct stat buf; if (stat (data->realFile, &buf)) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, "Failed to stat file %s\n", data->realFile); + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "Failed to stat file %s\n", data->realFile); return -1; } if (buf.st_mtime == data->mtime) return 0; @@ -264,7 +264,7 @@ int elektraBlockresolverGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned E fin = fopen (data->realFile, "r"); if (!fin) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Couldn't open %s for reading", data->realFile); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Couldn't open %s for reading", data->realFile); goto GET_CLEANUP; } @@ -289,7 +289,7 @@ int elektraBlockresolverGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned E fout = fopen (data->tmpFile, "w"); if (!fout) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Couldn't open %s for writing", data->tmpFile); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Couldn't open %s for writing", data->tmpFile); retVal = -1; goto GET_CLEANUP; } @@ -312,7 +312,7 @@ int elektraBlockresolverSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned E struct stat buf; if (stat (data->realFile, &buf)) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, "Failed to stat file %s\n", data->realFile); + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "Failed to stat file %s\n", data->realFile); return -1; } if (buf.st_mtime > data->mtime) @@ -337,13 +337,13 @@ int elektraBlockresolverSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned E fout = fopen (mergeFile, "w"); if (!fout) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Couldn't open %s for writing", data->realFile); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Couldn't open %s for writing", data->realFile); goto SET_CLEANUP; } fin = fopen (data->realFile, "r"); if (!fin) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Couldn't open %s for reading", data->realFile); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Couldn't open %s for reading", data->realFile); goto SET_CLEANUP; } block = (char *) getBlock (fin, 0, data->startPos); @@ -367,7 +367,7 @@ int elektraBlockresolverSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned E fin = fopen (data->tmpFile, "r"); if (!fin) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Couldn't open %s for reading", data->tmpFile); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Couldn't open %s for reading", data->tmpFile); goto SET_CLEANUP; } char buffer[BUFSIZE_MAX]; diff --git a/src/plugins/cache/cache.c b/src/plugins/cache/cache.c index 8256868c481..97fed9a2ef3 100644 --- a/src/plugins/cache/cache.c +++ b/src/plugins/cache/cache.c @@ -46,7 +46,7 @@ static int resolveCacheDirectory (Plugin * handle, CacheHandle * ch, Key * error ch->resolver = elektraPluginOpen (KDB_RESOLVER, ch->modules, resolverConfig, ch->cachePath); if (!ch->resolver) { - ELEKTRA_ADD_BROKEN_PLUGIN_WARNINGF (errorKey, "Open of plugin returned unsuccessfully: %s", KDB_RESOLVER); + ELEKTRA_ADD_PLUGIN_MISBHV_WARNINGF (errorKey, "Open of plugin returned unsuccessfully: %s", KDB_RESOLVER); elektraModulesClose (ch->modules, 0); ksDel (ch->modules); keyDel (ch->cachePath); @@ -66,7 +66,7 @@ static int loadCacheStoragePlugin (Plugin * handle, CacheHandle * ch, Key * erro ch->cacheStorage = elektraPluginOpen (KDB_CACHE_STORAGE, ch->modules, mmapstorageConfig, ch->cachePath); if (!ch->cacheStorage) { - ELEKTRA_ADD_BROKEN_PLUGIN_WARNINGF (errorKey, "Open of plugin returned unsuccessfully: %s", KDB_CACHE_STORAGE); + ELEKTRA_ADD_PLUGIN_MISBHV_WARNINGF (errorKey, "Open of plugin returned unsuccessfully: %s", KDB_CACHE_STORAGE); elektraPluginClose (ch->resolver, 0); elektraModulesClose (ch->modules, 0); ksDel (ch->modules); @@ -323,7 +323,7 @@ int elektraCacheSet (Plugin * handle, KeySet * returned, Key * parentKey) { if (rename (tmpFile, cacheFileName) == -1) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Could not rename file. Errno: %s", strerror (errno)); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Could not rename file. Errno: %s", strerror (errno)); goto error; } diff --git a/src/plugins/conditionals/README.md b/src/plugins/conditionals/README.md index 9c254546325..7079809ad85 100644 --- a/src/plugins/conditionals/README.md +++ b/src/plugins/conditionals/README.md @@ -80,7 +80,7 @@ kdb setmeta user/tests/conditionals/key check/condition "(../hkey == 'hello') ? # will fail kdb setmeta user/tests/conditionals/key check/condition "(../hkey == 'hello') ? (../fkey == '5.0')" # RET:5 -# ERROR:C04200 +# ERROR:C03200 ``` Assignment example: @@ -123,8 +123,8 @@ kdb export /tests/conditionals ini #> sub/key=false #> #@META check/condition = (./ == 'val1') ? (../sub/key == 'true') #> key1=val1 -# ERROR:C04200 -# Sorry, module conditionals issued the error C04200: +# ERROR:C03200 +# Sorry, module conditionals issued the error C03200: # Validation failed: Validation of Key key1: (./ == 'val1') ? (../sub/key == 'true') failed. ((../sub/key == 'true') failed) kdb set /tests/conditionals/sub/key true diff --git a/src/plugins/cpptemplate/cpptemplate.cpp b/src/plugins/cpptemplate/cpptemplate.cpp index d7278b3f417..18ca8180311 100644 --- a/src/plugins/cpptemplate/cpptemplate.cpp +++ b/src/plugins/cpptemplate/cpptemplate.cpp @@ -63,7 +63,7 @@ int elektraCppTemplateOpen (Plugin * handle, Key * key) } catch (exception const & error) { - ELEKTRA_SET_BROKEN_PLUGIN_ERRORF (key, "Uncaught Exception: %s", error.what ()); + ELEKTRA_SET_PLUGIN_MISBHV_ERRORF (key, "Uncaught Exception: %s", error.what ()); } return status; diff --git a/src/plugins/cpptype/README.md b/src/plugins/cpptype/README.md index 73c6e72b7fb..2559fff1926 100644 --- a/src/plugins/cpptype/README.md +++ b/src/plugins/cpptype/README.md @@ -66,7 +66,7 @@ kdb get user/tests/cpptype/key # If we try to store a string Elektra will not change the value kdb set user/tests/cpptype/key 'Not a char' # STDERR: .*The type char failed to match.* -# ERROR: C04200 +# ERROR: C03200 # RET: 5 kdb get user/tests/cpptype/key #> b diff --git a/src/plugins/crypto/botan_operations.cpp b/src/plugins/crypto/botan_operations.cpp index a98b650029b..550701f9f9f 100644 --- a/src/plugins/crypto/botan_operations.cpp +++ b/src/plugins/crypto/botan_operations.cpp @@ -154,7 +154,7 @@ int elektraCryptoBotanInit (Key * errorKey) } catch (std::exception const & e) { - ELEKTRA_SET_BROKEN_PLUGIN_ERRORF (errorKey, "Botan initialization failed: %s", e.what ()); + ELEKTRA_SET_PLUGIN_MISBHV_ERRORF (errorKey, "Botan initialization failed: %s", e.what ()); return -1; // failure } return 1; // success diff --git a/src/plugins/crypto/gpg.c b/src/plugins/crypto/gpg.c index eb01f85bc72..39eec0c805a 100644 --- a/src/plugins/crypto/gpg.c +++ b/src/plugins/crypto/gpg.c @@ -95,7 +95,7 @@ static int isExecutable (const char * file, Key * errorKey) { if (errorKey) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (errorKey, "gpg binary %s has no permission to execute", file); + ELEKTRA_SET_RESOURCE_ERRORF (errorKey, "gpg binary %s has no permission to execute", file); } return -2; } @@ -658,7 +658,7 @@ int ELEKTRA_PLUGIN_FUNCTION (gpgCall) (KeySet * conf, Key * errorKey, Key * msgK { case -1: // fork() failed - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (errorKey, "fork failed with errno: %s", strerror (errno)); + ELEKTRA_SET_RESOURCE_ERRORF (errorKey, "fork failed with errno: %s", strerror (errno)); closePipe (pipe_stdin); closePipe (pipe_stdout); closePipe (pipe_stderr); @@ -718,7 +718,7 @@ int ELEKTRA_PLUGIN_FUNCTION (gpgCall) (KeySet * conf, Key * errorKey, Key * msgK { if (write (pipe_stdin[1], keyValue (msgKey), sendMessageSize) != sendMessageSize) { - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (errorKey, "The communication with the GPG process failed."); + ELEKTRA_SET_RESOURCE_ERROR (errorKey, "The communication with the GPG process failed."); closePipe (pipe_stdin); closePipe (pipe_stdout); closePipe (pipe_stderr); diff --git a/src/plugins/csvstorage/csvstorage.c b/src/plugins/csvstorage/csvstorage.c index a9ba5b76331..682859e23fd 100644 --- a/src/plugins/csvstorage/csvstorage.c +++ b/src/plugins/csvstorage/csvstorage.c @@ -335,7 +335,7 @@ static int csvRead (KeySet * returned, Key * parentKey, char delim, Key * colAsP FILE * fp = fopen (fileName, "rb"); if (!fp) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "couldn't open file %s", fileName); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "couldn't open file %s", fileName); return -1; } int lastLine = 0; diff --git a/src/plugins/curlget/curlget.c b/src/plugins/curlget/curlget.c index f0bd479da7e..99c709d07c9 100644 --- a/src/plugins/curlget/curlget.c +++ b/src/plugins/curlget/curlget.c @@ -620,7 +620,7 @@ int elektraCurlgetGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA if (fd == -1) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Failed to open %s for reading", data->path); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Failed to open %s for reading", data->path); return -1; } FILE * fp = fetchFile (data, fd); @@ -632,13 +632,13 @@ int elektraCurlgetGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA fp = fopen (data->path, "rb"); if (fp && data->useLocalCopy) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "Failed to fetch configuration from %s, falling back to local copy %s\n", data->getUrl, data->path); } else { - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (parentKey, "Failed to read configuration\n"); + ELEKTRA_SET_RESOURCE_ERROR (parentKey, "Failed to read configuration\n"); return -1; } } @@ -763,7 +763,7 @@ int elektraCurlgetSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA fp = fopen (tmpFile, "rb"); if (!fp) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Failed to open %s for reading", tmpFile); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Failed to open %s for reading", tmpFile); return -1; } fseek (fp, 0L, SEEK_END); @@ -817,7 +817,7 @@ int elektraCurlgetSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA if (res != CURLE_OK) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "curl upload (HTTP POST) failed: %s\n", + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "curl upload (HTTP POST) failed: %s\n", curl_easy_strerror (res)); retval = -1; } @@ -833,7 +833,7 @@ int elektraCurlgetSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA res = curl_easy_perform (curl); if (res != CURLE_OK) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "curl upload (HTTP PUT) failed: %s", + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "curl upload (HTTP PUT) failed: %s", curl_easy_strerror (res)); retval = -1; } @@ -846,7 +846,7 @@ int elektraCurlgetSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA res = curl_easy_perform (curl); if (res != CURLE_OK) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "curl upload (HTTP PUT) failed: %s", + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "curl upload (HTTP PUT) failed: %s", curl_easy_strerror (res)); retval = -1; } @@ -883,7 +883,7 @@ int elektraCurlgetSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA res = curl_easy_perform (curl); if (res != CURLE_OK) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "curl upload (FTP PUT) failed: %s", + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "curl upload (FTP PUT) failed: %s", curl_easy_strerror (res)); retval = -1; } @@ -909,10 +909,10 @@ int elektraCurlgetSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA if (res != CURLE_OK) { if (data->putProto == PROTO_SCP) - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "curl upload (SCP) failed: %s", + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "curl upload (SCP) failed: %s", curl_easy_strerror (res)); else if (data->putProto == PROTO_SFTP) - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "curl upload (SFTP) failed: %s", + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "curl upload (SFTP) failed: %s", curl_easy_strerror (res)); retval = -1; } @@ -929,7 +929,7 @@ int elektraCurlgetSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA res = curl_easy_perform (curl); if (res != CURLE_OK) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "curl upload (default) failed: %s", + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "curl upload (default) failed: %s", curl_easy_strerror (res)); retval = -1; } diff --git a/src/plugins/directoryvalue/directoryvalue.cpp b/src/plugins/directoryvalue/directoryvalue.cpp index 064e79eff14..81cde1f57e7 100644 --- a/src/plugins/directoryvalue/directoryvalue.cpp +++ b/src/plugins/directoryvalue/directoryvalue.cpp @@ -81,11 +81,11 @@ int elektraDirectoryValueGet (Plugin * handle, KeySet * returned, Key * parentKe } catch (range_error const & error) { - ELEKTRA_SET_OUT_OF_RANGE_ERRORF (*parent, "Unable to insert array value %s", error.what ()); + ELEKTRA_SET_VALIDATION_SYNTACTIC_ERRORF (*parent, "Unable to insert array value %s", error.what ()); } catch (exception const & error) { - ELEKTRA_SET_BROKEN_PLUGIN_ERRORF (*parent, "Uncaught Exception: %s", error.what ()); + ELEKTRA_SET_PLUGIN_MISBHV_ERRORF (*parent, "Uncaught Exception: %s", error.what ()); } #ifdef HAVE_LOGGER @@ -114,11 +114,11 @@ int elektraDirectoryValueSet (Plugin * handle, KeySet * returned, Key * parentKe } catch (range_error const & error) { - ELEKTRA_SET_OUT_OF_RANGE_ERRORF (*parent, "Unable to insert array value %s", error.what ()); + ELEKTRA_SET_VALIDATION_SYNTACTIC_ERRORF (*parent, "Unable to insert array value %s", error.what ()); } catch (exception const & error) { - ELEKTRA_SET_BROKEN_PLUGIN_ERRORF (*parent, "Uncaught exception: %s", error.what ()); + ELEKTRA_SET_PLUGIN_MISBHV_ERRORF (*parent, "Uncaught exception: %s", error.what ()); } parent.release (); diff --git a/src/plugins/enum/README.md b/src/plugins/enum/README.md index ec52c7c7fbb..b2344ee12ef 100644 --- a/src/plugins/enum/README.md +++ b/src/plugins/enum/README.md @@ -60,7 +60,7 @@ kdb set /tests/enum/value low # should fail with error 04200 kdb set /tests/enum/value no # RET:5 -# ERROR:C04200 +# ERROR:C03200 ``` Or with multi-enums: @@ -81,7 +81,7 @@ kdb set /tests/enum/multivalue ___small_middle__ # should fail with error 04200 kdb set /tests/enum/multivalue ___all_small__ # RET:5 -# ERROR:C04200 +# ERROR:C03200 # cleanup kdb rm -r /tests/enum diff --git a/src/plugins/fcrypt/fcrypt.c b/src/plugins/fcrypt/fcrypt.c index f9cc9244e31..055eccdcdf3 100644 --- a/src/plugins/fcrypt/fcrypt.c +++ b/src/plugins/fcrypt/fcrypt.c @@ -127,7 +127,7 @@ static int shredTemporaryFile (int fd, Key * errorKey) if (fstat (fd, &tmpStat)) { - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (errorKey, "Failed to retrieve the file status of the temporary file."); + ELEKTRA_SET_RESOURCE_ERROR (errorKey, "Failed to retrieve the file status of the temporary file."); return -1; } @@ -146,7 +146,7 @@ static int shredTemporaryFile (int fd, Key * errorKey) return 1; error: - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (errorKey, "Failed to overwrite the temporary file."); + ELEKTRA_SET_RESOURCE_ERROR (errorKey, "Failed to overwrite the temporary file."); return -1; } @@ -226,7 +226,7 @@ static int fcryptGpgCallAndCleanup (Key * parentKey, KeySet * pluginConfig, char // gpg call returned success, overwrite the original file with the gpg payload data if (rename (tmpFile, keyString (parentKey)) != 0) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Renaming file %s to %s failed.", tmpFile, keyString (parentKey)); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Renaming file %s to %s failed.", tmpFile, keyString (parentKey)); result = -1; } } @@ -255,11 +255,11 @@ static int fcryptGpgCallAndCleanup (Key * parentKey, KeySet * pluginConfig, char if (parentKeyFd >= 0 && close (parentKeyFd)) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, "Failed to close a file descriptor: %s", strerror (errno)); + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "Failed to close a file descriptor: %s", strerror (errno)); } if (close (tmpFileFd)) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, "Failed to close a file descriptor: %s", strerror (errno)); + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "Failed to close a file descriptor: %s", strerror (errno)); } elektraFree (tmpFile); return result; @@ -493,7 +493,7 @@ static int fcryptDecrypt (KeySet * pluginConfig, Key * parentKey, fcryptState * } if (close (tmpFileFd)) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, "Failed to close a file descriptor: %s", strerror (errno)); + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "Failed to close a file descriptor: %s", strerror (errno)); } elektraFree (tmpFile); } @@ -535,7 +535,7 @@ int ELEKTRA_PLUGIN_FUNCTION (close) (Plugin * handle, KeySet * ks ELEKTRA_UNUSED { if (s->tmpFileFd > 0 && close (s->tmpFileFd)) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, "Failed to close a file descriptor: %s", strerror (errno)); + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "Failed to close a file descriptor: %s", strerror (errno)); } if (s->tmpFilePath) { @@ -574,7 +574,7 @@ int ELEKTRA_PLUGIN_FUNCTION (get) (Plugin * handle, KeySet * ks ELEKTRA_UNUSED, fcryptState * s = (fcryptState *) elektraPluginGetData (handle); if (!s) { - ELEKTRA_SET_BROKEN_PLUGIN_ERROR (parentKey, "No plugin state is available."); + ELEKTRA_SET_PLUGIN_MISBHV_ERROR (parentKey, "No plugin state is available."); return -1; } @@ -597,8 +597,7 @@ int ELEKTRA_PLUGIN_FUNCTION (get) (Plugin * handle, KeySet * ks ELEKTRA_UNUSED, shredTemporaryFile (s->tmpFileFd, parentKey); if (close (s->tmpFileFd)) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, "Failed to close a file descriptor: %s", - strerror (errno)); + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "Failed to close a file descriptor: %s", strerror (errno)); } s->tmpFileFd = -1; if (unlink (s->tmpFilePath)) @@ -639,21 +638,21 @@ int ELEKTRA_PLUGIN_FUNCTION (set) (Plugin * handle, KeySet * ks ELEKTRA_UNUSED, int fd = open (configFile, O_RDWR); if (fd == -1) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Could not open config file %s because %s", configFile, strerror (errno)); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Could not open config file %s because %s", configFile, strerror (errno)); return -1; } if (fsync (fd) == -1) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Could not fsync config file %s because %s", configFile, strerror (errno)); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Could not fsync config file %s because %s", configFile, strerror (errno)); if (close (fd)) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, "Failed to close a file descriptor: %s", strerror (errno)); + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "Failed to close a file descriptor: %s", strerror (errno)); } return -1; } if (close (fd)) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, "Failed to close a file descriptor: %s", strerror (errno)); + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "Failed to close a file descriptor: %s", strerror (errno)); } return 1; } diff --git a/src/plugins/file/file.c b/src/plugins/file/file.c index da1a41c10a6..dff58b6c3b7 100644 --- a/src/plugins/file/file.c +++ b/src/plugins/file/file.c @@ -48,7 +48,7 @@ int elektraFileGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA_UN struct stat sb; if (stat (fileName, &sb) == -1) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "failed to stat file %s, aborting. Reason: %s", fileName, strerror (errno)); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "failed to stat file %s, aborting. Reason: %s", fileName, strerror (errno)); return -1; } @@ -62,7 +62,7 @@ int elektraFileGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA_UN if (!buffer) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "failed to allocate buffer of %lld bytes for %s", fileSize, fileName); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "failed to allocate buffer of %lld bytes for %s", fileSize, fileName); return -1; } @@ -70,7 +70,7 @@ int elektraFileGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA_UN fp = fopen (fileName, "rb"); if (!fp) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Failed to open file %s", fileName); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Failed to open file %s", fileName); elektraFree (buffer); return -1; } @@ -142,7 +142,7 @@ int elektraFileSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA_UN fp = fopen (fileName, "wb"); if (!fp) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "failed to open %s for writing", fileName); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "failed to open %s for writing", fileName); return -1; } ssize_t svalueSize = keyGetValueSize (key); diff --git a/src/plugins/filecheck/filecheck.c b/src/plugins/filecheck/filecheck.c index 0f83a9a6973..bcda3a12882 100644 --- a/src/plugins/filecheck/filecheck.c +++ b/src/plugins/filecheck/filecheck.c @@ -206,7 +206,7 @@ static long checkFile (Key * parentKey, const char * filename, checkStruct * che FILE * fp = fopen (filename, "rb"); if (fp == NULL) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Couldn't open file %s", filename); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Couldn't open file %s", filename); return -1; } iconv_t conv = NULL; diff --git a/src/plugins/gitresolver/gitresolver.c b/src/plugins/gitresolver/gitresolver.c index 4d25fbde2f1..17d29f73dc0 100644 --- a/src/plugins/gitresolver/gitresolver.c +++ b/src/plugins/gitresolver/gitresolver.c @@ -641,7 +641,7 @@ int elektraGitresolverGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELE git_repository * repo = connectToLocalRepo (data); if (!repo) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Failed to open Repository %s\n", data->repo); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Failed to open Repository %s\n", data->repo); git_libgit2_shutdown (); return -1; } @@ -652,7 +652,7 @@ int elektraGitresolverGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELE git_reference * headRef = getHeadRef (data, repo); if (!headRef) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Failed to get reference %s\n", data->refName); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Failed to get reference %s\n", data->refName); git_repository_free (repo); git_libgit2_shutdown (); return -1; @@ -671,7 +671,7 @@ int elektraGitresolverGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELE const git_oid * headObj = git_reference_target (headRef); if (!headObj) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Failed to get reference %s\n", data->refName); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Failed to get reference %s\n", data->refName); git_reference_free (headRef); git_repository_free (repo); git_libgit2_shutdown (); @@ -704,7 +704,7 @@ int elektraGitresolverGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELE git_object * blob = getBlob (data, repo); if (!blob) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, "File %s not found in repository %s\n", data->file, data->repo); + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "File %s not found in repository %s\n", data->file, data->repo); git_repository_free (repo); git_libgit2_shutdown (); return 0; @@ -747,7 +747,7 @@ int elektraGitresolverGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELE outFile = fopen (keyString (parentKey), "w+"); if (!outFile) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Failed to check out file %s to %s\n", data->file, keyString (parentKey)); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Failed to check out file %s to %s\n", data->file, keyString (parentKey)); git_object_free (blob); git_repository_free (repo); git_libgit2_shutdown (); @@ -832,14 +832,14 @@ int elektraGitresolverSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELE git_repository * repo = connectToLocalRepo (data); if (!repo) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Failed to open Repository %s\n", data->repo); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Failed to open Repository %s\n", data->repo); git_libgit2_shutdown (); return -1; } git_reference * headRef = getHeadRef (data, repo); if (!headRef) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Failed to get reference %s\n", data->refName); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Failed to get reference %s\n", data->refName); git_repository_free (repo); git_libgit2_shutdown (); return -1; @@ -847,7 +847,7 @@ int elektraGitresolverSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELE const git_oid * headObj = git_reference_target (headRef); if (!headObj) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Failed to get reference %s\n", data->refName); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Failed to get reference %s\n", data->refName); git_reference_free (headRef); git_repository_free (repo); git_libgit2_shutdown (); diff --git a/src/plugins/hosts/README.md b/src/plugins/hosts/README.md index 3c347b85109..a28fb615f95 100644 --- a/src/plugins/hosts/README.md +++ b/src/plugins/hosts/README.md @@ -93,10 +93,10 @@ kdb get /tests/hosts/ipv6/localhost # Should both fail with error 04200 and return 5 kdb set /tests/hosts/ipv4/localhost ::1 # RET:5 -# ERROR:C04200 +# ERROR:C03200 kdb set /tests/hosts/ipv6/localhost 127.0.0.1 # RET:5 -# ERROR:C04200 +# ERROR:C03200 # cleanup kdb rm -r /tests/hosts diff --git a/src/plugins/hosts/hosts-set.c b/src/plugins/hosts/hosts-set.c index a18dc9bc399..f4669f1720e 100644 --- a/src/plugins/hosts/hosts-set.c +++ b/src/plugins/hosts/hosts-set.c @@ -139,7 +139,7 @@ int elektraHostsSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * pa if (ret < 0) { - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (parentKey, strerror (errno)); + ELEKTRA_SET_RESOURCE_ERROR (parentKey, strerror (errno)); fclose (fp); return -1; } diff --git a/src/plugins/ini/ini.c b/src/plugins/ini/ini.c index 5c2abe6de99..f2bd1e719d7 100644 --- a/src/plugins/ini/ini.c +++ b/src/plugins/ini/ini.c @@ -780,7 +780,7 @@ int elektraIniGet (Plugin * handle, KeySet * returned, Key * parentKey) switch (ret) { case -1: - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (parentKey, "Unable to open the ini file"); + ELEKTRA_SET_RESOURCE_ERROR (parentKey, "Unable to open the ini file"); break; case -2: ELEKTRA_SET_OUT_OF_MEMORY_ERROR (parentKey, "Memory allocation error while reading the ini file"); diff --git a/src/plugins/ipaddr/README.md b/src/plugins/ipaddr/README.md index 629e1c5d062..cb598711410 100644 --- a/src/plugins/ipaddr/README.md +++ b/src/plugins/ipaddr/README.md @@ -27,7 +27,7 @@ kdb setmeta /tests/ipaddr/ipv4 check/ipaddr ipv4 # Try to set an incorrect IP address kdb set /tests/ipaddr/ipv4 127.0.0.1337 # STDERR: .*Validation Semantic.* -# ERROR: C04200 +# ERROR: C03200 # RET: 5 # Set a correct IPv4 address diff --git a/src/plugins/jni/jni.c b/src/plugins/jni/jni.c index 282f881f81d..745277801b2 100644 --- a/src/plugins/jni/jni.c +++ b/src/plugins/jni/jni.c @@ -64,7 +64,7 @@ static void checkException (Data * data, const char * when, Key * warningKey) which = (*data->env)->GetStringUTFChars (data->env, estr, &iseCopy); } - ELEKTRA_ADD_BROKEN_PLUGIN_WARNINGF (warningKey, "During \"%s\", java exception was thrown: %s", when, which); + ELEKTRA_ADD_PLUGIN_MISBHV_WARNINGF (warningKey, "During \"%s\", java exception was thrown: %s", when, which); if (iseCopy == JNI_TRUE) { @@ -80,7 +80,7 @@ static int call1Arg (Data * data, Key * errorKey, const char * method) checkException (data, method, errorKey); if (jerrorKey == 0) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (errorKey, "Cannot create errorKey in %s", method); + ELEKTRA_SET_RESOURCE_ERRORF (errorKey, "Cannot create errorKey in %s", method); return -1; } @@ -96,7 +96,7 @@ static int call1Arg (Data * data, Key * errorKey, const char * method) result = (*data->env)->CallIntMethod (data->env, data->plugin, mid, jerrorKey); if ((*data->env)->ExceptionCheck (data->env)) { - ELEKTRA_SET_BROKEN_PLUGIN_ERRORF (errorKey, "%s failed with exception", method); + ELEKTRA_SET_PLUGIN_MISBHV_ERRORF (errorKey, "%s failed with exception", method); result = -1; } checkException (data, method, errorKey); @@ -113,7 +113,7 @@ static int call2Arg (Data * data, KeySet * ks, Key * errorKey, const char * meth checkException (data, method, errorKey); if (jks == 0) { - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (errorKey, "Cannot create ks"); + ELEKTRA_SET_RESOURCE_ERROR (errorKey, "Cannot create ks"); return -1; } @@ -121,7 +121,7 @@ static int call2Arg (Data * data, KeySet * ks, Key * errorKey, const char * meth checkException (data, method, errorKey); if (jkey == 0) { - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (errorKey, "Cannot create key"); + ELEKTRA_SET_RESOURCE_ERROR (errorKey, "Cannot create key"); return -1; } @@ -129,7 +129,7 @@ static int call2Arg (Data * data, KeySet * ks, Key * errorKey, const char * meth checkException (data, method, errorKey); if (mid == 0) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (errorKey, "Cannot find %s", method); + ELEKTRA_SET_RESOURCE_ERRORF (errorKey, "Cannot find %s", method); return -1; } @@ -137,7 +137,7 @@ static int call2Arg (Data * data, KeySet * ks, Key * errorKey, const char * meth result = (*data->env)->CallIntMethod (data->env, data->plugin, mid, jks, jkey); if ((*data->env)->ExceptionCheck (data->env)) { - ELEKTRA_SET_BROKEN_PLUGIN_ERRORF (errorKey, "%s failed with exception", method); + ELEKTRA_SET_PLUGIN_MISBHV_ERRORF (errorKey, "%s failed with exception", method); result = -1; } checkException (data, method, errorKey); @@ -175,7 +175,7 @@ int elektraJniOpen (Plugin * handle, Key * errorKey) k = ksLookupByName (config, "/classpath", 0); if (!k) { - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (errorKey, "Could not find plugin config /classpath"); + ELEKTRA_SET_RESOURCE_ERROR (errorKey, "Could not find plugin config /classpath"); return -1; } char classpatharg[] = "-Djava.class.path="; @@ -234,56 +234,56 @@ int elektraJniOpen (Plugin * handle, Key * errorKey) data->clsPlugin = (*data->env)->FindClass (data->env, classname); if (data->clsPlugin == 0) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (errorKey, "Cannot find class %s", classname); + ELEKTRA_SET_RESOURCE_ERRORF (errorKey, "Cannot find class %s", classname); return -1; } data->clsKey = (*data->env)->FindClass (data->env, "org/libelektra/Key"); if (data->clsKey == 0) { - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (errorKey, "Cannot find class Key"); + ELEKTRA_SET_RESOURCE_ERROR (errorKey, "Cannot find class Key"); return -1; } data->clsKeySet = (*data->env)->FindClass (data->env, "org/libelektra/KeySet"); if (data->clsKeySet == 0) { - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (errorKey, "Cannot find class KeySet"); + ELEKTRA_SET_RESOURCE_ERROR (errorKey, "Cannot find class KeySet"); return -1; } data->midKeyConstr = (*data->env)->GetMethodID (data->env, data->clsKey, "", "(J)V"); if (data->midKeyConstr == 0) { - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (errorKey, "Cannot find constructor of Key"); + ELEKTRA_SET_RESOURCE_ERROR (errorKey, "Cannot find constructor of Key"); return -1; } data->midKeySetConstr = (*data->env)->GetMethodID (data->env, data->clsKeySet, "", "(J)V"); if (data->midKeySetConstr == 0) { - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (errorKey, "Cannot find constructor of KeySet"); + ELEKTRA_SET_RESOURCE_ERROR (errorKey, "Cannot find constructor of KeySet"); return -1; } data->midKeyRelease = (*data->env)->GetMethodID (data->env, data->clsKey, "release", "()V"); if (data->midKeyRelease == 0) { - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (errorKey, "Cannot find release of Key"); + ELEKTRA_SET_RESOURCE_ERROR (errorKey, "Cannot find release of Key"); return -1; } data->midKeySetRelease = (*data->env)->GetMethodID (data->env, data->clsKeySet, "release", "()V"); if (data->midKeySetRelease == 0) { - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (errorKey, "Cannot find release of KeySet"); + ELEKTRA_SET_RESOURCE_ERROR (errorKey, "Cannot find release of KeySet"); return -1; } jmethodID midPluginConstructor = (*data->env)->GetMethodID (data->env, data->clsPlugin, "", "()V"); if (midPluginConstructor == 0) { - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (errorKey, "Cannot find constructor of plugin"); + ELEKTRA_SET_RESOURCE_ERROR (errorKey, "Cannot find constructor of plugin"); return -1; } @@ -291,7 +291,7 @@ int elektraJniOpen (Plugin * handle, Key * errorKey) checkException (data, "creating plugin", errorKey); if (data->plugin == 0) { - ELEKTRA_SET_BROKEN_PLUGIN_ERROR (errorKey, "Cannot create plugin"); + ELEKTRA_SET_PLUGIN_MISBHV_ERROR (errorKey, "Cannot create plugin"); return -1; } diff --git a/src/plugins/lineendings/lineendings.c b/src/plugins/lineendings/lineendings.c index 3cc79305960..fcbcd82e1be 100644 --- a/src/plugins/lineendings/lineendings.c +++ b/src/plugins/lineendings/lineendings.c @@ -151,7 +151,7 @@ int elektraLineendingsSet (Plugin * handle, KeySet * returned ELEKTRA_UNUSED, Ke switch (ret) { case (-1): - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Couldn't open file %s\n", keyString (parentKey)); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Couldn't open file %s\n", keyString (parentKey)); return 1; break; case (-2): diff --git a/src/plugins/mathcheck/README.md b/src/plugins/mathcheck/README.md index 9cb3ad4e0bd..56a6b164e0e 100644 --- a/src/plugins/mathcheck/README.md +++ b/src/plugins/mathcheck/README.md @@ -40,9 +40,9 @@ kdb setmeta user/tests/mathcheck/k check/math "== + ../a ../b" # should fail kdb set user/tests/mathcheck/k 7.7 # RET:5 -# ERROR:C04200 +# ERROR:C03200 # Set string to "7.7" -# Sorry, module mathcheck issued the error C04200: +# Sorry, module mathcheck issued the error C03200: # invalid value: 7.7 != 7.6 ``` diff --git a/src/plugins/multifile/multifile.c b/src/plugins/multifile/multifile.c index cde78d5130f..34df61e7315 100644 --- a/src/plugins/multifile/multifile.c +++ b/src/plugins/multifile/multifile.c @@ -411,7 +411,7 @@ static Codes updateFilesGlob (Plugin * handle, MultiConfig * mc, KeySet * found, } else if (ret == GLOB_ABORTED) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "glob(%s) failed with a read error", pattern); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "glob(%s) failed with a read error", pattern); } else if (ret == GLOB_NOMATCH) { diff --git a/src/plugins/network/network.c b/src/plugins/network/network.c index 0150f9f2660..11e470dfa46 100644 --- a/src/plugins/network/network.c +++ b/src/plugins/network/network.c @@ -93,7 +93,7 @@ int elektraPortInfo (Key * toCheck, Key * parentKey) if (sockfd < 0) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Could not open a socket: %s", strerror (errno)); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Could not open a socket: %s", strerror (errno)); } server = gethostbyname (hostname); diff --git a/src/plugins/passwd/passwd.c b/src/plugins/passwd/passwd.c index b676f2267e2..b9f1c5bf2d0 100644 --- a/src/plugins/passwd/passwd.c +++ b/src/plugins/passwd/passwd.c @@ -202,7 +202,7 @@ int elektraPasswdGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA_ FILE * pwfile = fopen (keyString (parentKey), "r"); if (!pwfile) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Failed to open configuration file %s\n", keyString (parentKey)); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Failed to open configuration file %s\n", keyString (parentKey)); return -1; } #if defined(USE_FGETPWENT) @@ -296,7 +296,7 @@ static int writeKS (KeySet * returned, Key * parentKey, SortBy index) FILE * pwfile = fopen (keyString (parentKey), "w"); if (!pwfile) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Failed to open %s for writing\n", keyString (parentKey)); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Failed to open %s for writing\n", keyString (parentKey)); return -1; } Key * cur; diff --git a/src/plugins/path/README.md b/src/plugins/path/README.md index fce1ecf5dbd..20e87d8542c 100644 --- a/src/plugins/path/README.md +++ b/src/plugins/path/README.md @@ -64,7 +64,7 @@ sudo kdb setmeta user/tests/path check/path/mode "rw" # Standard users should not be able to read/write the root folder kdb set user/tests/path "/root" -# ERROR:C04200 +# ERROR:C03200 # Set something which the current user can access for sure kdb set user/tests/path "$HOME" @@ -88,7 +88,7 @@ sudo kdb setmeta user/tests/path check/path/mode "rwx" kdb set user/tests/path/tempfile $(mktemp) chmod +rw `kdb get user/tests/path/tempfile` kdb set user/tests/path `kdb get user/tests/path/tempfile` -# ERROR:C04200 +# ERROR:C03200 # Set something which the current user can access for sure chmod +x `kdb get user/tests/path/tempfile` diff --git a/src/plugins/path/path.c b/src/plugins/path/path.c index 612ee6c0ddb..78018e6b581 100644 --- a/src/plugins/path/path.c +++ b/src/plugins/path/path.c @@ -76,7 +76,7 @@ static int validateKey (Key * key, Key * parentKey) strcat (errmsg, keyName (key)); strcat (errmsg, " with path: "); strcat (errmsg, keyValue (key)); - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, "Could not stat file, message: %s", errmsg); + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "Could not stat file, message: %s", errmsg); elektraFree (errmsg); errno = errnosave; return -1; @@ -85,14 +85,14 @@ static int validateKey (Key * key, Key * parentKey) { if (!S_ISBLK (buf.st_mode)) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, "Device not found: %s", keyString (key)); + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "Device not found: %s", keyString (key)); } } else if (!strcmp (keyString (meta), "directory")) { if (!S_ISDIR (buf.st_mode)) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, "Directory not found: %s", keyString (key)); + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "Directory not found: %s", keyString (key)); } } return 1; @@ -157,7 +157,7 @@ static int validatePermission (Key * key, Key * parentKey) name = p->pw_name; if (uid != 0) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "To check permissions for %s I need to be the root user." " Are you running kdb as root?\"", keyName (key)); @@ -266,7 +266,7 @@ static int switchGroup (Key * key, Key * parentKey, const char * name, const str int gidErr = setegid ((int) gr->gr_gid); if (gidErr < 0) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Could not set egid of user \"%s\" for key \"%s\"." " Are you running kdb as root?\"", name, keyName (key)); @@ -289,7 +289,7 @@ static int switchUser (Key * key, Key * parentKey, const struct passwd * p) int err = seteuid ((int) p->pw_uid); if (err < 0) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Could not set euid of user \"%s\" for key \"%s\"." " Are you running kdb as root?\"", p->pw_name, keyName (key)); diff --git a/src/plugins/python/python.cpp b/src/plugins/python/python.cpp index a5f369d053e..d7dd737410f 100644 --- a/src/plugins/python/python.cpp +++ b/src/plugins/python/python.cpp @@ -318,7 +318,7 @@ int PYTHON_PLUGIN_FUNCTION (Open) (ckdb::Plugin * handle, ckdb::Key * errorKey) Py_DECREF (pModule); if (klass == nullptr) { - ELEKTRA_SET_BROKEN_PLUGIN_ERROR (errorKey, "Module doesn't provide a ElektraPlugin class"); + ELEKTRA_SET_PLUGIN_MISBHV_ERROR (errorKey, "Module doesn't provide a ElektraPlugin class"); goto error_print; } @@ -329,7 +329,7 @@ int PYTHON_PLUGIN_FUNCTION (Open) (ckdb::Plugin * handle, ckdb::Key * errorKey) Py_DECREF (inst_args); if (inst == nullptr) { - ELEKTRA_SET_BROKEN_PLUGIN_ERROR (errorKey, "Unable to create instance of ElektraPlugin"); + ELEKTRA_SET_PLUGIN_MISBHV_ERROR (errorKey, "Unable to create instance of ElektraPlugin"); goto error_print; } data->instance = inst; diff --git a/src/plugins/quickdump/quickdump.c b/src/plugins/quickdump/quickdump.c index dbf596c5b50..f9b03ab9883 100644 --- a/src/plugins/quickdump/quickdump.c +++ b/src/plugins/quickdump/quickdump.c @@ -386,7 +386,7 @@ int elektraQuickdumpGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key const Key * sourceKey = ksLookupByName (returned, nameBuffer.string, 0); if (sourceKey == NULL) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF ( + ELEKTRA_SET_RESOURCE_ERRORF ( parentKey, "Could not copy meta data from key '%s': Key not found", nameBuffer.string); keyDel (k); elektraFree (nameBuffer.string); diff --git a/src/plugins/quickdump/readv1.c b/src/plugins/quickdump/readv1.c index 6ca4fab4c1d..7ced089ce0c 100644 --- a/src/plugins/quickdump/readv1.c +++ b/src/plugins/quickdump/readv1.c @@ -145,7 +145,7 @@ static int readVersion1 (FILE * file, KeySet * returned, Key * parentKey) const Key * sourceKey = ksLookupByName (returned, keyName, 0); if (sourceKey == NULL) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF ( + ELEKTRA_SET_RESOURCE_ERRORF ( parentKey, "Could not copy meta data from key '%s': Key not found", keyName); keyDel (k); elektraFree (keyName); diff --git a/src/plugins/resolver/filename.c b/src/plugins/resolver/filename.c index 2252f92e355..fbaf889455d 100644 --- a/src/plugins/resolver/filename.c +++ b/src/plugins/resolver/filename.c @@ -302,7 +302,7 @@ static int elektraResolveMapperUser (ElektraResolved * handle, ElektraResolveTem if (finished == -1) { // TODO: Correct?? - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (warningsKey, "user resolver failed at step %zu, the configuration is: %s", i, + ELEKTRA_ADD_RESOURCE_WARNINGF (warningsKey, "user resolver failed at step %zu, the configuration is: %s", i, ELEKTRA_VARIANT_USER); return -1; } @@ -310,7 +310,7 @@ static int elektraResolveMapperUser (ElektraResolved * handle, ElektraResolveTem if (!(handle->dirname)) { // TODO: Correct?? - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (warningsKey, "no resolver set the user dirname, the configuration is: %s", + ELEKTRA_ADD_RESOURCE_WARNINGF (warningsKey, "no resolver set the user dirname, the configuration is: %s", ELEKTRA_VARIANT_USER); return -1; } @@ -460,14 +460,14 @@ static int elektraResolveMapperSystem (ElektraResolved * handle, ElektraResolveT } if (finished == -1) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (warningsKey, "no resolver set the user dirname, the configuration is: %s", + ELEKTRA_ADD_RESOURCE_WARNINGF (warningsKey, "no resolver set the user dirname, the configuration is: %s", ELEKTRA_VARIANT_USER); return -1; } if (!(handle->fullPath)) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (warningsKey, "no resolver set the system dirname, the configuration is: %s", + ELEKTRA_ADD_RESOURCE_WARNINGF (warningsKey, "no resolver set the system dirname, the configuration is: %s", ELEKTRA_VARIANT_SYSTEM); return -1; } @@ -501,7 +501,7 @@ static char * elektraGetCwd (Key * warningsKey) { // give up, we cannot handle the problem elektraFree (cwd); - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (warningsKey, "getcwd failed with errno %d \"%s\", defaulting to /", + ELEKTRA_ADD_RESOURCE_WARNINGF (warningsKey, "getcwd failed with errno %d \"%s\", defaulting to /", errno, strerror (errno)); return 0; } @@ -650,23 +650,23 @@ ElektraResolved * ELEKTRA_PLUGIN_FUNCTION (filename) (elektraNamespace namespace rc = elektraResolveMapperSystem (handle, tmpDir, warningsKey); break; case KEY_NS_PROC: - ELEKTRA_ADD_GENERAL_RESOURCE_WARNING (warningsKey, "tried to resolve proc"); + ELEKTRA_ADD_RESOURCE_WARNING (warningsKey, "tried to resolve proc"); rc = -1; break; case KEY_NS_EMPTY: - ELEKTRA_ADD_GENERAL_RESOURCE_WARNING (warningsKey, "tried to resolve empty"); + ELEKTRA_ADD_RESOURCE_WARNING (warningsKey, "tried to resolve empty"); rc = -1; break; case KEY_NS_NONE: - ELEKTRA_ADD_GENERAL_RESOURCE_WARNING (warningsKey, "tried to resolve none"); + ELEKTRA_ADD_RESOURCE_WARNING (warningsKey, "tried to resolve none"); rc = -1; break; case KEY_NS_META: - ELEKTRA_ADD_GENERAL_RESOURCE_WARNING (warningsKey, "tried to resolve meta"); + ELEKTRA_ADD_RESOURCE_WARNING (warningsKey, "tried to resolve meta"); rc = -1; break; case KEY_NS_CASCADING: - ELEKTRA_ADD_GENERAL_RESOURCE_WARNING (warningsKey, "tried to resolve cascading"); + ELEKTRA_ADD_RESOURCE_WARNING (warningsKey, "tried to resolve cascading"); rc = -1; break; } diff --git a/src/plugins/resolver/resolver.c b/src/plugins/resolver/resolver.c index 66c8e48069d..a6998872964 100644 --- a/src/plugins/resolver/resolver.c +++ b/src/plugins/resolver/resolver.c @@ -150,12 +150,12 @@ static int elektraLockFile (int fd ELEKTRA_UNUSED, Key * parentKey ELEKTRA_UNUSE { if (errno == EAGAIN || errno == EACCES) { - ELEKTRA_SET_GENERAL_RESOURCE_ERROR ( + ELEKTRA_SET_RESOURCE_ERROR ( parentKey, "conflict because other process writes to configuration indicated by file lock"); } else { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "assuming conflict because of failed file lock with message: %s", + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "assuming conflict because of failed file lock with message: %s", strerror (errno)); } return -1; @@ -188,7 +188,7 @@ static int elektraUnlockFile (int fd ELEKTRA_UNUSED, Key * parentKey ELEKTRA_UNU if (ret == -1) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, "fcntl SETLK unlocking failed with message: %s", strerror (errno)); + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "fcntl SETLK unlocking failed with message: %s", strerror (errno)); } return ret; @@ -240,7 +240,7 @@ static int elektraUnlockMutex (Key * parentKey ELEKTRA_UNUSED) int ret = pthread_mutex_unlock (&elektraResolverMutex); if (ret != 0) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, "mutex unlock failed with message: %s", strerror (errno)); + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "mutex unlock failed with message: %s", strerror (errno)); return -1; } return 0; @@ -260,7 +260,7 @@ static void elektraCloseFile (int fd, Key * parentKey) { if (close (fd) == -1) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, "close file failed with message: %s", strerror (errno)); + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "close file failed with message: %s", strerror (errno)); } } @@ -323,7 +323,7 @@ static int mapFilesForNamespaces (resolverHandles * p, Key * errorKey) { resolverClose (p); keyDel (testKey); - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (errorKey, "Could not resolve spec key"); + ELEKTRA_SET_RESOURCE_ERROR (errorKey, "Could not resolve spec key"); return -1; } else @@ -345,7 +345,7 @@ static int mapFilesForNamespaces (resolverHandles * p, Key * errorKey) { resolverClose (p); keyDel (testKey); - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (errorKey, "Could not resolve dir key"); + ELEKTRA_SET_RESOURCE_ERROR (errorKey, "Could not resolve dir key"); return -1; } else @@ -366,7 +366,7 @@ static int mapFilesForNamespaces (resolverHandles * p, Key * errorKey) { resolverClose (p); keyDel (testKey); - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (errorKey, "Could not resolve user key with conf %s", + ELEKTRA_SET_RESOURCE_ERRORF (errorKey, "Could not resolve user key with conf %s", ELEKTRA_VARIANT_USER); return -1; } @@ -388,7 +388,7 @@ static int mapFilesForNamespaces (resolverHandles * p, Key * errorKey) { resolverClose (p); keyDel (testKey); - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (errorKey, "Could not resolve system key with conf %s", + ELEKTRA_SET_RESOURCE_ERRORF (errorKey, "Could not resolve system key with conf %s", ELEKTRA_VARIANT_SYSTEM); return -1; } @@ -440,7 +440,7 @@ int ELEKTRA_PLUGIN_FUNCTION (open) (Plugin * handle, Key * errorKey) if (!path) { - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (errorKey, "Could not find file configuration"); + ELEKTRA_SET_RESOURCE_ERROR (errorKey, "Could not find file configuration"); return -1; } @@ -462,21 +462,21 @@ int ELEKTRA_PLUGIN_FUNCTION (open) (Plugin * handle, Key * errorKey) if ((mutexError = pthread_mutexattr_init (&mutexAttr)) != 0) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF ( + ELEKTRA_SET_RESOURCE_ERRORF ( errorKey, "Could not initialize recursive mutex: pthread_mutexattr_init returned %d", mutexError); pthread_mutex_unlock (&elektraResolverInitMutex); return -1; } if ((mutexError = pthread_mutexattr_settype (&mutexAttr, PTHREAD_MUTEX_RECURSIVE)) != 0) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF ( + ELEKTRA_SET_RESOURCE_ERRORF ( errorKey, "Could not initialize recursive mutex: pthread_mutexattr_settype returned %d", mutexError); pthread_mutex_unlock (&elektraResolverInitMutex); return -1; } if ((mutexError = pthread_mutex_init (&elektraResolverMutex, &mutexAttr)) != 0) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF ( + ELEKTRA_SET_RESOURCE_ERRORF ( errorKey, "Could not initialize recursive mutex: pthread_mutex_init returned %d", mutexError); pthread_mutex_unlock (&elektraResolverInitMutex); return -1; @@ -672,7 +672,7 @@ static int elektraOpenFile (resolverHandle * pk, Key * parentKey) } else if (pk->fd == -1) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Could not reopen configuration file \"%s\" for writing because \"%s\"", pk->filename, strerror (errno)); return -1; @@ -720,7 +720,7 @@ static int elektraCreateFile (resolverHandle * pk, Key * parentKey) if (pk->fd == -1) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Could not create configuration file \"%s\" because %s", pk->filename, + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Could not create configuration file \"%s\" because %s", pk->filename, strerror (errno)); return -1; } @@ -802,7 +802,7 @@ static int elektraMkdirParents (resolverHandle * pk, const char * pathname, Key elektraAddErrnoText (errorText); strcat (errorText, "\" "); elektraAddIdentity (errorText); - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (parentKey, errorText); + ELEKTRA_SET_RESOURCE_ERROR (parentKey, errorText); elektraFree (errorText); return -1; } @@ -839,10 +839,10 @@ static int elektraCheckConflict (resolverHandle * pk, Key * parentKey) elektraAddErrnoText (errorText); strcat (errorText, "\" "); elektraAddIdentity (errorText); - ELEKTRA_ADD_GENERAL_RESOURCE_WARNING (parentKey, errorText); + ELEKTRA_ADD_RESOURCE_WARNING (parentKey, errorText); elektraFree (errorText); - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (parentKey, "assuming conflict because of failed stat (warning 29 for details)"); + ELEKTRA_SET_RESOURCE_ERROR (parentKey, "assuming conflict because of failed stat (warning 29 for details)"); return -1; } @@ -973,7 +973,7 @@ static void elektraUpdateFileTime (resolverHandle * pk, int fd, Key * parentKey) if (futimens (fd, times) == -1) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, "Could not update time stamp of \"%s\", because %s", + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "Could not update time stamp of \"%s\", because %s", fd == pk->fd ? pk->filename : pk->tempfile, strerror (errno)); } #elif defined(HAVE_FUTIMES) @@ -982,7 +982,7 @@ static void elektraUpdateFileTime (resolverHandle * pk, int fd, Key * parentKey) if (futimes (fd, times) == -1) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, "Could not update time stamp of \"%s\", because %s", + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "Could not update time stamp of \"%s\", because %s", fd == pk->fd ? pk->filename : pk->tempfile, strerror (errno)); } #else @@ -1008,7 +1008,7 @@ static int elektraSetCommit (resolverHandle * pk, Key * parentKey) int fd = open (pk->tempfile, O_RDWR); if (fd == -1) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Could not open file again for changing metadata of file \"%s\", because %s", pk->tempfile, strerror (errno)); ret = -1; @@ -1018,7 +1018,7 @@ static int elektraSetCommit (resolverHandle * pk, Key * parentKey) if (rename (pk->tempfile, pk->filename) == -1) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Could not rename file: %s", strerror (errno)); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Could not rename file: %s", strerror (errno)); ret = -1; } @@ -1027,7 +1027,7 @@ static int elektraSetCommit (resolverHandle * pk, Key * parentKey) struct stat buf; if (fstat (fd, &buf) == -1) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, "Failed to stat file: %s\n", strerror (errno)); + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "Failed to stat file: %s\n", strerror (errno)); } else { @@ -1062,7 +1062,7 @@ static int elektraSetCommit (resolverHandle * pk, Key * parentKey) // change mode to what it was before if (fchmod (fd, pk->filemode) == -1) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "Could not fchmod temporary file \"%s\" from %o to %o, because %s", pk->tempfile, buf.st_mode, pk->filemode, strerror (errno)); } @@ -1072,7 +1072,7 @@ static int elektraSetCommit (resolverHandle * pk, Key * parentKey) { if (fchown (fd, pk->uid, pk->gid) == -1) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "Could not fchown temporary file \"%s\" from %d.%d to %d.%d, because %s", pk->tempfile, buf.st_uid, buf.st_gid, pk->uid, pk->gid, strerror (errno)); } @@ -1085,7 +1085,7 @@ static int elektraSetCommit (resolverHandle * pk, Key * parentKey) // checking dirp not needed, fsync will have EBADF if (fsync (dirfd (dirp)) == -1) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, "Could not sync directory \"%s\", because %s", pk->dirname, + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "Could not sync directory \"%s\", because %s", pk->dirname, strerror (errno)); } closedir (dirp); @@ -1122,7 +1122,7 @@ int ELEKTRA_PLUGIN_FUNCTION (set) (Plugin * handle, KeySet * ks, Key * parentKey ELEKTRA_LOG ("check if removal of the configuration file \"%s\" would work later", pk->filename); if (access (pk->dirname, W_OK | X_OK) == -1) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Could not remove file: %s", strerror (errno)); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Could not remove file: %s", strerror (errno)); ret = -1; } @@ -1143,7 +1143,7 @@ int ELEKTRA_PLUGIN_FUNCTION (set) (Plugin * handle, KeySet * ks, Key * parentKey ELEKTRA_LOG ("unlink configuration file \"%s\"", pk->filename); if (unlink (pk->filename) == -1) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Could not remove file: %s", strerror (errno)); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Could not remove file: %s", strerror (errno)); ret = -1; } @@ -1178,7 +1178,7 @@ static void elektraUnlinkFile (char * filename, Key * parentKey) int errnoSave = errno; if (unlink (filename) == -1) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, "could not unlink the file \"%s\" because of \"%s\"", filename, + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "could not unlink the file \"%s\" because of \"%s\"", filename, strerror (errno)); errno = errnoSave; } diff --git a/src/plugins/ruby/ruby.cpp b/src/plugins/ruby/ruby.cpp index 99ad635594d..31ed0714772 100644 --- a/src/plugins/ruby/ruby.cpp +++ b/src/plugins/ruby/ruby.cpp @@ -133,7 +133,7 @@ static VALUE clear_ruby_exception_add_warning (ckdb::Key * warningsKey) VALUE exception = clear_ruby_exception (); VALUE msg = get_exception_string (exception); - ELEKTRA_ADD_BROKEN_PLUGIN_WARNING (warningsKey, StringValueCStr (msg)); + ELEKTRA_ADD_PLUGIN_MISBHV_WARNING (warningsKey, StringValueCStr (msg)); return exception; } @@ -431,7 +431,7 @@ int RUBY_PLUGIN_FUNCTION (CheckConf) (ckdb::Key * errorKey, ckdb::KeySet * conf) if (global_plugin_instance == Qnil) { - ELEKTRA_SET_BROKEN_PLUGIN_ERROR (errorKey, "invalid Ruby plugin. Plugin did not call Kdb::Plugin.define"); + ELEKTRA_SET_PLUGIN_MISBHV_ERROR (errorKey, "invalid Ruby plugin. Plugin did not call Kdb::Plugin.define"); global_context_mutex.unlock (); return -1; @@ -512,7 +512,7 @@ int RUBY_PLUGIN_FUNCTION (Open) (ckdb::Plugin * handle, ckdb::Key * warningsKey) /* error, the Ruby-plugin did not call Kdb::Plugin.define * so we do not have a Plugin instance */ - ELEKTRA_ADD_BROKEN_PLUGIN_WARNING (warningsKey, "Error in Ruby-plugin, didn't call Kdb::Plugin.define"); + ELEKTRA_ADD_PLUGIN_MISBHV_WARNING (warningsKey, "Error in Ruby-plugin, didn't call Kdb::Plugin.define"); return 0; } @@ -652,7 +652,7 @@ int RUBY_PLUGIN_FUNCTION (Get) (ckdb::Plugin * handle, ckdb::KeySet * returned, else { /* if not 'get' method is available, this plugin is useless, therefore set and error */ - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (parentKey, "plugin does not have a 'get' method"); + ELEKTRA_SET_RESOURCE_ERROR (parentKey, "plugin does not have a 'get' method"); return -1; } return -1; diff --git a/src/plugins/shell/shell.c b/src/plugins/shell/shell.c index 4612a2c2610..f809f9f365d 100644 --- a/src/plugins/shell/shell.c +++ b/src/plugins/shell/shell.c @@ -71,14 +71,14 @@ int elektraShellGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * pa if (retVal == -1) { // TODO: Correct?? - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "launching childprocess failed with %s\n", strerror (errno)); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "launching childprocess failed with %s\n", strerror (errno)); return -1; } else if (expectedReturnKey) { if (atoi (keyString (expectedReturnKey)) != retVal) { - ELEKTRA_SET_BROKEN_PLUGIN_ERRORF (parentKey, "return value of %s doesn't match expected exit %s\n", + ELEKTRA_SET_PLUGIN_MISBHV_ERRORF (parentKey, "return value of %s doesn't match expected exit %s\n", keyString (cmdKey), keyString (expectedReturnKey)); return -1; } @@ -100,7 +100,7 @@ int elektraShellSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA_U if (retVal == -1) { // TODO: Correct?? - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "launching childprocess failed with %s\n", strerror (errno)); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "launching childprocess failed with %s\n", strerror (errno)); return -1; } else if (expectedReturnKey) @@ -108,7 +108,7 @@ int elektraShellSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA_U if (atoi (keyString (expectedReturnKey)) != retVal) { // TODO: Correct? - ELEKTRA_SET_BROKEN_PLUGIN_ERRORF (parentKey, "return value of %s doesn't match expected exit %s\n", + ELEKTRA_SET_PLUGIN_MISBHV_ERRORF (parentKey, "return value of %s doesn't match expected exit %s\n", keyString (cmdKey), keyString (expectedReturnKey)); return -1; } @@ -130,7 +130,7 @@ int elektraShellError (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA if (retVal == -1) { // TODO: Correct?? - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "launching childprocess failed with %s\n", strerror (errno)); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "launching childprocess failed with %s\n", strerror (errno)); return -1; } else if (expectedReturnKey) @@ -138,7 +138,7 @@ int elektraShellError (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA if (atoi (keyString (expectedReturnKey)) != retVal) { // TODO: Correct?? - ELEKTRA_SET_BROKEN_PLUGIN_ERRORF (parentKey, "return value of %s doesn't match expected exit %s\n", + ELEKTRA_SET_PLUGIN_MISBHV_ERRORF (parentKey, "return value of %s doesn't match expected exit %s\n", keyString (cmdKey), keyString (expectedReturnKey)); return -1; } diff --git a/src/plugins/simpleini/simpleini.c b/src/plugins/simpleini/simpleini.c index 20fdb80ce11..f1ec68930b6 100644 --- a/src/plugins/simpleini/simpleini.c +++ b/src/plugins/simpleini/simpleini.c @@ -281,7 +281,7 @@ int elektraSimpleiniGet (Plugin * handle, KeySet * returned, Key * parentKey) if (getline (&key, &size, fp) == -1 && !feof (fp)) { // TODO: Correct? - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF ( + ELEKTRA_SET_RESOURCE_ERRORF ( parentKey, "failed discarding rest of line at position %ld with key %s", ftell (fp), key); elektraFree (key); fclose (fp); diff --git a/src/plugins/specload/specload.c b/src/plugins/specload/specload.c index 639f19c54f2..f260374461e 100644 --- a/src/plugins/specload/specload.c +++ b/src/plugins/specload/specload.c @@ -201,7 +201,7 @@ int elektraSpecloadGet (Plugin * handle, KeySet * returned, Key * parentKey) if (elektraInvoke2Args (specload->quickDump, "get", spec, parentKey) == ELEKTRA_PLUGIN_STATUS_ERROR) { ksDel (spec); - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (parentKey, "Couldn't load the overlay specification."); + ELEKTRA_SET_RESOURCE_ERROR (parentKey, "Couldn't load the overlay specification."); return ELEKTRA_PLUGIN_STATUS_ERROR; } } @@ -211,7 +211,7 @@ int elektraSpecloadGet (Plugin * handle, KeySet * returned, Key * parentKey) if (elektraInvoke2Args (specload->quickDump, "set", ks, parentKey) == ELEKTRA_PLUGIN_STATUS_ERROR) { ksDel (ks); - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (parentKey, "Couldn't create an empty overlay specification."); + ELEKTRA_SET_RESOURCE_ERROR (parentKey, "Couldn't create an empty overlay specification."); return ELEKTRA_PLUGIN_STATUS_ERROR; } ksDel (ks); @@ -281,7 +281,7 @@ int elektraSpecloadSet (Plugin * handle, KeySet * returned, Key * parentKey) if (changeAllowed < 0) { - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (parentKey, "This kind of change is not allowed."); + ELEKTRA_SET_RESOURCE_ERROR (parentKey, "This kind of change is not allowed."); ksSetCursor (returned, cursor); ksDel (overrides); ksDel (oldData); @@ -369,7 +369,7 @@ bool getAppAndArgs (KeySet * conf, char ** appPtr, char *** argvPtr, Key * error if (access (app, X_OK) != 0) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (errorKey, "'%s' doesn't exist or is not executable.", app); + ELEKTRA_SET_RESOURCE_ERRORF (errorKey, "'%s' doesn't exist or is not executable.", app); return false; } diff --git a/src/plugins/sync/sync.c b/src/plugins/sync/sync.c index dd2396d39d0..dff1cbeb1c8 100644 --- a/src/plugins/sync/sync.c +++ b/src/plugins/sync/sync.c @@ -52,13 +52,13 @@ int elektraSyncSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA_UN int fd = open (configFile, O_RDWR); if (fd == -1) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Could not open config file %s because \"%s\"", configFile, + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Could not open config file %s because \"%s\"", configFile, strerror (errno)); return -1; } if (fsync (fd) == -1) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Could not fsync config file %s because \"%s\"", configFile, + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Could not fsync config file %s because \"%s\"", configFile, strerror (errno)); close (fd); return -1; diff --git a/src/plugins/type/README.md b/src/plugins/type/README.md index 239f0233aa7..9c749b7b425 100644 --- a/src/plugins/type/README.md +++ b/src/plugins/type/README.md @@ -193,7 +193,7 @@ kdb get user/tests/type/key #If we try to store a string Elektra will not change the value kdb set user/tests/type/key 'Not a char' # RET:5 -# ERROR:C04200 +# ERROR:C03200 kdb get user/tests/type/key #> b @@ -223,7 +223,7 @@ kdb set user/tests/type/value low # should fail with error 52 kdb set user/tests/type/value no # RET:5 -# ERROR:C04200 +# ERROR:C03200 ``` Or with multi-enums: @@ -245,7 +245,7 @@ kdb set user/tests/type/multivalue small_middle # should fail with error 52 kdb set user/tests/type/multivalue all_small # RET:5 -# ERROR:C04200 +# ERROR:C03200 # cleanup kdb rm -r user/tests/type diff --git a/src/plugins/typechecker/Elektra/Typechecker.hs.in b/src/plugins/typechecker/Elektra/Typechecker.hs.in index 8884e834893..8258d6af1dd 100644 --- a/src/plugins/typechecker/Elektra/Typechecker.hs.in +++ b/src/plugins/typechecker/Elektra/Typechecker.hs.in @@ -93,8 +93,8 @@ typecheck p ks k c = withGlobalLogging (LogConfig Nothing ("@ENABLE_LOGGER@" == Left err -> do let errStr = errorString specFile err case c of - Set -> triggerError "C04200" k errStr - Get -> triggerWarnings "C04200" k errStr + Set -> triggerError "C03200" k errStr + Get -> triggerWarnings "C03200" k errStr logDebugT errStr return True Right () -> return False diff --git a/src/plugins/wresolver/wresolver.c b/src/plugins/wresolver/wresolver.c index 767f6441ebd..2dfa444e156 100644 --- a/src/plugins/wresolver/wresolver.c +++ b/src/plugins/wresolver/wresolver.c @@ -163,12 +163,12 @@ static void elektraResolveDir (resolverHandle * p, Key * warningsKey) char buf[256]; FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError (), MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), buf, 256, NULL); - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (warningsKey, "GetCurrentDirectory failed: %s, defaulting to /", buf); + ELEKTRA_ADD_RESOURCE_WARNINGF (warningsKey, "GetCurrentDirectory failed: %s, defaulting to /", buf); dir[0] = 0; } else if (dwRet > MAX_PATH) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (warningsKey, "GetCurrentDirectory failed, buffer size too small, needed: %ld", + ELEKTRA_ADD_RESOURCE_WARNINGF (warningsKey, "GetCurrentDirectory failed, buffer size too small, needed: %ld", dwRet); dir[0] = 0; } @@ -177,7 +177,7 @@ static void elektraResolveDir (resolverHandle * p, Key * warningsKey) char dir[KDB_MAX_PATH_LENGTH]; if (getcwd (dir, KDB_MAX_PATH_LENGTH) == 0) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (warningsKey, "getcwd failed: %s, defaulting to /", strerror (errno)); + ELEKTRA_ADD_RESOURCE_WARNINGF (warningsKey, "getcwd failed: %s, defaulting to /", strerror (errno)); dir[0] = 0; } #endif @@ -258,7 +258,7 @@ int elektraWresolverOpen (Plugin * handle, Key * errorKey) if (!path) { - ELEKTRA_SET_GENERAL_RESOURCE_ERROR (errorKey, "Could not find file configuration"); + ELEKTRA_SET_RESOURCE_ERROR (errorKey, "Could not find file configuration"); return -1; } @@ -410,7 +410,7 @@ int elektraWresolverSet (Plugin * handle, KeySet * returned ELEKTRA_UNUSED, Key if (stat (pk->filename, &buf) == -1) { - ELEKTRA_ADD_GENERAL_RESOURCE_WARNINGF (parentKey, "could not stat config file \"%s\", ", pk->filename); + ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "could not stat config file \"%s\", ", pk->filename); // no file found, nothing to do return 0; } diff --git a/src/plugins/yajl/yajl_parse.c b/src/plugins/yajl/yajl_parse.c index 7e5ad09427c..add308dceac 100644 --- a/src/plugins/yajl/yajl_parse.c +++ b/src/plugins/yajl/yajl_parse.c @@ -395,7 +395,7 @@ int elektraYajlGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * par { if (!feof (fileHandle)) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parentKey, "Error while reading file: %s", keyString (parentKey)); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Error while reading file: %s", keyString (parentKey)); fclose (fileHandle); yajl_free (hand); return -1; diff --git a/src/plugins/yambi/convert.cpp b/src/plugins/yambi/convert.cpp index 3af66665166..56b58a07546 100644 --- a/src/plugins/yambi/convert.cpp +++ b/src/plugins/yambi/convert.cpp @@ -46,7 +46,7 @@ int addToKeySet (CppKeySet & keySet, CppKey & parent, string const & filename) { if (status == -3) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parent.getKey (), "Unable to open file ā€œ%sā€", filename.c_str ()); + ELEKTRA_SET_RESOURCE_ERRORF (parent.getKey (), "Unable to open file ā€œ%sā€", filename.c_str ()); } else if (status == -2) { diff --git a/src/plugins/yambi/yambi.cpp b/src/plugins/yambi/yambi.cpp index fb164ec4ab7..e795ae992cf 100644 --- a/src/plugins/yambi/yambi.cpp +++ b/src/plugins/yambi/yambi.cpp @@ -74,7 +74,7 @@ int elektraYambiGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * pa } catch (exception const & error) { - ELEKTRA_SET_BROKEN_PLUGIN_ERRORF (*parent, "Uncaught exception: %s", error.what ()); + ELEKTRA_SET_PLUGIN_MISBHV_ERRORF (*parent, "Uncaught exception: %s", error.what ()); } parent.release (); diff --git a/src/plugins/yamlcpp/README.md b/src/plugins/yamlcpp/README.md index 4f5f0bae3ef..cb1bdb6671c 100644 --- a/src/plugins/yamlcpp/README.md +++ b/src/plugins/yamlcpp/README.md @@ -45,7 +45,7 @@ kdb get /tests/yamlcpp/šŸ”‘ echo "some key: @some value" >> `kdb file /tests/yamlcpp` kdb get "/tests/yamlcpp/some key" # STDERR: .*yaml-cpp: error at line 2, column 11: unknown token.* -# ERROR: C04100 +# ERROR: C03100 # RET: 5 # Overwrite incorrect data @@ -246,7 +246,7 @@ kdb setmeta user/tests/yamlcpp/typetest/number check/type short kdb set user/tests/yamlcpp/typetest/number "One" # RET: 5 # STDERR: .*Validation Semantic.* -# ERROR: C04200 +# ERROR: C03200 kdb get user/tests/yamlcpp/typetest/number #> 21 diff --git a/src/plugins/yamlcpp/yamlcpp.cpp b/src/plugins/yamlcpp/yamlcpp.cpp index 7440de79fba..804ca26b591 100644 --- a/src/plugins/yamlcpp/yamlcpp.cpp +++ b/src/plugins/yamlcpp/yamlcpp.cpp @@ -80,12 +80,12 @@ int elektraYamlcppGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * } catch (std::overflow_error const & exception) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parent.getKey (), "Unable to read data from file ā€œ%sā€: %s.", + ELEKTRA_SET_RESOURCE_ERRORF (parent.getKey (), "Unable to read data from file ā€œ%sā€: %s.", parent.getString ().c_str (), exception.what ()); } catch (YAML::RepresentationException const & exception) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parent.getKey (), "Unable to read data from file ā€œ%sā€: %s", + ELEKTRA_SET_RESOURCE_ERRORF (parent.getKey (), "Unable to read data from file ā€œ%sā€: %s", parent.getString ().c_str (), exception.what ()); } @@ -115,7 +115,7 @@ int elektraYamlcppSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * } catch (YAML::BadFile const & exception) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parent.getKey (), "Unable to write to file ā€œ%sā€: %s.", parent.getString ().c_str (), + ELEKTRA_SET_RESOURCE_ERRORF (parent.getKey (), "Unable to write to file ā€œ%sā€: %s.", parent.getString ().c_str (), exception.what ()); } catch (YAML::EmitterException const & exception) diff --git a/src/plugins/yamlsmith/yamlsmith.cpp b/src/plugins/yamlsmith/yamlsmith.cpp index 24eb7fc815e..fad37330064 100644 --- a/src/plugins/yamlsmith/yamlsmith.cpp +++ b/src/plugins/yamlsmith/yamlsmith.cpp @@ -264,7 +264,7 @@ int elektraYamlsmithSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key } else { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parent.getKey (), "Unable to open file ā€œ%sā€", parent.getString ().c_str ()); + ELEKTRA_SET_RESOURCE_ERRORF (parent.getKey (), "Unable to open file ā€œ%sā€", parent.getString ().c_str ()); } parent.release (); diff --git a/src/plugins/yanlr/yanlr.cpp b/src/plugins/yanlr/yanlr.cpp index 574b9d69398..4167f16822d 100644 --- a/src/plugins/yanlr/yanlr.cpp +++ b/src/plugins/yanlr/yanlr.cpp @@ -127,7 +127,7 @@ int elektraYanlrGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * pa ifstream file (parent.getString ()); if (!file.is_open ()) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (parent.getKey (), "Unable to open file ā€œ%sā€", parent.getString ().c_str ()); + ELEKTRA_SET_RESOURCE_ERRORF (parent.getKey (), "Unable to open file ā€œ%sā€", parent.getString ().c_str ()); return ELEKTRA_PLUGIN_STATUS_ERROR; } diff --git a/src/plugins/yawn/convert.cpp b/src/plugins/yawn/convert.cpp index ac82cdbf8e5..6e6568e5f79 100644 --- a/src/plugins/yawn/convert.cpp +++ b/src/plugins/yawn/convert.cpp @@ -120,7 +120,7 @@ ifstream openFile (string const & filename, CppKey & error) ifstream input{ filename }; if (!input.good ()) { - ELEKTRA_SET_GENERAL_RESOURCE_ERRORF (error.getKey (), "Unable to open file ā€œ%sā€", filename.c_str ()); + ELEKTRA_SET_RESOURCE_ERRORF (error.getKey (), "Unable to open file ā€œ%sā€", filename.c_str ()); } return input; } diff --git a/src/plugins/yawn/yawn.cpp b/src/plugins/yawn/yawn.cpp index 392335d1f03..2710c832bed 100644 --- a/src/plugins/yawn/yawn.cpp +++ b/src/plugins/yawn/yawn.cpp @@ -80,7 +80,7 @@ int elektraYawnGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * par } catch (exception const & error) { - ELEKTRA_SET_BROKEN_PLUGIN_ERRORF (*parent, "Uncaught exception: %s", error.what ()); + ELEKTRA_SET_PLUGIN_MISBHV_ERRORF (*parent, "Uncaught exception: %s", error.what ()); } parent.release (); diff --git a/src/plugins/yaypeg/yaypeg.cpp b/src/plugins/yaypeg/yaypeg.cpp index dfab5cb7e6d..abbce1126b6 100644 --- a/src/plugins/yaypeg/yaypeg.cpp +++ b/src/plugins/yaypeg/yaypeg.cpp @@ -73,7 +73,7 @@ int elektraYaypegGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * p } catch (exception const & error) { - ELEKTRA_SET_BROKEN_PLUGIN_ERRORF (*parent, "Uncaught exception: %s", error.what ()); + ELEKTRA_SET_PLUGIN_MISBHV_ERRORF (*parent, "Uncaught exception: %s", error.what ()); } parent.release (); diff --git a/tests/kdb/testkdb_error.cpp b/tests/kdb/testkdb_error.cpp index 0e3379ef250..29148430ad6 100644 --- a/tests/kdb/testkdb_error.cpp +++ b/tests/kdb/testkdb_error.cpp @@ -114,8 +114,8 @@ TEST_F (Error, AgainRepeat) EXPECT_TRUE (parentKey.getMeta ("error/number")); EXPECT_EQ (parentKey.getMeta ("error/number"), "C01410"); - std::list errorCodes{ "C01110", "C01120", "C01300", "C01410", "C01420", "C01430", - "C02000", "C03000", "C04100", "C04200", "C05000" }; + std::list errorCodes{ "C01110", "C01100", "C01300", "C01410", "C01420", "C01430", + "C02000", "C03100", "C03200" }; for (auto code = errorCodes.begin (); code != errorCodes.end (); ++code) { diff --git a/tests/shell/check_error.sh b/tests/shell/check_error.sh index 601244103e5..170580eab17 100755 --- a/tests/shell/check_error.sh +++ b/tests/shell/check_error.sh @@ -24,7 +24,7 @@ succeed_if "could not mount root: $ROOT_FILE at $ROOT_MOUNTPOINT" "$KDB" set $ROOT/valueable_data important_unrecoverable_data > /dev/null succeed_if "cannot set valuable data" -"$KDB" setmeta $ROOT/valueable_data trigger/error "C04100" +"$KDB" setmeta $ROOT/valueable_data trigger/error "C03100" succeed_if "cannot set metadata" TMPFILE="$(mktempfile_elektra)" @@ -51,7 +51,7 @@ if is_plugin_available error; then CONTENT=$(cat $TMPFILE) - grep "issued the error C04100" $TMPFILE > /dev/null + grep "issued the error C03100" $TMPFILE > /dev/null succeed_if "Triggered error did not occur, got $CONTENT" grep "from error plugin" $TMPFILE > /dev/null @@ -67,7 +67,7 @@ if is_plugin_available error; then [ $? -ne 0 ] succeed_if "Was able to copy to error plugin" - grep "issued the error C04100" $TMPFILE > /dev/null + grep "issued the error C03100" $TMPFILE > /dev/null succeed_if "Triggered error did not occur, got $CONTENT" grep "from error plugin" $TMPFILE > /dev/null @@ -91,7 +91,7 @@ if is_plugin_available error; then # #CONTENT=`cat $TMPFILE` # - #grep "[eE]rror (#C04100) occurred!" $TMPFILE > /dev/null + #grep "[eE]rror (#C03100) occurred!" $TMPFILE > /dev/null #succeed_if "Error not found in output, got $CONTENT" # #$KDB get $ERROR_MOUNTPOINT > /dev/null 2>&1