[pacman-dev] [PATCH] Consistently add leading slash for the output of files operations

Andrew Gregory andrew.gregory.8 at gmail.com
Sat Oct 17 15:06:49 UTC 2015


On 10/17/15 at 07:50pm, Allan McRae wrote:
> Signed-off-by: Allan McRae <allan at archlinux.org>
> ---
>  src/pacman/files.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Surely, if anything, we should be adding handle->root, not just a raw
slash.  I'm not sure it makes sense to do that for sync packages
though.  All of our path handling for local packages uses absolute
paths because we're referring to actual objects on the filesystem.
`pacman -Qo` doesn't even allow paths that don't actually exist.  Sync
packages, on the other hand, are just a list of strings in a database
with no correlation to the filesystem.  I'm not sure something like
`pacman -Fo /foo/bar` even makes sense, and `pacman --root=/baz -Fo
/foo/bar` and `pacman --root=/baz -Fo /baz/foo/bar` make even less.

I would say to just treat sync file lists as raw strings and forget
that they represent paths at all.

apg

> diff --git a/src/pacman/files.c b/src/pacman/files.c
> index ceec342..feda75d 100644
> --- a/src/pacman/files.c
> +++ b/src/pacman/files.c
> @@ -61,7 +61,7 @@ static int files_fileowner(alpm_list_t *syncs, alpm_list_t *targets) {
>  				if(alpm_filelist_contains(files, f)) {
>  
>  					if(!config->quiet) {
> -						printf(_("%s is owned by %s/%s %s\n"), filename,
> +						printf(_("/%s is owned by %s/%s %s\n"), f,
>  								alpm_db_get_name(repo), alpm_pkg_get_name(pkg),
>  								alpm_pkg_get_version(pkg));
>  					} else {
> @@ -147,7 +147,7 @@ static int files_search(alpm_list_t *syncs, alpm_list_t *targets, int regex) {
>  
>  						for(ml = match; ml; ml = alpm_list_next(ml)) {
>  							c = ml->data;
> -							printf("    %s\n", c);
> +							printf("    /%s\n", c);
>  						}
>  						FREELIST(match);
>  					}
> -- 
> 2.6.1


More information about the pacman-dev mailing list