[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Relative imports.
From: |
Thomas Bellman |
Subject: |
Re: Relative imports. |
Date: |
Wed, 10 Sep 2003 10:28:14 +0000 (UTC) |
User-agent: |
nn/6.6.3 |
Shawn Ferry <sferry@sevenspace.com> writes:
> Relative paths depend on the executing programs idea of it's current
> working directory.
Except that is *not* what Hans wants. He wants imports to
be relative to the currently parsed file, just like the C
preprocessor handles #include:
$ pwd
/home/bellman
$ cat /tmp/trh/foo.h
This is foo.h
#include "bar/bar.h"
Back to foo.h
$ cat /tmp/trh/bar/bar.h
And here we are in bar.h.
$ cat bar/bar.h
This is a malicious bar.h!
$ gcc -E /tmp/trh/foo.h
# 1 "/tmp/trh/foo.h"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "/tmp/trh/foo.h"
This is foo.h
# 1 "/tmp/trh/bar/bar.h" 1
And here we are in bar.h.
# 3 "/tmp/trh/foo.h" 2
Back to foo.h
Note which of the "bar/bar.h" files is included. I don't see any
security problem with this. Are there any?
--
Thomas Bellman, Lysator Computer Club, Linköping University, Sweden
"The one who says it cannot be done should ! bellman @ lysator.liu.se
never interrupt the one who is doing it." ! Make Love -- Nicht Wahr!