[pacman-dev] [PATCH] src/pacman: strip any leading / in --overwrite arguments

Eli Schwartz eschwartz at archlinux.org
Fri Jun 1 11:38:44 UTC 2018


On 06/01/2018 05:50 AM, Joey Pabalinas wrote:
> Allow both `pacman -S foo --overwrite /usr/lib/foo.sh` and
> `pacman -S foo --overwrite usr/lib/foo.sh` (with any number
> of leading / ignored) to semantically mean the same thing.

Already done in
https://lists.archlinux.org/pipermail/pacman-dev/2018-May/022515.html

> Signed-off-by: Joey Pabalinas <joeypabalinas at gmail.com>

> @@ -317,10 +317,12 @@ static void invalid_opt(int used, const char *opt1, const char *opt2)
>  static int parsearg_util_addlist(alpm_list_t **list)
>  {
>  	char *i, *save = NULL;
>  
>  	for(i = strtok_r(optarg, ",", &save); i; i = strtok_r(NULL, ",", &save)) {
> +		/* strip any leading slashes */
> +		i += strspn(i, "/");
>  		*list = alpm_list_add(*list, strdup(i));
>  	}
>  
>  	return 0;
>  }

This function is used in several places, where it refers to package
names or groups. I would expect --ignore=/foo to not work, rather than
be replaced by "foo". We should not be modifying this function for every
use...

-- 
Eli Schwartz
Bug Wrangler and Trusted User

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/pacman-dev/attachments/20180601/53103a08/attachment.asc>


More information about the pacman-dev mailing list