[pacman-dev] [PATCH] Remove unused error codes and handle PM_ERR_RETRIEVE by alpm_strerror()
From 88c26a6e5902875f07ca7c842971619530fa5aa9 Mon Sep 17 00:00:00 2001 From: Nagy Gabor <ngaba@bibl.u-szeged.hu> Date: Sat, 18 Apr 2009 17:35:08 +0200 Subject: [PATCH] Remove unused error codes and handle PM_ERR_RETRIEVE by alpm_strerror()
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> --- lib/libalpm/alpm.h | 9 --------- lib/libalpm/error.c | 17 ++--------------- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 48b6ba2..57ea880 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -487,31 +487,22 @@ enum _pmerrno_t { PM_ERR_TRANS_NOT_PREPARED, PM_ERR_TRANS_ABORT, PM_ERR_TRANS_TYPE, - PM_ERR_TRANS_COMMITING, - PM_ERR_TRANS_DOWNLOADING, /* Packages */ PM_ERR_PKG_NOT_FOUND, PM_ERR_PKG_IGNORED, PM_ERR_PKG_INVALID, PM_ERR_PKG_OPEN, - PM_ERR_PKG_LOAD, - PM_ERR_PKG_CANT_FRESH, PM_ERR_PKG_CANT_REMOVE, PM_ERR_PKG_INVALID_NAME, PM_ERR_PKG_REPO_NOT_FOUND, /* Deltas */ PM_ERR_DLT_INVALID, PM_ERR_DLT_PATCHFAILED, - /* Groups */ - PM_ERR_GRP_NOT_FOUND, /* Dependencies */ PM_ERR_UNSATISFIED_DEPS, PM_ERR_CONFLICTING_DEPS, PM_ERR_FILE_CONFLICTS, /* Misc */ - PM_ERR_USER_ABORT, - PM_ERR_INTERNAL_ERROR, - PM_ERR_DB_SYNC, PM_ERR_RETRIEVE, PM_ERR_INVALID_REGEX, /* External library errors */ diff --git a/lib/libalpm/error.c b/lib/libalpm/error.c index 01dc758..47f0750 100644 --- a/lib/libalpm/error.c +++ b/lib/libalpm/error.c @@ -99,10 +99,6 @@ const char SYMEXPORT *alpm_strerror(int err) return _("transaction aborted"); case PM_ERR_TRANS_TYPE: return _("operation not compatible with the transaction type"); - case PM_ERR_TRANS_COMMITING: - return _("could not commit transaction"); - case PM_ERR_TRANS_DOWNLOADING: - return _("could not download all files"); /* Packages */ case PM_ERR_PKG_NOT_FOUND: return _("could not find or read package"); @@ -112,10 +108,6 @@ const char SYMEXPORT *alpm_strerror(int err) return _("invalid or corrupted package"); case PM_ERR_PKG_OPEN: return _("cannot open package file"); - case PM_ERR_PKG_LOAD: - return _("cannot load package data"); - case PM_ERR_PKG_CANT_FRESH: - return _("package not installed or lesser version"); case PM_ERR_PKG_CANT_REMOVE: return _("cannot remove all files for package"); case PM_ERR_PKG_INVALID_NAME: @@ -127,9 +119,6 @@ const char SYMEXPORT *alpm_strerror(int err) return _("invalid or corrupted delta"); case PM_ERR_DLT_PATCHFAILED: return _("delta patch failed"); - /* Groups */ - case PM_ERR_GRP_NOT_FOUND: - return _("group not found"); /* Dependencies */ case PM_ERR_UNSATISFIED_DEPS: return _("could not satisfy dependencies"); @@ -138,10 +127,8 @@ const char SYMEXPORT *alpm_strerror(int err) case PM_ERR_FILE_CONFLICTS: return _("conflicting files"); /* Miscellaenous */ - case PM_ERR_USER_ABORT: - return _("user aborted the operation"); - case PM_ERR_INTERNAL_ERROR: - return _("internal error"); + case PM_ERR_RETRIEVE: + return _("failed to retrieve some files"); case PM_ERR_INVALID_REGEX: return _("invalid regular expression"); /* Errors from external libraries- our own wrapper error */ -- 1.6.0.3
From 88c26a6e5902875f07ca7c842971619530fa5aa9 Mon Sep 17 00:00:00 2001 From: Nagy Gabor <ngaba@bibl.u-szeged.hu> Date: Sat, 18 Apr 2009 17:35:08 +0200 Subject: [PATCH] Remove unused error codes and handle PM_ERR_RETRIEVE by alpm_strerror()
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> ---
First I started to work on http://bbs.archlinux.org/viewtopic.php?id=70152 When the server list is empty, user gets "unexpected error". It turned out that pacman returns with PM_ERR_RETRIEVE in this case, which was not handled by alpm_strerror(). A nice error message should be nice here ("Empty server-list for extra\n"), I will provide a patch for that soon. But. I found a complete mess with error codes in dload.c: 1. download_external() doesn't set any error code in the "/* download failed */" case. 2. sync.c override these error codes (to PM_ERR_RETRIEVE), be_files.c and fetch_pkgurl() is not. 3. It is not clear why we have PM_ERR_RETRIEVE, PM_ERR_LIBFETCH, PM_ERR_EXTERNAL_DOWNLOAD. alpm_errorlast() translates PM_ERR_LIBFETCH into fetchLastErrString which is very ugly imho. I don't know too much about libfetch error messages, but expect "connection timed out", "foo.tar.gz was not found" etc. These should be printed via alpm_log(PM_LOG_ERROR,...) not by creating a variable meaning error code. (I am not even sure, that pm_errno = PM_ERR_LIBFETCH is always set correctly, ie. after libfetch error.) So my vote is to introduce one error code for "download error" (PM_ERR_RETRIEVE), and print out these special errors via alpm_log(), or maybe keep PM_ERR_EXTERNAL_DOWNLOAD, but reserved for "error invoking external downloader". The problem is that I am not sure I completely understand our download code. :-) Opinions? Bye ------------------------------------------------------ SZTE Egyetemi Konyvtar - http://www.bibl.u-szeged.hu This message was sent using IMP: http://horde.org/imp/
participants (1)
-
Nagy Gabor