canonical / core18

The core18 base snap
14 stars 26 forks source link

hooks: improve /etc/alternatives unwinding #64

Closed mvo5 closed 6 years ago

mvo5 commented 6 years ago

The previous approach of unwinding alternatives had the problem that e.g. /usr/bin/pager -> /etc/alternatives/pager -> /bin/more would end up with a "/bin/pager".

This PR fixes this bug. It also splits the alternatives finding into its own hook script.

One unrelated fix (DEBIAN_FRONTEND).

mvo5 commented 6 years ago

@sil2100 Thanks for the review! About the reason why: yes, its a bit hypothetical, the issue is that we mount the users /etc into the snap runtime. So the snap sees "/bin,/usr/bin" from the core snap but "/etc" from the users system. Now if the user has an alternative that that is not on the core snap (say editor points to vim) then the symlink will be broken because it is the /usr/bin from the core snap that is visible inside the snap which does not have /usr/bin/vim. In practise this is not much of a problem but still worth (IMO) cleaning up. Its also one more step on the way towards an empty /etc :)

sil2100 commented 6 years ago

Aaah! Makes even more sense now. Thanks!