[Issue 3420] [PATCH] Allow string import of files using subdirectories

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 3 19:18:42 PST 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3420


Leandro Lucarella <llucax at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|1.042                       |1.006
           Severity|enhancement                 |regression


--- Comment #10 from Leandro Lucarella <llucax at gmail.com> 2009-12-03 19:18:41 PST ---
So, this is *really* a regression then, I'm sorry I changed the severity. But
are you sure it works in DMD 1.041? I tracked this down in the code and it was
introduced at DMD 1.006, when the -J option got implemented, so I can't see how
it could work in DMD 1.041:
http://www.dsource.org/projects/dmd/changeset/121
http://www.dsource.org/projects/dmd/changeset/121#file4 (expression.c)
http://www.dsource.org/projects/dmd/changeset/121#file11 (mars.c)
http://www.digitalmars.com/d/1.0/changelog.html#new1_006

Before that, you could use string imports in a very promiscuous way. The specs
are very brief about string imports and doesn't say anything about
restrictions:

  The AssignExpression must evaluate at compile time to a constant string. The
  text contents of the string are interpreted as a file name. The file is read,
  and the exact contents of the file become a string literal. 

So, the -J option seems to be an implementation-defined behavior, as such, I
guess it should be documented. For D1, I don't know if the specs should be
changed, but I guess the old behavior should work (the attached patch can be
used to allow secure string imports without prohibiting sub-directories
altogether).

I don't know if the compiler option shouldn't be documented too, it seems
pretty useless to make this an implementation defined behavior, you'll have to
stay always with the most restrictive implementation limitations if you want to
write code that can be used with any compiler, or avoid using this feature at
all.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list