Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
What is --backtrack
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
josephg
l33t
l33t


Joined: 10 Jan 2016
Posts: 783
Location: usually offline

PostPosted: Tue Apr 18, 2017 12:49 am    Post subject: What is --backtrack Reply with quote

on a recent issue i raised on this forum, --backtrack=30 was recommended to me, and it resolved my problem by recompiling fifty-six packages instead of the initial two.

i have never needed to use --backtrack before. i can't seem to find much information, apart from one sentence in the man page which i don't completely understand.
Code:
$ man emerge

       --backtrack=COUNT
              Specifies an integer number of times to backtrack if dependency calculation fails due to a conflict or an unsatisfied dependency (default: ´3´).


can anyone explain what --backtrack does?
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6335
Location: /usr/lib64/lv2

PostPosted: Tue Apr 18, 2017 2:07 am    Post subject: Reply with quote

It backtracks through the dependency tree to the level specified by the provided integer. When I do my monthly world updates, I use an insane number like 1000 to make sure nothing is missing or broken.
_________________
Gentoo Studio: A Gentoo-based, professional digital audio workstation OS.
Back to top
View user's profile Send private message
josephg
l33t
l33t


Joined: 10 Jan 2016
Posts: 783
Location: usually offline

PostPosted: Tue Apr 18, 2017 7:47 am    Post subject: Reply with quote

audiodef wrote:
When I do my monthly world updates, I use an insane number like 1000 to make sure nothing is missing or broken.

i do my world updates almost daily, and have not done any other updates at all. i find that if i leave too long a gap, sometimes i end up in situations i don't completely understand.

if something is missing or broken, wouldn't it show up without any backtrack? i have never before used it. is this something i should be using more regularly.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 45794
Location: 56N 3W

PostPosted: Tue Apr 18, 2017 8:36 am    Post subject: Reply with quote

josephg,

When dependency resolution comes to dead end, portage has two choices
[*]tell you it failed and provide a sometimes less than helpful error message
[*]go back some branches in the dependency tree and look for a different route

The default is --backtrack=3. The higher the setting, the further back in the dependency tree portage is allowed to go to try to find a solution.
Notice the 'allowed to go'.
If the default --backtrack=3 would of worked --backtrack=30 should produce the same solution in the same amount of time. (I've not tested that)
When --backtrack=3 fails and --backtrack=30 works, portage has gone back more that three levels in the dependency tree to reach a solution but you don't know how far, maybe only 4?

The downside to large --backtrack= settings is that it takes longer to get to the error message when there is no solution to the dependency graph.

Testing --backtrack= for 0,1 and 2 is left as an exercise to the reader.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
josephg
l33t
l33t


Joined: 10 Jan 2016
Posts: 783
Location: usually offline

PostPosted: Tue Apr 18, 2017 9:08 am    Post subject: Reply with quote

NeddySeagoon wrote:
If the default --backtrack=3 would of worked --backtrack=30 should produce the same solution in the same amount of time. (I've not tested that)

so i guess backtrack is incremental. if it takes the same time amount of time, why would it matter to me whether i use --backtrack=3 or --backtrack=30?

NeddySeagoon wrote:
When --backtrack=3 fails and --backtrack=30 works, portage has gone back more that three levels in the dependency tree to reach a solution but you don't know how far, maybe only 4?

what can i infer from --backtrack=4 reaches a solution vs --backtrack=30?

NeddySeagoon wrote:
Testing --backtrack= for 0,1 and 2 is left as an exercise to the reader.

i tested with 0, 1, 2, 30, 1000, and all produce the same output.
Code:
Nothing to merge; quitting.

i suppose i should defer this testing for another time, perhaps till conflicts arise again.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 45794
Location: 56N 3W

PostPosted: Tue Apr 18, 2017 10:49 am    Post subject: Reply with quote

josephg,

The difference should only be apparent when the default --backtrack=3 results in a conflict error message and --backtrack>3 finds a solution.
If backtrack=0 works, portage got it right first time and no backtracking was required.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
kornhs4
Tux's lil' helper
Tux's lil' helper


Joined: 27 Jun 2004
Posts: 86
Location: Austria

PostPosted: Sun Mar 29, 2020 5:30 pm    Post subject: Reply with quote

The difference is the following: Assume there is actually no solution to your current set of package dependencies. If you set --backtrack=N for a very high N then you force it to look for it, minutes, hours, years, for the age of the universe, until it finds that there is no solution. (The computational problem considered here is NP hard, so the age of the universe is no exaggeration.)

Instead you may want to leave N at its default (which is 10 according to `man emerge` here). Then it tells you after some "reasonable" amount of time that it could not fulfill your wishes and tells you about the conflict. (Which is often not easy to read for a human.) Anyhow, you as a human may (or may not) easily see what the "real" problem is as a package is mentioned that is now hard masked you do not care about anymore, so uninstall it. And suddenly all works out very quickly.
_________________
_________________
Life would be easier
if i had the source code
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum