relative imports and duplicate includes
phk at phk.freebsd.dk
Tue Nov 17 11:16:26 CET 2015
In message <CABaBnj4AVVgkkc6d2fjdu8FTrxmWAGZDV7JcUdopsCSPK0_duA at mail.gmail.com>, Kacper Wysocki writes:
>attached is a patch to make 'import foo' relative to the importing source file,
We thought a lot about this originally, and the conclusion back
then was to not do it for reasons of predictability and security.
First: What is "relative to the importing source file" when you
load with vcl.inline ?
There are also a host of security/trust issues.
What if you include "foo", which comes from vcl_dir, and foo includes
Do you look for "bar" in the original "relative to the importing
source file" dir first or do you look only in vcl_dir ?
What if you include "/foo/bar/barf.vcl" and it includes "murphy.vcl"
which lives in vcl_dir, and murphy includes "heisenberg.vcl" ?
Where do you look for heisenberg.vcl ?
If we want to reopen this issue, I think the much more
predictable and sensible way to go about it is to turn
vcl_dir (and vmod_dir?) into lists of paths to search,
(just like $PATH).
>and a patch to remove the error upon duplicate 'include'.
You mean "import" right ?
What if one is:
and the other is:
import "foo" from /somewhere/libvmod_foo.so";
Isn't that a problem ?
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
More information about the varnish-dev