[fpc-devel] TProcess empty parameter

Alfred alfred at consulab.nl
Sat May 2 21:08:17 CEST 2015


Hello to all.

While working on fpcup, I did encounter the following problem.

Fpcup has modules that implement automatic download and install of 
packages.
One of these modules is indy.

Indy has a svn server that needs a username. No password is needed.
However, if a username is given to a command line svn client, this 
svn-client wants to have a password too.
This password has to be empty.

Fpcup uses TProcess to execute commands.
But it seems that TProcess cannot handle empty parameters correctly (on 
Linux).

It processes the parameters, including the empty password, by generating 
a list of (p)pchar strings.
It uses strnew to accomplish this.
But strnew returns nil for an empty string (Delphi does not return nil 
in this case).

My question:

Is this expected behavior of TProcess ?
Or should TProcess be changed.
Or strnew (and strpas) ?

Thanks.

Additional info
Sourcefile : process.inc, inside fpc\packages\fcl-process\src\unix :
Function StringsToPCharList(List : TStrings) : PPChar;
Var
   I : Integer;
   S : String;
begin
   I:=(List.Count)+1;
   GetMem(Result,I*sizeOf(PChar));
   PPCharArray(Result)^[List.Count]:=Nil;
   For I:=0 to List.Count-1 do
   begin
     S:=List[i];
     Result[i]:=StrNew(PChar(S)); <--------------------------- here
   end;
end;




More information about the fpc-devel mailing list