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

Re: [MiNT] XaAES: bug(s) in shel_write()



Am 05.02.2016, 03:04 Uhr, schrieb Thorsten Otto:

What is SHD_ENVIRON? I've found
Its the same as SW_ENVIRON. I took the name from the XaAES sources (the ones that are part of MiNT).

What exactly did you write in ARGV?
The arguments that should be passed to the program of course, including the command name. That part works,

Actually I don't think it matters what you put in ARGV.

What do you mean with:

i even verified it again when that bug first appeared.

What XaAES-version does what you want?

Looks like that is not supported by XaAES.
The code look like it tries to do so, but fails to do it correctly. If

Where does XaAES parse the ARGV-part of the caller's environment if you meant that.

the original arguments are too long to be passed in the basepage, and this fact is mentioned as 127 being used as length, the function should either fail with an error indicating that this is not supported, or support it correctly. It does not make sense to pass wrong, truncated arguments to the program instead, this can be rather disastrous. BTW XaAES does indicate in appl_getinfo(10) that ARGV *is* supported.

I tried with a test-program and it indeed truncated the command-line to 124 bytes.

When I remove:

      if (longtail > 124)
        longtail = 124;

all arguments are passed to the launched program. That looks wrong.

Only if SW_ENVIRON is set.
But this is the only way to pass the environment in the call that contains the ARGV element. The application itself does not create a new process where this could be done, nor does XaAES has access to the process' environment.

I guess the purpose SW_ENVIRON is to pass the caller's environment to the callee's without interfering of the AES. You don't need it I think. The meaning of "use ARGV" on the other hand is that the AES writes the command-line into the environment for the callee, not that it reads it from there.

Do you have a simple test-case?
Not really. It has to be a complete GEM program after all. I can try to make one if it is really needed. But i hope my explanations made clear that something is going wrong there. Not using the environment that was constructed by make_argv() is at least definitely a bug. And that code

I uses it:

       ret = create_process(cmd, t,
                 (x_mode & SW_ENVIRON) ? x_shell.env : *strings,
                 &p, 0, cpopts.mode ? &cpopts : NULL);

strings is written in make_argv().

I have attached my test-programs. Is it this what you mean?

-Helmut

Attachment: callee.c
Description: Binary data

Attachment: caller.c
Description: Binary data