padding in arguments string array for popen2 or exec

Olaf Till olaf.till at uni-jena.de
Mon Mar 2 05:50:06 CST 2009


On Mon, Mar 02, 2009 at 12:27:05PM +0100, Jaroslav Hajek wrote:
>> ... 
> Sorry I can't inspect octave 2.1.72 sources, but what you see is the
> consequence of char padding by spaces when creating character
> matrices. I don't think all_strings can just discard the any trailing
> whitespaces. That would carry the potential hazard of discarding
> something that was real data. I suggest you just use cell arrays
> instead, which save you from this kind of trouble.
> 
> regards

Yes, I just noticed that using cell-arrays is possible.

BTW I did not know whether whitespace is really introduced at
creation-time of string-arrays. This would mean that trailing
whitespace indeed had been discarded in 2.1.73.

Anyway, using cell-arrays should be fine, but maybe string-arrays
should not be accepted then any more by popen2 or exec, since they do
not work, and the documentation changed.

Olaf


More information about the Bug-octave mailing list