Refrain from using PGPASSWORD for pg_basebackup connection.
Using the environment variable allows to omit the replication password from the logs, though messes with next connection attempts. We should either call unsetenv() once the pg_basebackup command has finished, or use the password on the connection string.
In this tentative PR we use the password in the connection string.
Should fix #766.
Given my reading of the code I believe you've spotted a real problem with this attempt:
args[argsIndex++] = primaryConnInfo;
...
/* log the exact command line we're using */
int commandSize = snprintf_program_command_line(&program, command, BUFSIZE);
Making it so that we don't include the password in the logs is going to require too much fiddling around, I suppose I should work on using unsetenv instead.
I just pushed a better version of this fix, using unsetenv, or setenv again to the previous value of the PGPASSWORD environment variable if it happened to be already set before. Might be useful...