The following bug is present in autogen 5.8.4; I have not verified its
existence in the cvs trunk.  My apologies if it is already known /
fixed.

Suppose I type:

    autogen -L build_env -b bin/one-emul.mk build_env/one-emul.def

then I will see:

    fserr 13: cannot create /one-emul.mk:  Permission denied
    AutoGen aborting on signal 11 (Segmentation fault) in state ABORTING

when autogen tries to create /one-emul.mk.

Yes, it tries to create the file in the root directory.

The bug is in openOutFile (in tpProcess.c) -- the memcpy copies from
the last / onwards.  Ooops.  I believe that a proper fix is to either
replace:

        if (pS == NULL)
            pS = pzDefFile;

with
        if (pS == NULL)
            pS = pzDefFile;
        else
            pS++;

and document that if you provide a base name, then everything up to
and including the final slash will be stripped.  Or *BETTER*, not
change the documentation and instead replace:

        if (pE != NULL) {
            memcpy( z, pS, pE - pS );
            z[ pE - pS ] = NUL;
            pS = z;
        }

with

        if (pE != NULL) {
            memcpy( z, pzDefFile, pE - pzDefFile );
            z[ pE - pzDefFile ] = NUL;
            pS = z;
        } else
            pS = pzDefFile;

Take care,

David




_______________________________________________
Bug-autogen mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-autogen

Reply via email to