You are not logged in.

#1 2014-08-13 13:33:30

cedricmc
Member
From: Madrid, Spain
Registered: 2011-11-20
Posts: 51

on circular/cyclic dependencies (freetype2/harfbuzz)

Ayo, archies!

I found a circular/cyclic dependency between freetype2 and harfbuzz. Although I have found other posts with circular dependency problems, they where tangent and weren't dealing with the subject per se. I was wondering, is this common? How does pacman deal with it? How can I detect myself an orphan circularly dependent package tree?

Thx, mates!

Note: a bit of story, I installed cups and stuff and my RPiB, "pacman -S cups cups-filters ghostscript gsfonts", which pulled 67!!! packages. Then I realized that for my needs it was enough with p910nd and decided to remove cups and stuff, "pacman -Rcnsu cups cups-filters ghostscript gsfonts", which only removed 63 of 67 installed packages. I found then that there were 4 packages, freetype2, graphite, harfbuzz and libpng, left as orphans because of the circular dependency.

Offline

#2 2015-02-17 11:51:57

cedricmc
Member
From: Madrid, Spain
Registered: 2011-11-20
Posts: 51

Re: on circular/cyclic dependencies (freetype2/harfbuzz)

*bump*

Offline

#3 2015-02-17 11:58:30

a821
Member
Registered: 2012-10-31
Posts: 381

Re: on circular/cyclic dependencies (freetype2/harfbuzz)

Not sure whether this is a bug or a feature, but the PKGBUILD of freetype says.

# adding harfbuzz for improved OpenType features auto-hinting 
# introduces a cycle dep to harfbuzz depending on freetype wanted by upstream

https://projects.archlinux.org/svntogit … /freetype2

Offline

#4 2015-02-17 14:32:31

cedricmc
Member
From: Madrid, Spain
Registered: 2011-11-20
Posts: 51

Re: on circular/cyclic dependencies (freetype2/harfbuzz)

Hi, thanks for your answer. But am I not so much interested in if the circular dependency of freetype2<->harfbuzz is well known, documented or wanted, but I am more intrigued by the question: 

cedricmc wrote:

How can I detect myself an orphan circularly dependent package tree?

Like the one given by freetype2<->harfbuzz, which are dependent one on each other, but independent of the rest of the system tree.

The scenario case (of a possible bug) would be:
1.- Install a base system (from scratch).
2.- Run "pacman -S cups cups-filters ghostscript gsfonts"
3.- Run "pacman -Rcs cups cups-filters ghostscript gsfonts"

Expected:
You have returned to point 1.

What actually happens:
You have the base system from point 1 plus 4 packages pulled as dependencies from point 2 that have not been deleted in point 3. Each one of this packages is not an orphan because it depends on another, but the cycle itself is orphan because it has no dependency with respect to the system tree.

I hope to have made myself clear this time.

Last edited by cedricmc (2015-02-17 14:32:46)

Offline

#5 2015-02-18 00:12:43

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,399
Website

Re: on circular/cyclic dependencies (freetype2/harfbuzz)

You can't...   that is a known pacman limitation.   There is probably a bug report somewhere!

Offline

#6 2015-02-18 02:40:21

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,541
Website

Re: on circular/cyclic dependencies (freetype2/harfbuzz)

So in other words: Allan broke it.  But even though you can't do this with pacman, I can imagine a decently written script could handle this quite well.  A script could detect any group of packages that are installed only to satisfy dependencies of other members of that group and (this and is important) there are no explicitly installed packages that dependend on any members of the group.

EDIT: My first pass clearly didn't produce a "decently written script" ... It ate my cpu for a good several minutes before I killed it.  That'll teach me: no scripting right after coming home from the bar, but it's been a few minutes now - I can try again.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#7 2015-02-18 02:52:53

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,399
Website

Re: on circular/cyclic dependencies (freetype2/harfbuzz)

I didn't break it...  It never worked!

Offline

#8 2015-02-18 03:05:20

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,541
Website

Re: on circular/cyclic dependencies (freetype2/harfbuzz)

Alright, this still takes a few seconds to run, but it may work.  I don't think I have any of these (orphaned) dependency cycles as I aggressively -Rsn anything that I don't recognize (sometimes leading to a need to have a live USB around).  So I can't see if this will hit on what it should, some testing would be in order:

#!/bin/bash

circlers=()
for pkg in $(pacman -Qdq); do
	expac %w $(pactree -rl $pkg) | grep -q "explicit" || circlers+=( $pkg )
done
echo CIRCLE: ${circlers[@]}

This requires expac as written.  That line could be replaced with a pacman -Qi and a more complicated grep match if expac is undesirable.  But I suspect if expac is undesirable, you probably haven't really learned what it can do.

The logic is that for every package installed as a dependency, if it doesn't have at least one explicitly install package in its reverse pactree output, then it should be considered an orphan.

EDIT: oops, patched up per the below comment.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#9 2015-02-18 04:26:22

apg
Developer
Registered: 2012-11-10
Posts: 211

Re: on circular/cyclic dependencies (freetype2/harfbuzz)

Trilby wrote:

Alright, this still takes a few seconds to run, but it may work.  I don't think I have any of these (orphaned) dependency cycles as I aggressively -Rsn anything that I don't recognize (sometimes leading to a need to have a live USB around).  So I can't see if this will hit on what it should, some testing would be in order:

#!/bin/bash

circlers=()
for pkg in $(pacman -Qdq); do
	expac +w $(pactree -rl $pkg) | grep -q "explicit" && circlers+=( $pkg )
done
echo CIRCLE: ${circlers[@]}

This requires expac as written.  That line could be replaced with a pacman -Qi and a more complicated grep match if expac is undesirable.  But I suspect if expac is undesirable, you probably haven't really learned what it can do.

The logic is that for every package installed as a dependency, if it doesn't have at least one explicitly install package in its reverse pactree output, then it should be considered an orphan.

That is broken.  '+w' should be '%w' and '&&' should be '||'.  Or, without expac:

for pkg in $(pacman -Qqd); do [[ -z $(comm -12 <(pactree -r $pkg -u | sort) <(pacman -Qqe | sort)) ]] && echo $pkg; done

Offline

#10 2015-02-18 15:37:30

cedricmc
Member
From: Madrid, Spain
Registered: 2011-11-20
Posts: 51

Re: on circular/cyclic dependencies (freetype2/harfbuzz)

I'm happy to see that I succeed to lure some mods and devs to the conversation.

Allan wrote:

You can't...   that is a known pacman limitation.   There is probably a bug report somewhere!

Thx for the short, clear and direct answer.

Trilby wrote:

The logic is that for every package installed as a dependency, if it doesn't have at least one explicitly install package in its reverse pactree output, then it should be considered an orphan.

Nice! Sounds a good idea, I must try it out.

Offline

Board footer

Powered by FluxBB