[pacman-dev] [PATCH] Print relevant information about file conflicts or corrupted packages to stderr instead of stdout.
Allan McRae
allan at archlinux.org
Wed Jun 2 23:47:48 UTC 2021
On 3/6/21 1:29 am, Oskar Roesler (bionade24) via pacman-dev wrote:
> Signed-off-by: Oskar Roesler (bionade24) <o.roesler at oscloud.info>
> ---
> lib/libalpm/conflict.c | 4 ++--
> src/pacman/sync.c | 8 ++++----
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
> index b471bf21..56d24a37 100644
> --- a/lib/libalpm/conflict.c
> +++ b/lib/libalpm/conflict.c
> @@ -456,10 +456,10 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
> * conflicts as the path from p1 is returned */
> if(_alpm_can_overwrite_file(handle, filename, path)
> && alpm_filelist_contains(p2_files, filename)) {
> - _alpm_log(handle, ALPM_LOG_DEBUG,
> + _alpm_log(handle, ALPM_LOG_ERROR,
> "%s exists in both '%s' and '%s'\n", filename,
> p1->name, p2->name);
> - _alpm_log(handle, ALPM_LOG_DEBUG,
> + _alpm_log(handle, ALPM_LOG_ERROR,
> "file-file conflict being forced\n");
> continue;
> }'
These should not be changed. They are only printed with --debug.
> diff --git a/src/pacman/sync.c b/src/pacman/sync.c
> index b6da1a36..b0507d84 100644
> --- a/src/pacman/sync.c
> +++ b/src/pacman/sync.c
> @@ -836,15 +836,15 @@ int sync_prepare_execute(void)
> alpm_fileconflict_t *conflict = i->data;
> switch(conflict->type) {
> case ALPM_FILECONFLICT_TARGET:
> - printf(_("%s exists in both '%s' and '%s'\n"),
> + pm_printf(ALPM_LOG_ERROR, _("%s exists in both '%s' and '%s'\n"),
This adds "error: " to the start of the message, which is not needed as
this is the clarification of the error.
Use "fprintf(stderr, _(...))" instead.
> conflict->file, conflict->target, conflict->ctarget);
> break;
> case ALPM_FILECONFLICT_FILESYSTEM:
> if(conflict->ctarget[0]) {
> - printf(_("%s: %s exists in filesystem (owned by %s)\n"),
> + pm_printf(ALPM_LOG_ERROR, _("%s: %s exists in filesystem (owned by %s)\n"),
> conflict->target, conflict->file, conflict->ctarget);
> } else {
> - printf(_("%s: %s exists in filesystem\n"),
> + pm_printf(ALPM_LOG_ERROR, _("%s: %s exists in filesystem\n"),
> conflict->target, conflict->file);
> }
> break;
> @@ -857,7 +857,7 @@ int sync_prepare_execute(void)
> case ALPM_ERR_PKG_INVALID_SIG:
> for(i = data; i; i = alpm_list_next(i)) {
> char *filename = i->data;
> - printf(_("%s is invalid or corrupted\n"), filename);
> + pm_printf(ALPM_LOG_ERROR, _("%s is invalid or corrupted\n"), filename);
> free(filename);
> }
> break;
>
More information about the pacman-dev
mailing list