[ask] how packagefs work

Dear all

i have confusion about haiku packagefs working… i have questions.

  1. if i have 2 package that have same file name lets say a.conf in both package
    what file that will be use by haiku when both package installed?
  2. if both package have same folder there let say /data/foo and contain different file there
    how haiku handle this?
    thanks

If two packages have the same file, only one of them will be visible, and it’s unpredictable to say which one. So, the best advice is “don’t do this”. However, you can manually blacklist a file from a package and then install the other one, if you really need to (we would prefer that you complain to the people making the package you want to replace files from to split their package to make things more modular, however).

If two packages have the same directory, the content and attributes of the directory are merged together to form a directory containing files and attributes from both packages.

2 Likes

First one take the place?

I would think that the never installed one remove the old one (update pricipe)

The problem is deciding what “first” is. Sorting the packages in any particular order other than “whichever order we find them on disk” has a performance cost and makes the code a little more complex, so if the only use for that is the unlikely case of two packages providing the same file, we probably should not worry too much about it.

2 Likes

thanks for clarify…

before i think packagefs behave like unionfs… (like slax, porteus linux etc)

No, actually it is very predictable, I made some changes to fix a related bug here before R1/beta1:

  • items from system packages (i.e. haiku.hpkg and related items) take precedence over non-system packages
  • directories (NOT files) with more extended-attributes take precedence over directories with less
  • files with newer timestamps take precedence over files with older timestamps.

But indeed, blacklisting is much more reliable than remembering this list.

1 Like

thanks @waddlesplash for your valuable information