From 7f3c92cb62562c177d54cb45cecf28c03489ddd2 Mon Sep 17 00:00:00 2001 From: Michael Zronek Date: Sat, 13 Apr 2019 13:25:41 +0200 Subject: [PATCH] error: added unsure cateogisation Todos --- src/bindings/cpp/include/kdbplugin.hpp | 1 + src/libs/elektra/backend.c | 1 + src/libs/elektra/kdb.c | 7 +++++++ src/libs/elektra/plugin.c | 1 + src/libs/elektra/split.c | 1 + src/libs/loader/dl.c | 5 ++++- src/libs/pluginprocess/pluginprocess.c | 2 ++ src/plugins/augeas/augeas.c | 1 + src/plugins/cpptemplate/cpptemplate.cpp | 1 + src/plugins/crypto/botan_operations.cpp | 6 +++++- src/plugins/crypto/crypto.c | 2 ++ src/plugins/crypto/gcrypt_operations.c | 6 +++++- src/plugins/crypto/gpg.c | 6 +++++- src/plugins/crypto/helper.c | 7 ++++++- src/plugins/crypto/openssl_operations.c | 8 ++++++++ src/plugins/curlget/curlget.c | 3 ++- src/plugins/date/date.c | 12 ++++++------ src/plugins/directoryvalue/directoryvalue.cpp | 4 ++++ src/plugins/fcrypt/fcrypt.c | 1 + src/plugins/gitresolver/gitresolver.c | 3 +++ src/plugins/gpgme/gpgme.c | 2 ++ src/plugins/hexnumber/hexnumber.c | 6 +++++- src/plugins/iconv/iconv.c | 4 ++++ src/plugins/jni/jni.c | 9 ++++++--- src/plugins/keytometa/keytometa.c | 2 +- src/plugins/line/line.c | 1 + src/plugins/lua/lua.cpp | 1 + src/plugins/network/network.c | 6 +++--- src/plugins/passwd/passwd.c | 1 + src/plugins/process/process.c | 4 +++- src/plugins/python/python.cpp | 1 + src/plugins/quickdump/quickdump.c | 3 +++ src/plugins/quickdump/readv1.c | 2 ++ src/plugins/reference/reference.c | 2 +- src/plugins/resolver/filename.c | 8 ++++++-- src/plugins/resolver/resolver.c | 6 ++++-- src/plugins/ruby/ruby.cpp | 2 ++ src/plugins/shell/shell.c | 6 ++++++ src/plugins/specload/specload.c | 6 +++--- src/plugins/struct/struct.cpp | 1 + src/plugins/validation/validation.c | 1 + src/plugins/wresolver/wresolver.c | 1 + src/plugins/yambi/yambi.cpp | 1 + src/plugins/yawn/yawn.cpp | 1 + src/plugins/yaypeg/yaypeg.cpp | 1 + src/plugins/zeromqsend/zeromqsend.c | 1 + 46 files changed, 128 insertions(+), 29 deletions(-) diff --git a/src/bindings/cpp/include/kdbplugin.hpp b/src/bindings/cpp/include/kdbplugin.hpp index 49e0e18db69..36747214dd5 100644 --- a/src/bindings/cpp/include/kdbplugin.hpp +++ b/src/bindings/cpp/include/kdbplugin.hpp @@ -76,6 +76,7 @@ class Delegator catch (const char * msg) { #ifdef KDBERRORS_H + // TODO: Correct? ELEKTRA_ADD_INSTALLATION_WARNINGF (errorKey, "Could not create C++ plugin: %s", msg); #endif return -1; diff --git a/src/libs/elektra/backend.c b/src/libs/elektra/backend.c index b23b85d23b4..d203512237e 100644 --- a/src/libs/elektra/backend.c +++ b/src/libs/elektra/backend.c @@ -232,6 +232,7 @@ Backend * backendOpen (KeySet * elektraConfig, KeySet * modules, KeySet * global { // no one cares about that config if (!failure) + // TODO: Correct? ELEKTRA_ADD_INSTALLATION_WARNINGF (errorKey, "Unrecognised Config Tree: %s", keyBaseName (cur)); ksDel (cut); } diff --git a/src/libs/elektra/kdb.c b/src/libs/elektra/kdb.c index 6ecdc783e74..477b496a794 100644 --- a/src/libs/elektra/kdb.c +++ b/src/libs/elektra/kdb.c @@ -972,6 +972,7 @@ int kdbGet (KDB * handle, KeySet * ks, Key * parentKey) if (splitBuildup (split, handle, parentKey) == -1) { clearError (parentKey); + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERROR (parentKey, "error in splitBuildup"); goto error; } @@ -1075,6 +1076,7 @@ int kdbGet (KDB * handle, KeySet * ks, Key * parentKey) if (splitGet (split, parentKey, handle) == -1) { + // TODO: Correct? ELEKTRA_ADD_INSTALLATION_WARNINGF (parentKey, "Wrong keys in postprocessing: %s", keyName (ksCurrent (ks))); // continue, because sizes are already updated } @@ -1110,6 +1112,7 @@ int kdbGet (KDB * handle, KeySet * ks, Key * parentKey) /* Now post-process the updated keysets */ if (splitGet (split, parentKey, handle) == -1) { + // TODO: Correct? ELEKTRA_ADD_INSTALLATION_WARNINGF (parentKey, "Wrong keys in postprocessing: %s", keyName (ksCurrent (ks))); // continue, because sizes are already updated } @@ -1426,6 +1429,7 @@ int kdbSet (KDB * handle, KeySet * ks, Key * parentKey) if (ns == KEY_NS_META) { clearError (parentKey); // clear previous error to set new one + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (parentKey, "metakey with name \"%s\" passed to kdbSet", keyName (parentKey)); keyDel (oldError); ELEKTRA_LOG ("ns == KEY_NS_META"); @@ -1497,6 +1501,7 @@ int kdbSet (KDB * handle, KeySet * ks, Key * parentKey) } else if (syncstate < -1) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (parentKey, "Sync state is wrong, maybe kdbSet() is executed without prior kdbGet() on %s", keyName (split->parents[-syncstate - 2])); @@ -1945,6 +1950,7 @@ int kdbEnsure (KDB * handle, KeySet * contract, Key * parentKey) if (elektraStrCmp (pluginName, "list") == 0) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERROR (parentKey, "Cannot specify clauses for the list plugin!!"); keyDel (cutpoint); ksDel (pluginsContract); @@ -1966,6 +1972,7 @@ int kdbEnsure (KDB * handle, KeySet * contract, Key * parentKey) } else { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF ( parentKey, "The key '%s' contained the value '%s', but only 'unmounted', 'mounted' or 'remounted' may be used.", diff --git a/src/libs/elektra/plugin.c b/src/libs/elektra/plugin.c index 4db93fd9839..20488ba2591 100644 --- a/src/libs/elektra/plugin.c +++ b/src/libs/elektra/plugin.c @@ -227,6 +227,7 @@ int elektraProcessPlugins (Plugin ** plugins, KeySet * modules, KeySet * referen } else { + // TODO: Correct? ELEKTRA_ADD_INSTALLATION_WARNINGF (errorKey, "Unknown additional entries in plugin: %s", keyString (cur)); } } diff --git a/src/libs/elektra/split.c b/src/libs/elektra/split.c index ca6f663c93e..d92ac607a27 100644 --- a/src/libs/elektra/split.c +++ b/src/libs/elektra/split.c @@ -501,6 +501,7 @@ static void elektraDropCurrentKey (KeySet * ks, Key * warningKey, const Backend } strcat (warningMsg, "\" because "); strcat (warningMsg, msg); + // TODO: Correct? ELEKTRA_ADD_INSTALLATION_WARNINGF (warningKey, "Postcondition of backend was violated: %s", warningMsg); elektraFree (warningMsg); cursor_t c = ksGetCursor (ks); diff --git a/src/libs/loader/dl.c b/src/libs/loader/dl.c index d0983a1a893..0f95d4a6eaa 100644 --- a/src/libs/loader/dl.c +++ b/src/libs/loader/dl.c @@ -95,6 +95,7 @@ elektraPluginFactory elektraModulesLoad (KeySet * modules, const char * name, Ke module.symbol.v = dlsym (module.handle, "elektraPluginSymbol"); if (module.symbol.v == NULL) { + // TODO: Correct? ELEKTRA_ADD_INSTALLATION_WARNINGF (errorKey, "could not get pointer to factory, dlsym failed. Module: %s, because: %s", moduleName, dlerror ()); dlclose (module.handle); @@ -119,7 +120,8 @@ int elektraModulesClose (KeySet * modules, Key * errorKey) if (!root) { - ELEKTRA_ADD_RESOURCE_WARNING (errorKey, "no key system/elektra/modules"); + // TODO: Correct? + ELEKTRA_ADD_INSTALLATION_WARNING (errorKey, "no key system/elektra/modules"); return -1; } @@ -135,6 +137,7 @@ int elektraModulesClose (KeySet * modules, Key * errorKey) ksAppendKey (newModules, root); } ret = -1; + // TODO: Correct? 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 e594d82e300..1b1240a8cdd 100644 --- a/src/libs/pluginprocess/pluginprocess.c +++ b/src/libs/pluginprocess/pluginprocess.c @@ -199,6 +199,7 @@ void elektraPluginProcessStart (Plugin * handle, ElektraPluginProcess * pp) else { ELEKTRA_LOG_DEBUG ("Child: Unrecognized command %s", keyString (commandKey)); + // TODO: Correct? ELEKTRA_SET_LOGICAL_ERRORF (key, "Received invalid command code or no KeySet: %s", keyString (commandKey)); } errno = prevErrno; @@ -329,6 +330,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) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (key, "Received invalid return code or no KeySet: %s", keyString (resultKey)); lresult = ELEKTRA_PLUGIN_STATUS_ERROR; } diff --git a/src/plugins/augeas/augeas.c b/src/plugins/augeas/augeas.c index 8dc7c49cfa2..244ed1c30b4 100644 --- a/src/plugins/augeas/augeas.c +++ b/src/plugins/augeas/augeas.c @@ -105,6 +105,7 @@ int elektraAugeasGenConf (KeySet * ks, Key * errorKey ELEKTRA_UNUSED) } else { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (errorKey, "Could not glob %s", f); retval = -1; } diff --git a/src/plugins/cpptemplate/cpptemplate.cpp b/src/plugins/cpptemplate/cpptemplate.cpp index 40cfa75520d..a736f6fc2b9 100644 --- a/src/plugins/cpptemplate/cpptemplate.cpp +++ b/src/plugins/cpptemplate/cpptemplate.cpp @@ -63,6 +63,7 @@ int elektraCppTemplateOpen (Plugin * handle, Key * key) } catch (exception const & error) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (key, "Uncaught Exception: %s", error.what ()); } diff --git a/src/plugins/crypto/botan_operations.cpp b/src/plugins/crypto/botan_operations.cpp index e2f4d996a1e..38f8b4ef991 100644 --- a/src/plugins/crypto/botan_operations.cpp +++ b/src/plugins/crypto/botan_operations.cpp @@ -89,6 +89,7 @@ static int getKeyIvForEncryption (KeySet * config, Key * errorKey, Key * masterK } catch (std::exception const & e) { + // TODO: Correct? ELEKTRA_SET_LOGICAL_ERRORF (errorKey, "Failed to create a cryptographic key for encryption because: %s", e.what ()); return -1; } @@ -139,6 +140,7 @@ static int getKeyIvForDecryption (KeySet * config, Key * errorKey, Key * masterK } catch (std::exception const & e) { + // TODO: Correct? ELEKTRA_SET_LOGICAL_ERRORF (errorKey, "Failed to restore the cryptographic key for decryption because: %s", e.what ()); return -1; } @@ -152,7 +154,7 @@ int elektraCryptoBotanInit (Key * errorKey) } catch (std::exception const & e) { - ELEKTRA_SET_LOGICAL_ERRORF (errorKey, "Botan initialization failed: %s", e.what ()); + ELEKTRA_SET_INSTALLATION_ERRORF (errorKey, "Botan initialization failed: %s", e.what ()); return -1; // failure } return 1; // success @@ -308,6 +310,7 @@ int elektraCryptoBotanDecrypt (KeySet * pluginConfig, Key * k, Key * errorKey, K } catch (std::exception const & e) { + // TODO: Correct? ELEKTRA_SET_LOGICAL_ERRORF (errorKey, "Decryption failed because: %s", e.what ()); return -1; // failure } @@ -338,6 +341,7 @@ char * elektraCryptoBotanCreateRandomString (Key * errorKey, const kdb_unsigned_ } catch (std::exception const & e) { + // TODO: Correct? ELEKTRA_SET_LOGICAL_ERRORF (errorKey, "Failed to generate random string because: %s", e.what ()); return 0; } diff --git a/src/plugins/crypto/crypto.c b/src/plugins/crypto/crypto.c index cb3962eabae..641ea5ffbd9 100644 --- a/src/plugins/crypto/crypto.c +++ b/src/plugins/crypto/crypto.c @@ -103,6 +103,7 @@ static int checkPayloadVersion (Key * k, Key * errorKey) const size_t versionOffset = ELEKTRA_CRYPTO_MAGIC_NUMBER_LEN - 2; if (memcmp (&value[versionOffset], ELEKTRA_CRYPTO_PAYLOAD_VERSION, 2)) { + // TODO: Correct? ELEKTRA_SET_PARSING_ERRORF ( errorKey, "The version of the cryptographic payload is not compatible with the version of the plugin. Keyname: %s", keyName (k)); @@ -157,6 +158,7 @@ static kdb_unsigned_short_t elektraCryptoGetRandomPasswordLength (Key * errorKey } else { + // TODO: Correct? ELEKTRA_ADD_INSTALLATION_WARNING (errorKey, "Master password length provided at " ELEKTRA_CRYPTO_PARAM_MASTER_PASSWORD_LEN " is invalid. Using default value instead."); diff --git a/src/plugins/crypto/gcrypt_operations.c b/src/plugins/crypto/gcrypt_operations.c index 5db22f35b45..2e61d00efea 100644 --- a/src/plugins/crypto/gcrypt_operations.c +++ b/src/plugins/crypto/gcrypt_operations.c @@ -71,6 +71,7 @@ static int getKeyIvForEncryption (KeySet * config, Key * errorKey, Key * masterK if ((gcry_err = gcry_kdf_derive (keyValue (masterKey), keyGetValueSize (masterKey), GCRY_KDF_PBKDF2, GCRY_MD_SHA512, salt, sizeof (salt), iterations, KEY_BUFFER_SIZE, keyBuffer))) { + // TODO: Correct? ELEKTRA_SET_LOGICAL_ERRORF (errorKey, "Failed to create a cryptographic key for encryption because: %s", gcry_strerror (gcry_err)); return -1; @@ -233,6 +234,7 @@ int elektraCryptoGcryHandleCreate (elektraCryptoHandle ** handle, KeySet * confi error: memset (keyBuffer, 0, sizeof (keyBuffer)); memset (ivBuffer, 0, sizeof (ivBuffer)); + // TODO: Correct? ELEKTRA_SET_LOGICAL_ERRORF (errorKey, "Failed to create handle because: %s", gcry_strerror (gcry_err)); gcry_cipher_close (**handle); elektraFree (*handle); @@ -316,6 +318,7 @@ int elektraCryptoGcryEncrypt (elektraCryptoHandle * handle, Key * k, Key * error gcry_err = gcry_cipher_encrypt (*handle, current, ELEKTRA_CRYPTO_GCRY_BLOCKSIZE, NULL, 0); if (gcry_err != 0) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (errorKey, "Encryption failed because: %s", gcry_strerror (gcry_err)); memset (output, 0, outputLen); elektraFree (output); @@ -331,6 +334,7 @@ int elektraCryptoGcryEncrypt (elektraCryptoHandle * handle, Key * k, Key * error gcry_err = gcry_cipher_encrypt (*handle, current, dataLen, NULL, 0); if (gcry_err != 0) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (errorKey, "Encryption failed because: %s", gcry_strerror (gcry_err)); memset (output, 0, outputLen); elektraFree (output); @@ -365,7 +369,7 @@ int elektraCryptoGcryDecrypt (elektraCryptoHandle * handle, Key * k, Key * error // plausibility check if (payloadLen % ELEKTRA_CRYPTO_GCRY_BLOCKSIZE != 0) { - ELEKTRA_SET_LOGICAL_ERROR (errorKey, "value length is not a multiple of the block size"); + ELEKTRA_SET_PARSING_ERROR (errorKey, "value length is not a multiple of the block size"); return -1; } diff --git a/src/plugins/crypto/gpg.c b/src/plugins/crypto/gpg.c index f8ce9bc8c1a..265fbce7365 100644 --- a/src/plugins/crypto/gpg.c +++ b/src/plugins/crypto/gpg.c @@ -86,7 +86,7 @@ static int isExecutable (const char * file, Key * errorKey) { if (errorKey) { - ELEKTRA_SET_RESOURCE_ERRORF (errorKey, "gpg binary %s not found", file); + ELEKTRA_SET_INSTALLATION_ERRORF (errorKey, "gpg binary %s not found", file); } return -1; } @@ -658,6 +658,7 @@ int ELEKTRA_PLUGIN_FUNCTION (gpgCall) (KeySet * conf, Key * errorKey, Key * msgK { case -1: // fork() failed + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERROR (errorKey, "fork failed"); closePipe (pipe_stdin); closePipe (pipe_stdout); @@ -718,6 +719,7 @@ int ELEKTRA_PLUGIN_FUNCTION (gpgCall) (KeySet * conf, Key * errorKey, Key * msgK { if (write (pipe_stdin[1], keyValue (msgKey), sendMessageSize) != sendMessageSize) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERROR (errorKey, "The communication with the GPG process failed."); closePipe (pipe_stdin); closePipe (pipe_stdout); @@ -748,6 +750,7 @@ int ELEKTRA_PLUGIN_FUNCTION (gpgCall) (KeySet * conf, Key * errorKey, Key * msgK case 1: // bad signature + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERROR (errorKey, "GPG reported a bad signature"); break; @@ -774,6 +777,7 @@ int ELEKTRA_PLUGIN_FUNCTION (gpgCall) (KeySet * conf, Key * errorKey, Key * msgK { errorBuffer[0] = '\0'; } + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (errorKey, "GPG failed with return value %d. %s", status, errorBuffer); break; } diff --git a/src/plugins/crypto/helper.c b/src/plugins/crypto/helper.c index 92abfea029a..d2a08df8e1b 100644 --- a/src/plugins/crypto/helper.c +++ b/src/plugins/crypto/helper.c @@ -112,6 +112,7 @@ int ELEKTRA_PLUGIN_FUNCTION (getSaltFromMetakey) (Key * errorKey, Key * k, kdb_o const Key * meta = keyGetMeta (k, ELEKTRA_CRYPTO_META_SALT); if (!meta) { + // TODO: Correct? ELEKTRA_SET_LOGICAL_ERRORF (errorKey, "missing salt as metakey %s in key %s", ELEKTRA_CRYPTO_META_SALT, keyName (k)); return -1; } @@ -119,6 +120,7 @@ int ELEKTRA_PLUGIN_FUNCTION (getSaltFromMetakey) (Key * errorKey, Key * k, kdb_o int result = ELEKTRA_PLUGIN_FUNCTION (base64Decode) (errorKey, keyString (meta), salt, &saltLenInternal); if (result == -1) { + // TODO: Correct? ELEKTRA_SET_LOGICAL_ERROR (errorKey, "Salt was not stored Base64 encoded."); return -1; } @@ -154,6 +156,7 @@ int ELEKTRA_PLUGIN_FUNCTION (getSaltFromPayload) (Key * errorKey, Key * k, kdb_o // validate payload length if ((size_t) payloadLen < sizeof (size_t) || payloadLen < 0) { + // TODO: Correct? ELEKTRA_SET_LOGICAL_ERRORF (errorKey, "payload is too small to contain a salt (payload length is: %zu)", payloadLen); if (salt) *salt = NULL; return -1; @@ -170,6 +173,7 @@ int ELEKTRA_PLUGIN_FUNCTION (getSaltFromPayload) (Key * errorKey, Key * k, kdb_o // validate restored salt length if (restoredSaltLen < 1 || restoredSaltLen > (payloadLen - headerLen)) { + // TODO: Correct? ELEKTRA_SET_LOGICAL_ERRORF (errorKey, "restored salt has invalid length of %u (payload length is: %zu)", restoredSaltLen, payloadLen); if (salt) *salt = NULL; @@ -193,7 +197,7 @@ Key * ELEKTRA_PLUGIN_FUNCTION (getMasterPassword) (Key * errorKey, KeySet * conf Key * master = ksLookupByName (config, ELEKTRA_CRYPTO_PARAM_MASTER_PASSWORD, 0); if (!master) { - ELEKTRA_SET_LOGICAL_ERRORF (errorKey, "missing %s in plugin configuration", ELEKTRA_CRYPTO_PARAM_MASTER_PASSWORD); + ELEKTRA_SET_INSTALLATION_ERRORF (errorKey, "missing %s in plugin configuration", ELEKTRA_CRYPTO_PARAM_MASTER_PASSWORD); return NULL; } Key * msg = keyDup (master); @@ -223,6 +227,7 @@ kdb_unsigned_long_t ELEKTRA_PLUGIN_FUNCTION (getIterationCount) (Key * errorKey, } else { + // TODO: Correct? ELEKTRA_ADD_INSTALLATION_WARNING (errorKey, "iteration count provided at " ELEKTRA_CRYPTO_PARAM_ITERATION_COUNT " is invalid. Using default value instead."); } diff --git a/src/plugins/crypto/openssl_operations.c b/src/plugins/crypto/openssl_operations.c index d367f5a7606..37b28c626ae 100644 --- a/src/plugins/crypto/openssl_operations.c +++ b/src/plugins/crypto/openssl_operations.c @@ -60,6 +60,7 @@ static int getKeyIvForEncryption (KeySet * config, Key * errorKey, Key * masterK pthread_mutex_lock (&mutex_ssl); if (!RAND_bytes (salt, ELEKTRA_CRYPTO_DEFAULT_SALT_LEN - 1)) { + // TODO: Correct? ELEKTRA_SET_LOGICAL_ERRORF (errorKey, "failed to generate random salt with error code %lu", ERR_get_error ()); pthread_mutex_unlock (&mutex_ssl); return -1; @@ -87,6 +88,7 @@ static int getKeyIvForEncryption (KeySet * config, Key * errorKey, Key * masterK if (!PKCS5_PBKDF2_HMAC_SHA1 (keyValue (masterKey), keyGetValueSize (masterKey), salt, sizeof (salt), iterations, KEY_BUFFER_SIZE, keyBuffer)) { + // TODO: Correct? ELEKTRA_SET_LOGICAL_ERRORF (errorKey, "Failed to create a cryptographic key for encryption. Libcrypto returned error code: %lu", ERR_get_error ()); @@ -133,6 +135,7 @@ static int getKeyIvForDecryption (KeySet * config, Key * errorKey, Key * masterK if (!PKCS5_PBKDF2_HMAC_SHA1 (keyValue (masterKey), keyGetValueSize (masterKey), saltBuffer, saltBufferLen, iterations, KEY_BUFFER_SIZE, keyBuffer)) { + // TODO: Correct? ELEKTRA_SET_LOGICAL_ERRORF ( errorKey, "Failed to restore the cryptographic key for decryption. Libcrypto returned the error code: %lu", ERR_get_error ()); @@ -207,6 +210,7 @@ int elektraCryptoOpenSSLHandleCreate (elektraCryptoHandle ** handle, KeySet * co { keyDel (key); keyDel (iv); + // TODO: Correct? ELEKTRA_SET_LOGICAL_ERROR (errorKey, "Failed to create handle! Invalid IV length."); return -1; } @@ -239,6 +243,7 @@ int elektraCryptoOpenSSLHandleCreate (elektraCryptoHandle ** handle, KeySet * co if (ERR_peek_error ()) { + // TODO: Correct? ELEKTRA_SET_LOGICAL_ERRORF (errorKey, "Failed to create handle! libcrypto error code was: %lu", ERR_get_error ()); elektraFree (*handle); *handle = NULL; @@ -387,6 +392,7 @@ int elektraCryptoOpenSSLEncrypt (elektraCryptoHandle * handle, Key * k, Key * er return 1; error: + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (errorKey, "Encryption error! libcrypto error code was: %lu", ERR_get_error ()); BIO_free_all (encrypted); pthread_mutex_unlock (&mutex_ssl); @@ -502,6 +508,7 @@ int elektraCryptoOpenSSLDecrypt (elektraCryptoHandle * handle, Key * k, Key * er return 1; error: + // TODO: Correct? ELEKTRA_SET_LOGICAL_ERRORF (errorKey, "Decryption error! libcrypto error code was: %lu", ERR_get_error ()); BIO_free_all (decrypted); pthread_mutex_unlock (&mutex_ssl); @@ -521,6 +528,7 @@ char * elektraCryptoOpenSSLCreateRandomString (Key * errorKey, const kdb_unsigne pthread_mutex_lock (&mutex_ssl); if (!RAND_bytes (buffer, length)) { + // TODO: Correct? ELEKTRA_SET_LOGICAL_ERRORF (errorKey, "Failed to generate random string. libcrypto error code was: %lu", ERR_get_error ()); pthread_mutex_unlock (&mutex_ssl); return NULL; diff --git a/src/plugins/curlget/curlget.c b/src/plugins/curlget/curlget.c index 3699a165a64..1d95af1c251 100644 --- a/src/plugins/curlget/curlget.c +++ b/src/plugins/curlget/curlget.c @@ -427,7 +427,7 @@ int elektraCurlgetOpen (Plugin * handle, Key * errorKey ELEKTRA_UNUSED) { if (!data->password) { - ELEKTRA_SET_RESOURCE_ERROR (errorKey, "No password specified for SSH password authentication"); + ELEKTRA_SET_VALIDATION_SEMANTIC_ERROR (errorKey, "No password specified for SSH password authentication"); if (data->uploadFileName) elektraFree (data->__uploadFileName); elektraFree (data); data = NULL; @@ -721,6 +721,7 @@ int elektraCurlgetSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA ++(data->setPhase); if (strncmp ((char *) data->lastHash, (char *) hash, MD5_DIGEST_LENGTH)) { + // TODO: Correct? ELEKTRA_SET_CONFLICT_ERROR (parentKey, "remote file has changed"); retval = -1; } diff --git a/src/plugins/date/date.c b/src/plugins/date/date.c index 9024968ba10..65ca41b06c6 100644 --- a/src/plugins/date/date.c +++ b/src/plugins/date/date.c @@ -411,7 +411,7 @@ static int validateKey (Key * key, Key * parentKey) rc = formatStringValidation (date, formatString); if (rc == -1) { - ELEKTRA_SET_VALIDATION_SEMANTIC_ERRORF (parentKey, "%s doesn't match format string %s", date, formatString); + ELEKTRA_SET_VALIDATION_SYNTACTIC_ERRORF (parentKey, "%s doesn't match format string %s", date, formatString); rc = 0; } } @@ -421,15 +421,15 @@ static int validateKey (Key * key, Key * parentKey) if (rc == -1) { if (formatString) - ELEKTRA_SET_VALIDATION_SEMANTIC_ERRORF (parentKey, "%s doesn't match iso specification %s", date, + ELEKTRA_SET_VALIDATION_SYNTACTIC_ERRORF (parentKey, "%s doesn't match iso specification %s", date, formatString); else - ELEKTRA_SET_VALIDATION_SEMANTIC_ERRORF (parentKey, "%s is not a valid ISO8601 date", date); + ELEKTRA_SET_VALIDATION_SYNTACTIC_ERRORF (parentKey, "%s is not a valid ISO8601 date", date); rc = 0; } else if (rc == 0) { - ELEKTRA_SET_VALIDATION_SEMANTIC_ERRORF (parentKey, "syntax error in ISO8601 format string '%s'", formatString); + ELEKTRA_SET_VALIDATION_SYNTACTIC_ERRORF (parentKey, "syntax error in ISO8601 format string '%s'", formatString); } } else if (!strcasecmp (stdString, "RFC2822")) @@ -437,7 +437,7 @@ static int validateKey (Key * key, Key * parentKey) rc = rfc2822StringValidation (date); if (rc == -1) { - ELEKTRA_SET_VALIDATION_SEMANTIC_ERRORF (parentKey, "%s doesn't match rfc2822 specification", date); + ELEKTRA_SET_VALIDATION_SYNTACTIC_ERRORF (parentKey, "%s doesn't match rfc2822 specification", date); rc = 0; } } @@ -446,7 +446,7 @@ static int validateKey (Key * key, Key * parentKey) rc = rfc822StringValidation (date); if (rc == -1) { - ELEKTRA_SET_VALIDATION_SEMANTIC_ERRORF (parentKey, "%s doesn't match format string %s", date, formatString); + ELEKTRA_SET_VALIDATION_SYNTACTIC_ERRORF (parentKey, "%s doesn't match format string %s", date, formatString); rc = 0; } } diff --git a/src/plugins/directoryvalue/directoryvalue.cpp b/src/plugins/directoryvalue/directoryvalue.cpp index 50f12702369..f9ca8eb01fa 100644 --- a/src/plugins/directoryvalue/directoryvalue.cpp +++ b/src/plugins/directoryvalue/directoryvalue.cpp @@ -81,10 +81,12 @@ int elektraDirectoryValueGet (Plugin * handle, KeySet * returned, Key * parentKe } catch (range_error const & error) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (*parent, "Unable to insert array value %s", error.what ()); } catch (exception const & error) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (*parent, "Uncaught Exception: %s", error.what ()); } @@ -114,10 +116,12 @@ int elektraDirectoryValueSet (Plugin * handle, KeySet * returned, Key * parentKe } catch (range_error const & error) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (*parent, "Unable to insert array value %s", error.what ()); } catch (exception const & error) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (*parent, "Uncaught exception: %s", error.what ()); } diff --git a/src/plugins/fcrypt/fcrypt.c b/src/plugins/fcrypt/fcrypt.c index a4e1db41fe3..8d046e5f94d 100644 --- a/src/plugins/fcrypt/fcrypt.c +++ b/src/plugins/fcrypt/fcrypt.c @@ -572,6 +572,7 @@ int ELEKTRA_PLUGIN_FUNCTION (get) (Plugin * handle, KeySet * ks ELEKTRA_UNUSED, fcryptState * s = (fcryptState *) elektraPluginGetData (handle); if (!s) { + // TODO: Correct? ELEKTRA_SET_LOGICAL_ERROR (parentKey, "No plugin state is available."); return -1; } diff --git a/src/plugins/gitresolver/gitresolver.c b/src/plugins/gitresolver/gitresolver.c index 18084de91de..a9a35b81135 100644 --- a/src/plugins/gitresolver/gitresolver.c +++ b/src/plugins/gitresolver/gitresolver.c @@ -662,6 +662,7 @@ int elektraGitresolverGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELE int rc = pullFromRemote (data, repo); if (rc) { + // TODO: Correct? ELEKTRA_SET_CONFLICT_ERROR (parentKey, "Fast-forward pull failed, please pull manually\n"); git_repository_free (repo); git_libgit2_shutdown (); @@ -860,6 +861,7 @@ int elektraGitresolverSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELE if (newCommit) { // newer commit in repo - abort + // TODO: Correct? ELEKTRA_SET_CONFLICT_ERROR (parentKey, "The repository has been updated and is ahead of you"); elektraFree (newCommit); git_reference_free (headRef); @@ -878,6 +880,7 @@ int elektraGitresolverSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELE char * newObj = hasNewObjectCommit (data, blob); if (newObj) { + // TODO: Correct? ELEKTRA_SET_CONFLICT_ERROR (parentKey, "The repository has been updated and is ahead of you"); elektraFree (newObj); git_object_free (blob); diff --git a/src/plugins/gpgme/gpgme.c b/src/plugins/gpgme/gpgme.c index 466df2033e9..6584bb58145 100644 --- a/src/plugins/gpgme/gpgme.c +++ b/src/plugins/gpgme/gpgme.c @@ -153,6 +153,7 @@ static gpgme_key_t * extractRecipientFromPluginConfig (KeySet * config, Key * er err = gpgme_get_key (ctx, keyString (gpgRecipientRoot), &key, 0); if (err) { + // TODO: Correct? ELEKTRA_SET_LOGICAL_ERRORF (errorKey, "Failed to receive the GPG key because: %s", gpgme_strerror (err)); elektraGpgmeKeylistFree (&list); return NULL; @@ -182,6 +183,7 @@ static gpgme_key_t * extractRecipientFromPluginConfig (KeySet * config, Key * er err = gpgme_get_key (ctx, keyString (k), &key, 0); if (err) { + // TODO: Correct? ELEKTRA_SET_LOGICAL_ERRORF (errorKey, "Failed to receive the GPG key because: %s", gpgme_strerror (err)); elektraGpgmeKeylistFree (&list); diff --git a/src/plugins/hexnumber/hexnumber.c b/src/plugins/hexnumber/hexnumber.c index 1b7aa810575..f1dfe3b2368 100644 --- a/src/plugins/hexnumber/hexnumber.c +++ b/src/plugins/hexnumber/hexnumber.c @@ -83,6 +83,7 @@ static int convertHexToDec (Key * key, Key * parentKey) int result = snprintf (NULL, 0, "%llu", value); if (result < 0) { + // TODO: Correct? ELEKTRA_SET_PARSING_ERRORF (parentKey, "Unable to convert '%s' into decimal", hexValue); return ELEKTRA_PLUGIN_STATUS_ERROR; } @@ -98,6 +99,7 @@ static int convertHexToDec (Key * key, Key * parentKey) result = snprintf (decValue, length, "%llu", value); if (result < 0) { + // TODO: Correct? ELEKTRA_SET_PARSING_ERRORF (parentKey, "Unable to convert '%s' into decimal", hexValue); elektraFree (decValue); return ELEKTRA_PLUGIN_STATUS_ERROR; @@ -152,6 +154,7 @@ static int convertDecToHex (Key * key, Key * parentKey) const int result = snprintf (NULL, 0, "0x%llx", value); if (result < 0) { + // TODO: Correct? ELEKTRA_SET_PARSING_ERRORF (parentKey, "Unable to convert '%s' into hexadecimal", decValue); return ELEKTRA_PLUGIN_STATUS_ERROR; } @@ -166,6 +169,7 @@ static int convertDecToHex (Key * key, Key * parentKey) if (snprintf (hexValue, length, "0x%llx", value) < 0) { + // TODO: Correct? ELEKTRA_SET_PARSING_ERRORF (parentKey, "Unable to convert '%s' into hexadecimal", decValue); elektraFree (hexValue); return ELEKTRA_PLUGIN_STATUS_ERROR; @@ -351,7 +355,7 @@ int elektraHexnumberGet (Plugin * handle, KeySet * returned, Key * parentKey) } else { - ELEKTRA_SET_PARSING_ERRORF ( + ELEKTRA_SET_VALIDATION_SEMANTIC_ERRORF ( parentKey, "Key '%s' has unit/base metadata set as hex but value '%s' does not start with 0x", keyName (cur), keyString (cur)); status |= ELEKTRA_PLUGIN_STATUS_ERROR; diff --git a/src/plugins/iconv/iconv.c b/src/plugins/iconv/iconv.c index 1f930c61a36..e11606854ca 100644 --- a/src/plugins/iconv/iconv.c +++ b/src/plugins/iconv/iconv.c @@ -178,6 +178,7 @@ int elektraIconvGet (Plugin * handle, KeySet * returned, Key * parentKey) memcpy (convertedData, keyString (cur), keyGetValueSize (cur)); if (kdbbUTF8Engine (handle, UTF8_FROM, &convertedData, &convertedDataSize)) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF ( parentKey, "Could not convert string %s, got result %s, encoding settings are from %s to %s", keyString (cur), convertedData, getFrom (handle), getTo (handle)); @@ -197,6 +198,7 @@ int elektraIconvGet (Plugin * handle, KeySet * returned, Key * parentKey) memcpy (convertedData, keyString (meta), keyGetValueSize (meta)); if (kdbbUTF8Engine (handle, UTF8_FROM, &convertedData, &convertedDataSize)) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF ( parentKey, "Could not convert string %s, got result %s, encoding settings are from %s to %s", keyString (meta), convertedData, getFrom (handle), getTo (handle)); @@ -230,6 +232,7 @@ int elektraIconvSet (Plugin * handle, KeySet * returned, Key * parentKey) memcpy (convertedData, keyString (cur), keyGetValueSize (cur)); if (kdbbUTF8Engine (handle, UTF8_TO, &convertedData, &convertedDataSize)) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (parentKey, "Could not convert string %s, got result %s," " encoding settings are from %s to %s (but swapped for write)", @@ -250,6 +253,7 @@ int elektraIconvSet (Plugin * handle, KeySet * returned, Key * parentKey) memcpy (convertedData, keyString (meta), keyGetValueSize (meta)); if (kdbbUTF8Engine (handle, UTF8_TO, &convertedData, &convertedDataSize)) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (parentKey, "Could not convert string %s, got result %s," " encodings settings are from %s to %s (but swapped for write)", diff --git a/src/plugins/jni/jni.c b/src/plugins/jni/jni.c index a96c0a2b5c4..bb0de04a54e 100644 --- a/src/plugins/jni/jni.c +++ b/src/plugins/jni/jni.c @@ -64,6 +64,7 @@ static void checkException (Data * data, const char * when, Key * warningKey) which = (*data->env)->GetStringUTFChars (data->env, estr, &iseCopy); } + // TODO: Correct? ELEKTRA_ADD_INSTALLATION_WARNINGF (warningKey, "During \"%s\", java exception was thrown: %s", when, which); if (iseCopy == JNI_TRUE) @@ -96,6 +97,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)) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (errorKey, "%s failed with exception", method); result = -1; } @@ -113,7 +115,7 @@ static int call2Arg (Data * data, KeySet * ks, Key * errorKey, const char * meth checkException (data, method, errorKey); if (jks == 0) { - ELEKTRA_SET_INSTALLATION_ERROR (errorKey, "Cannot create ks"); + ELEKTRA_SET_RESOURCE_ERROR (errorKey, "Cannot create ks"); return -1; } @@ -121,7 +123,7 @@ static int call2Arg (Data * data, KeySet * ks, Key * errorKey, const char * meth checkException (data, method, errorKey); if (jkey == 0) { - ELEKTRA_SET_INSTALLATION_ERROR (errorKey, "Cannot create key"); + ELEKTRA_SET_RESOURCE_ERROR (errorKey, "Cannot create key"); return -1; } @@ -137,6 +139,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)) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (errorKey, "%s failed with exception", method); result = -1; } @@ -269,7 +272,7 @@ int elektraJniOpen (Plugin * handle, Key * errorKey) data->midKeyRelease = (*data->env)->GetMethodID (data->env, data->clsKey, "release", "()V"); if (data->midKeyRelease == 0) { - ELEKTRA_SET_INSTALLATION_ERROR (errorKey, "Cannot find release of Key"); + ELEKTRA_SET_RESOURCE_ERROR (errorKey, "Cannot find release of Key"); return -1; } diff --git a/src/plugins/keytometa/keytometa.c b/src/plugins/keytometa/keytometa.c index c21258c66f2..8b499d71217 100644 --- a/src/plugins/keytometa/keytometa.c +++ b/src/plugins/keytometa/keytometa.c @@ -253,7 +253,7 @@ int elektraKeyToMetaGet (Plugin * handle, KeySet * returned, Key * parentKey ELE if (ret < 0) { elektraFree (keyArray); - ELEKTRA_SET_RESOURCE_ERROR (parentKey, strerror (errno)); + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Memory allocation error: %s" strerror (errno)); errno = errnosave; return 0; } diff --git a/src/plugins/line/line.c b/src/plugins/line/line.c index 53962b82602..b740af3f4d6 100644 --- a/src/plugins/line/line.c +++ b/src/plugins/line/line.c @@ -100,6 +100,7 @@ int elektraLineGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * par if (ret == -1) { + // TODO: Correct? ELEKTRA_SET_PARSING_ERRORF (parentKey, "could not increment array from %s", keyName (ksTail (returned))); ret = -1; } diff --git a/src/plugins/lua/lua.cpp b/src/plugins/lua/lua.cpp index 75321992c7c..d0ad1778b78 100644 --- a/src/plugins/lua/lua.cpp +++ b/src/plugins/lua/lua.cpp @@ -149,6 +149,7 @@ int elektraLuaOpen (ckdb::Plugin * handle, ckdb::Key * errorKey) /* init new lua state */ if ((data->L = lua_newstate (Lua_alloc, NULL)) == NULL) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERROR (errorKey, "Unable to create new lua state"); goto error; } diff --git a/src/plugins/network/network.c b/src/plugins/network/network.c index 764347a8a80..d34902460b7 100644 --- a/src/plugins/network/network.c +++ b/src/plugins/network/network.c @@ -75,7 +75,7 @@ int elektraPortInfo (Key * toCheck, Key * parentKey) service = getservbyname (keyString (toCheck), NULL); // NULL means we accept both tcp and udp if (service == NULL) { - ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Could not find service with name %s on key %s", keyString (toCheck), + ELEKTRA_SET_VALIDATION_SEMANTIC_ERRORF (parentKey, "Could not find service with name %s on key %s", keyString (toCheck), keyName (toCheck)); return -1; } @@ -101,12 +101,12 @@ int elektraPortInfo (Key * toCheck, Key * parentKey) { if (errno == HOST_NOT_FOUND) { - ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "Could not connect to %s: No such host", hostname); + ELEKTRA_SET_VALIDATION_SEMANTIC_ERRORF (parentKey, "Could not connect to %s: No such host", hostname); return -1; } else { - ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "There was an error trying to connect to host %s: %s", hostname, + ELEKTRA_SET_VALIDATION_SEMANTIC_ERRORF (parentKey, "There was an error trying to connect to host %s: %s", hostname, strerror (errno)); return -1; } diff --git a/src/plugins/passwd/passwd.c b/src/plugins/passwd/passwd.c index 48e899695f5..8a042005199 100644 --- a/src/plugins/passwd/passwd.c +++ b/src/plugins/passwd/passwd.c @@ -308,6 +308,7 @@ static int writeKS (KeySet * returned, Key * parentKey, SortBy index) struct passwd * pwd = KStoPasswd (cutKS, index); if (validatepwent (pwd) == -1) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (parentKey, "Invalid passwd entry %s:%s:%u:%u:%s:%s:%s\n", pwd->pw_name, pwd->pw_passwd, pwd->pw_uid, pwd->pw_gid, pwd->pw_gecos, pwd->pw_dir, pwd->pw_shell); diff --git a/src/plugins/process/process.c b/src/plugins/process/process.c index 227dd7adfce..9e08ffb3806 100644 --- a/src/plugins/process/process.c +++ b/src/plugins/process/process.c @@ -26,7 +26,7 @@ static int validPluginName (Key * pluginNameKey, Key * errorKey) { if (pluginNameKey == NULL) { - ELEKTRA_ADD_VALIDATION_SEMANTIC_WARNING (errorKey, + ELEKTRA_ADD_INSTALLATION_WARNING (errorKey, "Missing plugin configuration parameter plugin="); return 0; } @@ -42,6 +42,7 @@ static int validPluginName (Key * pluginNameKey, Key * errorKey) } else if (elektraStrCmp (pluginName, "process") == 0) { + // TODO: Correct? ELEKTRA_ADD_INSTALLATION_WARNING (errorKey, "Cannot proxy the process plugin itself"); return 0; } @@ -107,6 +108,7 @@ int elektraProcessOpen (Plugin * handle, Key * errorKey) process->plugin = elektraInvokeOpen (keyString (process->pluginName), process->pluginConfig, errorKey); if (!process->plugin) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (errorKey, "Failed to open the proxied plugin %s", keyString (process->pluginName)); return ELEKTRA_PLUGIN_STATUS_ERROR; } diff --git a/src/plugins/python/python.cpp b/src/plugins/python/python.cpp index efdf1442f23..1b983838c3c 100644 --- a/src/plugins/python/python.cpp +++ b/src/plugins/python/python.cpp @@ -101,6 +101,7 @@ static int Python_CallFunction_Int (moduleData * data, PyObject * object, PyObje PyObject * res = Python_CallFunction (object, args); if (!res) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (errorKey, "Error while calling python function of script %s%s", keyString (data->script), data->printError ? "" : ", use /print to print error messages"); if (data->printError) PyErr_Print (); diff --git a/src/plugins/quickdump/quickdump.c b/src/plugins/quickdump/quickdump.c index 8764d0dac02..c6db2b0ad09 100644 --- a/src/plugins/quickdump/quickdump.c +++ b/src/plugins/quickdump/quickdump.c @@ -386,6 +386,7 @@ int elektraQuickdumpGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key const Key * sourceKey = ksLookupByName (returned, nameBuffer.string, 0); if (sourceKey == NULL) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (parentKey, "Could not copy meta data from key '%s': Key not found", nameBuffer.string); keyDel (k); @@ -398,6 +399,7 @@ int elektraQuickdumpGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key if (keyCopyMeta (k, sourceKey, metaNameBuffer.string) != 1) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (parentKey, "Could not copy meta data from key '%s': Error during copy", &nameBuffer.string[nameBuffer.offset]); @@ -416,6 +418,7 @@ int elektraQuickdumpGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key elektraFree (metaNameBuffer.string); elektraFree (valueBuffer.string); fclose (file); + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (parentKey, "Unknown meta type %c", type); return ELEKTRA_PLUGIN_STATUS_ERROR; } diff --git a/src/plugins/quickdump/readv1.c b/src/plugins/quickdump/readv1.c index d0aadbc5c0d..e1f81c3270e 100644 --- a/src/plugins/quickdump/readv1.c +++ b/src/plugins/quickdump/readv1.c @@ -145,6 +145,7 @@ static int readVersion1 (FILE * file, KeySet * returned, Key * parentKey) const Key * sourceKey = ksLookupByName (returned, keyName, 0); if (sourceKey == NULL) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (parentKey, "Could not copy meta data from key '%s': Key not found", keyName); keyDel (k); @@ -156,6 +157,7 @@ static int readVersion1 (FILE * file, KeySet * returned, Key * parentKey) if (keyCopyMeta (k, sourceKey, metaName) != 1) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF ( parentKey, "Could not copy meta data from key '%s': Error during copy", keyName); keyDel (k); diff --git a/src/plugins/reference/reference.c b/src/plugins/reference/reference.c index cb34fa8209f..fb002b351d2 100644 --- a/src/plugins/reference/reference.c +++ b/src/plugins/reference/reference.c @@ -46,7 +46,7 @@ static Key * resolveReference (KeySet * allKeys, const char * reference, const K if (elektraIsReferenceRedundant (reference)) { - ELEKTRA_ADD_RESOURCE_WARNINGF (parentKey, "Reference '%s' uses '/./' or '/../' redundantly.", reference); + ELEKTRA_ADD_VALIDATION_SEMANTIC_WARNINGF (parentKey, "Reference '%s' uses '/./' or '/../' redundantly.", reference); } char * fullReference = elektraResolveReference (reference, baseKey, parentKey); diff --git a/src/plugins/resolver/filename.c b/src/plugins/resolver/filename.c index 6948ce8f2a1..0574867ae57 100644 --- a/src/plugins/resolver/filename.c +++ b/src/plugins/resolver/filename.c @@ -144,6 +144,7 @@ static char * elektraResolvePasswd (Key * warningsKey) elektraFree (buf); if (s != 0) { + // TODO: Correct? ELEKTRA_ADD_INSTALLATION_WARNINGF (warningsKey, "Could not retrieve from passwd using getpwuid_r: %s", strerror (s)); } @@ -186,7 +187,8 @@ static int elektraResolveUserXDGHome (ElektraResolved * handle, Key * warningsKe if (home[0] != '/') { - ELEKTRA_ADD_INSTALLATION_WARNINGF (warningsKey, + // TODO: Correct? + ELEKTRA_ADD_VALIDATION_SEMANTIC_WARNINGF (warningsKey, "XDG_CONFIG_HOME contains a path that is " "not absolute (violates XDG specification) and thus " "it was skipped: %s", @@ -208,7 +210,7 @@ static int elektraResolveEnvHome (ElektraResolved * handle, Key * warningsKey) if (home[0] != '/') { - ELEKTRA_ADD_INSTALLATION_WARNINGF (warningsKey, + ELEKTRA_ADD_VALIDATION_SEMANTIC_WARNINGF (warningsKey, "HOME contains a path that is " "not absolute and thus " "it was skipped: %s", @@ -301,6 +303,7 @@ static int elektraResolveMapperUser (ElektraResolved * handle, ElektraResolveTem } if (finished == -1) { + // TODO: Correct? ELEKTRA_ADD_RESOURCE_WARNINGF (warningsKey, "user resolver failed at step %zu, the configuration is: %s", i, ELEKTRA_VARIANT_USER); return -1; @@ -308,6 +311,7 @@ static int elektraResolveMapperUser (ElektraResolved * handle, ElektraResolveTem if (!(handle->dirname)) { + // TODO: Correct? ELEKTRA_ADD_RESOURCE_WARNINGF (warningsKey, "no resolver set the user dirname, the configuration is: %s", ELEKTRA_VARIANT_USER); return -1; diff --git a/src/plugins/resolver/resolver.c b/src/plugins/resolver/resolver.c index d7364b54ad4..51959d5c447 100644 --- a/src/plugins/resolver/resolver.c +++ b/src/plugins/resolver/resolver.c @@ -662,7 +662,7 @@ static int elektraOpenFile (resolverHandle * pk, Key * parentKey) { if (errno == ENOENT) { - ELEKTRA_SET_CONFLICT_ERRORF (parentKey, + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "The configuration file \"%s\" was there earlier, " "now it is missing", pk->filename); @@ -686,7 +686,7 @@ static int elektraOpenFile (resolverHandle * pk, Key * parentKey) } else if (errno == EEXIST) { - ELEKTRA_SET_CONFLICT_ERRORF (parentKey, + ELEKTRA_SET_RESOURCE_ERRORF (parentKey, "No configuration file was there earlier, " "now configuration file \"%s\" exists", pk->filename); @@ -970,6 +970,7 @@ static void elektraUpdateFileTime (resolverHandle * pk, int fd, Key * parentKey) if (futimens (fd, times) == -1) { + // TODO: Correct? ELEKTRA_ADD_LOGICAL_WARNINGF (parentKey, "Could not update time stamp of \"%s\", because %s", fd == pk->fd ? pk->filename : pk->tempfile, strerror (errno)); } @@ -979,6 +980,7 @@ static void elektraUpdateFileTime (resolverHandle * pk, int fd, Key * parentKey) if (futimes (fd, times) == -1) { + // TODO: Correct? ELEKTRA_ADD_LOGICAL_WARNINGF (parentKey, "Could not update time stamp of \"%s\", because %s", fd == pk->fd ? pk->filename : pk->tempfile, strerror (errno)); } diff --git a/src/plugins/ruby/ruby.cpp b/src/plugins/ruby/ruby.cpp index 07e7cf9208b..2530fa64927 100644 --- a/src/plugins/ruby/ruby.cpp +++ b/src/plugins/ruby/ruby.cpp @@ -133,6 +133,7 @@ static VALUE clear_ruby_exception_add_warning (ckdb::Key * warningsKey) VALUE exception = clear_ruby_exception (); VALUE msg = get_exception_string (exception); + // TODO: Correct? ELEKTRA_ADD_INSTALLATION_WARNING (warningsKey, StringValueCStr (msg)); return exception; @@ -143,6 +144,7 @@ static VALUE clear_ruby_exception_set_error (ckdb::Key * errorKey) VALUE exception = clear_ruby_exception (); VALUE msg = get_exception_string (exception); + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERROR (errorKey, StringValueCStr (msg)); return exception; diff --git a/src/plugins/shell/shell.c b/src/plugins/shell/shell.c index 69ebc4e3309..98a5b9e0833 100644 --- a/src/plugins/shell/shell.c +++ b/src/plugins/shell/shell.c @@ -70,6 +70,7 @@ int elektraShellGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * pa int retVal = executeCommand (keyString (cmdKey)); if (retVal == -1) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (parentKey, "launching childprocess failed with %s\n", strerror (errno)); return -1; } @@ -77,6 +78,7 @@ int elektraShellGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * pa { if (atoi (keyString (expectedReturnKey)) != retVal) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (parentKey, "return value of %s doesn't match expected exit %s\n", keyString (cmdKey), keyString (expectedReturnKey)); return -1; @@ -98,6 +100,7 @@ int elektraShellSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA_U int retVal = executeCommand (keyString (cmdKey)); if (retVal == -1) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (parentKey, "launching childprocess failed with %s\n", strerror (errno)); return -1; } @@ -105,6 +108,7 @@ int elektraShellSet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA_U { if (atoi (keyString (expectedReturnKey)) != retVal) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (parentKey, "return value of %s doesn't match expected exit %s\n", keyString (cmdKey), keyString (expectedReturnKey)); return -1; @@ -126,6 +130,7 @@ int elektraShellError (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA int retVal = executeCommand (keyString (cmdKey)); if (retVal == -1) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (parentKey, "launching childprocess failed with %s\n", strerror (errno)); return -1; } @@ -133,6 +138,7 @@ int elektraShellError (Plugin * handle ELEKTRA_UNUSED, KeySet * returned ELEKTRA { if (atoi (keyString (expectedReturnKey)) != retVal) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (parentKey, "return value of %s doesn't match expected exit %s\n", keyString (cmdKey), keyString (expectedReturnKey)); return -1; diff --git a/src/plugins/specload/specload.c b/src/plugins/specload/specload.c index f598db2f169..28364d935d2 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_INSTALLATION_ERROR (parentKey, "Couldn't load the overlay specification."); + ELEKTRA_SET_RESOURCE_ERROR (parentKey, "Couldn't load the overlay specification."); return ELEKTRA_PLUGIN_STATUS_ERROR; } } @@ -363,13 +363,13 @@ bool getAppAndArgs (KeySet * conf, char ** appPtr, char *** argvPtr, Key * error if (app[0] != '/') { - ELEKTRA_SET_INSTALLATION_ERRORF (errorKey, "The value of the app config key ('%s') is not an absolute path.", app); + ELEKTRA_SET_VALIDATION_SEMANTIC_ERRORF (errorKey, "The value of the app config key ('%s') is not an absolute path.", app); return false; } if (access (app, X_OK) != 0) { - ELEKTRA_SET_INSTALLATION_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/struct/struct.cpp b/src/plugins/struct/struct.cpp index 66607b578d3..ef29716cd84 100644 --- a/src/plugins/struct/struct.cpp +++ b/src/plugins/struct/struct.cpp @@ -68,6 +68,7 @@ int elektraStructSet (ckdb::Plugin * handle, ckdb::KeySet * returned, ckdb::Key } catch (const char * msg) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (parentKey, "Could not check the structure of the keyset: %s", msg); return -1; } diff --git a/src/plugins/validation/validation.c b/src/plugins/validation/validation.c index ca25796d2a1..dce16310080 100644 --- a/src/plugins/validation/validation.c +++ b/src/plugins/validation/validation.c @@ -111,6 +111,7 @@ static int validateKey (Key * key, Key * parentKey) { char buffer[1000]; regerror (ret, ®ex, buffer, 999); + // TODO: Correct? ELEKTRA_SET_VALIDATION_SYNTACTIC_ERRORF (parentKey, "Could not compile regex: %s", buffer); regfree (®ex); if (freeString) elektraFree (regexString); diff --git a/src/plugins/wresolver/wresolver.c b/src/plugins/wresolver/wresolver.c index b6ceaf72220..bfc957597a5 100644 --- a/src/plugins/wresolver/wresolver.c +++ b/src/plugins/wresolver/wresolver.c @@ -385,6 +385,7 @@ int elektraWresolverSet (Plugin * handle, KeySet * returned ELEKTRA_UNUSED, Key switch (pk->state) { case 0: + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERROR (parentKey, "kdbSet() called before kdbGet()"); return -1; case 1: diff --git a/src/plugins/yambi/yambi.cpp b/src/plugins/yambi/yambi.cpp index 606f1de8f5e..f5dac193c98 100644 --- a/src/plugins/yambi/yambi.cpp +++ b/src/plugins/yambi/yambi.cpp @@ -74,6 +74,7 @@ int elektraYambiGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * pa } catch (exception const & error) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (*parent, "Uncaught exception: %s", error.what ()); } diff --git a/src/plugins/yawn/yawn.cpp b/src/plugins/yawn/yawn.cpp index 4a4c92a1755..91aa2195303 100644 --- a/src/plugins/yawn/yawn.cpp +++ b/src/plugins/yawn/yawn.cpp @@ -80,6 +80,7 @@ int elektraYawnGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * par } catch (exception const & error) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (*parent, "Uncaught exception: %s", error.what ()); } diff --git a/src/plugins/yaypeg/yaypeg.cpp b/src/plugins/yaypeg/yaypeg.cpp index 35d106d6c90..495510275ae 100644 --- a/src/plugins/yaypeg/yaypeg.cpp +++ b/src/plugins/yaypeg/yaypeg.cpp @@ -73,6 +73,7 @@ int elektraYaypegGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * p } catch (exception const & error) { + // TODO: Correct? ELEKTRA_SET_INSTALLATION_ERRORF (*parent, "Uncaught exception: %s", error.what ()); } diff --git a/src/plugins/zeromqsend/zeromqsend.c b/src/plugins/zeromqsend/zeromqsend.c index fae2f2a6924..8e1ceceb782 100644 --- a/src/plugins/zeromqsend/zeromqsend.c +++ b/src/plugins/zeromqsend/zeromqsend.c @@ -119,6 +119,7 @@ int elektraZeroMqSendSet (Plugin * handle, KeySet * returned ELEKTRA_UNUSED, Key // subscription timeout - no applications are listening for notifications, can be ignored break; default: + // TODO: Correct? ELEKTRA_ADD_INSTALLATION_WARNING (parentKey, "could not send notifications"); break; }