Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: emacs-24.3: test request

On Mon, Sep 09, 2013 at 08:48:02AM +0100, Matthias Scheler wrote:
> On Mon, Sep 09, 2013 at 12:20:07AM +0200, Rhialto wrote:
> > On Mon 09 Sep 2013 at 02:07:46 +0400, Valery Ushakov wrote:
> > > and I think it has to be reverted, since you can't do g/c if you don't
> > > know all roots.
> > 
> > On the other hand, is there any "official" documentation that says that
> > what emacs is doing is allowed?
> The exact behaviour of the environment vector is not very documented.
> And there are lot of implementations with various incorrect behaviours
> like putenv(3) on older version of NetBSD.
> If the garbage collection code causes problems it should be removed.

On a second thought I think that "emacs" is indeed broken. The scrubbing
of the environment is not the only problem it can trigger. If it sets
"environ" to its own array and calls e.g. setenv(3) it can also
trigger this case in "src/lib/libc/stdlib/_env.c" if the new environment
vector is full.

        /* Allocate a new environment array. */
        if (environ == allocated_environ) {
        } else {
                allocated_environ = NULL;
                allocated_environ_size = 0;

So by the time "emacs" restores the original pointer "libc" might have
freed the memory it points to.

"emacs" should be fixed.

        Kind regards

Matthias Scheler                        

Home | Main Index | Thread Index | Old Index