Pascal J. Bourguignon | 26 Mar 18:12 2012
X-Face
Face

run-program :environment nil


(lisp-implementation-version) --> "1.0.1"

The documentation of extensions:run-program is misleading:

    :environment 
        An alist of STRINGs (name . value) describing the new
        environment. The default is to copy the environment of the current
        process.

The alist doesn't describe the NEW environment, it is only MERGED into
the current environment.

Now of course, I consider the current behavior to be a bug:

    (text-stream-contents (extensions:process-output
                           (extensions:run-program "env" '()
                                                   :wait t :environment 'nil)))
    --> ("NNTPSERVER=news.individual.net" "ESHELL=/bin/bash"  …)

I would expect:

    (text-stream-contents (extensions:process-output
                           (extensions:run-program "env" '()
                                                   :wait t :environment 'nil)))
    --> ()

and:

    (text-stream-contents (extensions:process-output
(Continue reading)

Mark Evenson | 27 Mar 14:26 2012
Picon

Re: [armedbear-devel] run-program :environment nil


On Mar 26, 2012, at 6:12 PM, Pascal J. Bourguignon wrote:

> 
> (lisp-implementation-version) --> "1.0.1"
> 
> 
> The documentation of extensions:run-program is misleading:
> 
>    :environment 
>        An alist of STRINGs (name . value) describing the new
>        environment. The default is to copy the environment of the current
>        process.
> 
> The alist doesn't describe the NEW environment, it is only MERGED into
> the current environment.

[…]

Which behavior would you prefer?

We certainly have imprecise documentation here.  The merged environment
behavior what is easiest with the underlying JVM API which is based
on the notion of UNIX exec().  In practice, I would venture that
that most people would expect the merged behavior, as it is the
common pattern for such wrappers around UNIX execv() and friends
which have to copy the environment anyways at an operating system
level before it replaces it with the new code.  (Ok, since every
contemporary OS probably has "copy-on-write" semantics here, I'll
stop making OS-dependent statements of doubtful utility).
(Continue reading)


Gmane