pactree: Fix vertical limbs for --optional

Message ID 20200804140948.9539-1-jakseb.dev@gmail.com
State New
Headers show
Series
  • pactree: Fix vertical limbs for --optional
Related show

Commit Message

Sebastian Jakubiak Aug. 4, 2020, 2:09 p.m. UTC
When pactree was run with -o/--optional turned on, limbs were sometimes
not properly cut off for the last children of packages that had no
optional dependencies. Example:

    $ pactree -a -d2 -o libluv
    libluv
    |-luajit
    | `-gcc-libs
    `-libuv
    | |-glibc
    | `-libnsl

Signed-off-by: Sebastian Jakubiak <jakseb.dev@gmail.com>
---
 src/pactree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniel M. Capella Sept. 2, 2020, 7:39 p.m. UTC | #1
On Tue Aug 4, 2020 at 10:09 AM EDT, Sebastian Jakubiak wrote:
> When pactree was run with -o/--optional turned on, limbs were sometimes
> not properly cut off for the last children of packages that had no
> optional dependencies. Example:
>
> $ pactree -a -d2 -o libluv
> libluv
> |-luajit
> | `-gcc-libs
> `-libuv
> | |-glibc
> | `-libnsl
>
> Signed-off-by: Sebastian Jakubiak <jakseb.dev@gmail.com>
> ---
> src/pactree.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/pactree.c b/src/pactree.c
> index e34ecc8..cf05519 100644
> --- a/src/pactree.c
> +++ b/src/pactree.c
> @@ -540,7 +540,7 @@ static void print_dep_list(alpm_list_t *deps,
> alpm_list_t *dblist, alpm_pkg_t *p
> };
> depth->next = &d;
> /* last dep, cut off the limb here */
> - if((last && optional && opt_dep) || (last && !optional)) {
> + if(last) {
> if(depth->prev) {
> depth->prev->next = &d;
> d.prev = depth->prev;
> --
> 2.27.0

Merged, thanks!

--
Best,
Daniel <https://danielcapella.com>

Patch

diff --git a/src/pactree.c b/src/pactree.c
index e34ecc8..cf05519 100644
--- a/src/pactree.c
+++ b/src/pactree.c
@@ -540,7 +540,7 @@  static void print_dep_list(alpm_list_t *deps, alpm_list_t *dblist, alpm_pkg_t *p
 				};
 				depth->next = &d;
 				/* last dep, cut off the limb here */
-				if((last && optional && opt_dep) || (last && !optional)) {
+				if(last) {
 					if(depth->prev) {
 						depth->prev->next = &d;
 						d.prev = depth->prev;