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

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



> I don't want to even think of trying to quote cmdlin

Its not too difficult. But i'm not sure wether its nessesary, only tos programs are started this way, and those most likely will honor $ARGV, so it might be easier to just use ARGV aways.

> toswin should always use ARGV when it's in the environment.
> Is there a reason to not do that?

Its not in the environment of TOSWIN, because the arguments are not from the program start if toswin was already runnning, they are read from a shared memory area.


Helmut Karlowski <helmut.karlowski@ish.de> schrieb am 22:46 Dienstag, 9.Februar 2016:


Am 09.02.2016, 12:48 Uhr, schrieb Thorsten Otto:

> I still would like to see it being fixed. In my case i can only do that

Yes - me too!

>> Using ARGV should not produce any white-space-problems (I added them to
>> the arguments in the caller).
> It does not matter what method is used. The arguments are passed to 
> tw-call, which writes them to a shared memory area, then tells toswin to 
> fetch them. It is toswin which is building a new commandline from this 
> to execute the actual program, and there the arguments are not quoted 
> when they fit in the 126 byte limit.

That's right: a short command-line will be split by white-space by toswin, 
even when ARGV= is present. I don't know why toswin does that.

I guess it happens in environ.c:

  len = strlen(arg);
  if (len > 124)
  {
    put_env(new, ARGVprefix, "");

...

  else
  {
    for (k = 0; k < len; k++)
      if (arg[k] == '\n')
        arg[k] = ' ';
  }

The \n is added by tw-call:

        for (i = 3; i < argc; i++)
        {
          strcat(blk->arg, "\n");  /* LF als Trenner, damit ' ' nicht 
geklammert werden m<81>ssen!


I can't say I like this and don't know any clean solution without changing 
toswin. I don't want to even think of trying to quote cmdlin, and leave 
ARGV= unquoted, or similar. That would suck IMHO.

toswin should always use ARGV when it's in the environment.
Is there a reason to not do that?


-Helmut