[PATCH][BUG] BZR_PLUGIN_PATH='' loads from ~/.bzr.conf/plugins

Roncaglia Julien bazaar-ng at virtualblackfox.net
Thu Jun 30 21:14:33 BST 2005


Martin Pool said the following :
> And you can have the variable set to ""?  
> 
> Maybe it was just that some languages don't distinguish the two.  It's
> not important.

Yes it could be distinguished but not easily.
When an environement variable is set to "", the GetEnvironmentVariable
function returns something different than 0, but GetLastError return no
error. And when the variable really doesn't exists it returns
ERROR_ENVVAR_NOT_FOUND.

But it isn't really specified in MSDN, so if a library writer wrap it
without considering that...

Here is the ugly code in delphi that i made to test that :

var
  name, value : String;
begin
  SetLength(value, 255);
  if GetEnvironmentVariable(PChar('Test'), @value[1], Length(value)) = 0
then begin
    if GetLastError = ERROR_ENVVAR_NOT_FOUND then begin
      ShowMessage('notfound ok');
    end else begin
      ShowMessage('notfound bad');
    end;
  end else begin
    ShowMessage('notfound bad');
  end;

  SetEnvironmentVariable(PChar('Test'), Pchar(''));

  if GetEnvironmentVariable(PChar('Test'), @value[1], Length(value)) = 0
then begin
    ShowMessage('found ok but is "", if 0=' + IntToStr(GetLastError));
  end else begin
    ShowMessage('found ok');
  end;

end;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050630/9994837b/attachment.pgp 


More information about the bazaar mailing list