On Fri, Mar 28, 2014 at 9:16 AM, Stephan Beal <sgb...@googlemail.com> wrote:

> On Fri, Mar 28, 2014 at 2:04 PM, Michael Weise 
> <michael.we...@ek-team.de>wrote:
>
>> Can you give a hint (link) or background infomation on WHY the shell
>>  emits the gpg warning? What causes it?
>>
>
> because fossil internally uses system() to call gpg, but fossil itself
> does not know how to resolve the $PATH, so it does not check if gpg is
> available first.
>
...

> Reminder to self: once we prove that fsl_pathfinder works on Windows it
> might be interesting to port that in to fossil so that it can resolve the
> $PATH itself and skip signing if gpg isn't found.
>

No need to do that. The system functions execlp, execvp, etc. (_spawnlp,
_spawnvp, etc on MS Windows) already search the PATH environment variable
for the named executable. It is generally safer than using system() and is
more efficient. The downside is that you have supply the arguments
individually because you won't have the shell to split a command string
into arguments. You also won't have access to shell meta character
expansion nor other command line processing services.

FYI, for those who are curious, MS Windows also has the _exec family of
system functions, but lacks the fork() system function. To create a
subprocess under MS Windows, you use _spawn instead. Under Linux and other
Unix-like systems, you use fork and exec. The call to fork clones the
current process, returning the Process ID to the original ("parent")
process and 0 to the new ("child") process. the child process can then
either continue running as a clone of the parent or it can call exec to
"replace" the running program with another. Once started, the new loaded
program runs in the same process that called exec. Only failed calls to
exec ever return, in which case the variable errno will contain the ID of
the error that caused exec to fail.

Under MS Windows, _spawn works as if the child process immediately calls
exec, except no cloning of the original process is done. _spawn is called
exactly the same way _exec is called.
_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to