I have a scenario which I would expect viewpath to be useful for, but where it does not in practice appear to be applicable as presently implemented.
A user wishes to install some software which, while installable with that user's privileges alone, insists on /etc/hosts having no IPv6 contents. I would hope that viewpath could be used to show the user /home/someuser/etc/hosts when /etc/hosts is requested.
However, because the first directory is used as both the mount point and the preferred source location, this is not presently possible.
I propose more useful semantics:
viewpath target rwdir rodir1 [rodir2] ...
such that the following would be possible:
viewpath /etc /home/someuser/etc /etc
The attached patch implements this (and updates the man page and unit tests appropriately).
The unit tests do not complete on my system without the patch; they fail at the same point with it applied.