Re: Patch for relative paths
David Hakim <dhakim-Gkm/TONP9n1Wk0Htik3J/[email protected]> Mon, 28 Apr 2003 20:52:26 -0400
| Newsgroups | gmane.comp.lang.moto.devel |
|---|---|
| Message-ID | <[email protected]> |
On Friday, April 25, 2003, at 12:27 PM, Stefano Corsi wrote: >> I haven't tried the patch just yet but I have questions about the >> logic >> >> >> env->meta.filename = moto_strdup(env, filename + strlen(getcwd(cwd, >> 255)) + 1); >> >> How would this work in the case where someone includes (or readdefs) a >> file from the parent directory with an error in it ? > > Eh eh. Forgive me. It was a lazy speedy mess. > > Uhm... anyway. I think that we must store somewhere the relative path > before > it gets modified by realpath(). I have tried in struct MetaInfo by > adding a > char * filename_rel field to the struct, but there must be some > assumption on > the MetaInfo struct size, because I get lot of memory errors. > I think the above strategy is probably the right one (although we might want to name the field orig_filename or something like that since we want it to represent exactly the path that was #included or #readdeffed in the moto file itself ... I think :) ). My guess is the memory leaks came from the filename_rel field contents not being tracked. You can probably use motopp_strdup to accomplish this. If you were getting memory corruption errors you may need to re-build the entire moto directory. There are a couple structures in the parser that do have nested MetaInfo structures. -Dave > Stefano >