attached is take-2 of a patch which fixes a bug related to the use of getpwuid when running in standalone mode. this patch allocates some persistent storage (using strdup) to store the username obtained with getpwuid in src/backend/main/main.c.  this is necessary because later on, getpwuid is called again (in ValidateBinary).
attached is take-2 of a patch which fixes a bug related
to the use of getpwuid when running in standalone mode.
this patch allocates some persistent storage (using
strdup) to store the username obtained with getpwuid
in src/backend/main/main.c.  this is necessary because
later on, getpwuid is called again (in ValidateBinary).

the man pages for getpwuid on SCO OpenServer, FreeBSD,
and Darwin all have words to this effect (this is from
the SCO OpenServer man page):

  Note
  ====
  All information is contained in a static area, so it must
  be copied if it is to be saved. Otherwise, it may be
  overwritten on subsequent calls to these routines.

in particular, on my platform, the storage used to hold
the pw_name from the first call is overwritten such that
it looks like an empty username.  this causes a problem
later on in SetSessionUserIdFromUserName.

i'd assume this isn't a problem on most platforms because
getpwuid is called with the same UID both times, and the
same thing ends up happening to that static storage each
time.  however, that's not guaranteed, and is _not_ what
happens on my platform (at least :).

this is for the version of 7.1 available via anon cvs as
of Tue Jan 23 15:14:00 2001 PST:
  .../src/backend/main/main.c,v 1.37 2000/12/31 18:04:35 tgl Exp

-michael thornburgh, zenomt@armory.com

yuanzhao/gpdb,xinzweb/gpdb,rubikloud/gpdb,yazun/postgres-xl,Chibin/gpdb,zaksoup/gpdb,yazun/postgres-xl,50wu/gpdb,foyzur/gpdb,zeroae/postgres-xl,rvs/gpdb,janebeckman/gpdb,kmjungersen/PostgresXL,arcivanov/postgres-xl,jmcatamney/gpdb,greenplum-db/gpdb,Postgres-XL/Postgres-XL,xinzweb/gpdb,yazun/postgres-xl,lisakowen/gpdb,0x0FFF/gpdb,snaga/postgres-xl,kmjungersen/PostgresXL,xuegang/gpdb,tangp3/gpdb,0x0FFF/gpdb,greenplum-db/gpdb,lintzc/gpdb,royc1/gpdb,0x0FFF/gpdb,pavanvd/postgres-xl,lisakowen/gpdb,greenplum-db/gpdb,chrishajas/gpdb,Quikling/gpdb,50wu/gpdb,chrishajas/gpdb,rubikloud/gpdb,greenplum-db/gpdb,lintzc/gpdb,techdragon/Postgres-XL,kmjungersen/PostgresXL,cjcjameson/gpdb,postmind-net/postgres-xl,zaksoup/gpdb,ashwinstar/gpdb,Chibin/gpdb,adam8157/gpdb,royc1/gpdb,kmjungersen/PostgresXL,adam8157/gpdb,rvs/gpdb,ovr/postgres-xl,cjcjameson/gpdb,edespino/gpdb,rvs/gpdb,lintzc/gpdb,atris/gpdb,foyzur/gpdb,royc1/gpdb,zaksoup/gpdb,edespino/gpdb,xuegang/gpdb,Chibin/gpdb,xinzweb/gpdb,ashwinstar/gpdb,royc1/gpdb,postmind-net/postgres-xl,lisakowen/gpdb,ovr/postgres-xl,atris/gpdb,CraigHarris/gpdb,janebeckman/gpdb,randomtask1155/gpdb,snaga/postgres-xl,ashwinstar/gpdb,kaknikhil/gpdb,edespino/gpdb,oberstet/postgres-xl,foyzur/gpdb,adam8157/gpdb,lpetrov-pivotal/gpdb,xuegang/gpdb,cjcjameson/gpdb,CraigHarris/gpdb,edespino/gpdb,jmcatamney/gpdb,ahachete/gpdb,kaknikhil/gpdb,tangp3/gpdb,atris/gpdb,xinzweb/gpdb,randomtask1155/gpdb,janebeckman/gpdb,edespino/gpdb,kaknikhil/gpdb,ahachete/gpdb,xinzweb/gpdb,jmcatamney/gpdb,ashwinstar/gpdb,yuanzhao/gpdb,jmcatamney/gpdb,atris/gpdb,yuanzhao/gpdb,rubikloud/gpdb,lpetrov-pivotal/gpdb,tangp3/gpdb,oberstet/postgres-xl,yuanzhao/gpdb,lisakowen/gpdb,pavanvd/postgres-xl,jmcatamney/gpdb,yuanzhao/gpdb,ovr/postgres-xl,ahachete/gpdb,CraigHarris/gpdb,janebeckman/gpdb,ovr/postgres-xl,lpetrov-pivotal/gpdb,Quikling/gpdb,snaga/postgres-xl,royc1/gpdb,ashwinstar/gpdb,kaknikhil/gpdb,pavanvd/postgres-xl,tangp3/gpdb,lpetrov-pivotal/gpdb,randomtask1155/gpdb,arcivanov/postgres-xl,foyzur/gpdb,janebeckman/gpdb,tpostgres-projects/tPostgres,edespino/gpdb,Quikling/gpdb,Chibin/gpdb,lisakowen/gpdb,50wu/gpdb,ahachete/gpdb,Quikling/gpdb,Quikling/gpdb,foyzur/gpdb,rvs/gpdb,yuanzhao/gpdb,janebeckman/gpdb,rubikloud/gpdb,chrishajas/gpdb,chrishajas/gpdb,lisakowen/gpdb,cjcjameson/gpdb,adam8157/gpdb,CraigHarris/gpdb,chrishajas/gpdb,ahachete/gpdb,pavanvd/postgres-xl,ahachete/gpdb,adam8157/gpdb,lisakowen/gpdb,zeroae/postgres-xl,xuegang/gpdb,snaga/postgres-xl,0x0FFF/gpdb,randomtask1155/gpdb,techdragon/Postgres-XL,tpostgres-projects/tPostgres,ovr/postgres-xl,janebeckman/gpdb,janebeckman/gpdb,edespino/gpdb,jmcatamney/gpdb,yazun/postgres-xl,pavanvd/postgres-xl,rubikloud/gpdb,randomtask1155/gpdb,randomtask1155/gpdb,lintzc/gpdb,randomtask1155/gpdb,yuanzhao/gpdb,randomtask1155/gpdb,Chibin/gpdb,adam8157/gpdb,foyzur/gpdb,cjcjameson/gpdb,rvs/gpdb,Postgres-XL/Postgres-XL,arcivanov/postgres-xl,techdragon/Postgres-XL,techdragon/Postgres-XL,greenplum-db/gpdb,postmind-net/postgres-xl,yazun/postgres-xl,Postgres-XL/Postgres-XL,lintzc/gpdb,xinzweb/gpdb,rubikloud/gpdb,oberstet/postgres-xl,Quikling/gpdb,Chibin/gpdb,xuegang/gpdb,rvs/gpdb,lintzc/gpdb,oberstet/postgres-xl,0x0FFF/gpdb,Postgres-XL/Postgres-XL,postmind-net/postgres-xl,lpetrov-pivotal/gpdb,edespino/gpdb,CraigHarris/gpdb,greenplum-db/gpdb,jmcatamney/gpdb,lpetrov-pivotal/gpdb,snaga/postgres-xl,royc1/gpdb,rvs/gpdb,edespino/gpdb,tangp3/gpdb,zaksoup/gpdb,Quikling/gpdb,atris/gpdb,atris/gpdb,rvs/gpdb,CraigHarris/gpdb,kmjungersen/PostgresXL,yuanzhao/gpdb,jmcatamney/gpdb,50wu/gpdb,rubikloud/gpdb,cjcjameson/gpdb,lpetrov-pivotal/gpdb,lintzc/gpdb,50wu/gpdb,lintzc/gpdb,arcivanov/postgres-xl,lintzc/gpdb,ashwinstar/gpdb,foyzur/gpdb,foyzur/gpdb,cjcjameson/gpdb,atris/gpdb,janebeckman/gpdb,tangp3/gpdb,Postgres-XL/Postgres-XL,adam8157/gpdb,zaksoup/gpdb,ahachete/gpdb,zaksoup/gpdb,tpostgres-projects/tPostgres,cjcjameson/gpdb,CraigHarris/gpdb,tangp3/gpdb,zeroae/postgres-xl,ashwinstar/gpdb,greenplum-db/gpdb,kaknikhil/gpdb,tpostgres-projects/tPostgres,xuegang/gpdb,zeroae/postgres-xl,50wu/gpdb,arcivanov/postgres-xl,cjcjameson/gpdb,oberstet/postgres-xl,kaknikhil/gpdb,ashwinstar/gpdb,lisakowen/gpdb,Chibin/gpdb,Chibin/gpdb,ahachete/gpdb,Quikling/gpdb,postmind-net/postgres-xl,Quikling/gpdb,edespino/gpdb,rvs/gpdb,xinzweb/gpdb,yuanzhao/gpdb,zeroae/postgres-xl,Chibin/gpdb,cjcjameson/gpdb,50wu/gpdb,kaknikhil/gpdb,tpostgres-projects/tPostgres,arcivanov/postgres-xl,yuanzhao/gpdb,janebeckman/gpdb,techdragon/Postgres-XL,lpetrov-pivotal/gpdb,greenplum-db/gpdb,atris/gpdb,chrishajas/gpdb,xuegang/gpdb,zaksoup/gpdb,0x0FFF/gpdb,zaksoup/gpdb,0x0FFF/gpdb,adam8157/gpdb,0x0FFF/gpdb,CraigHarris/gpdb,rubikloud/gpdb,kaknikhil/gpdb,Quikling/gpdb,Chibin/gpdb,chrishajas/gpdb,chrishajas/gpdb,royc1/gpdb,xuegang/gpdb,kaknikhil/gpdb,rvs/gpdb,CraigHarris/gpdb,kaknikhil/gpdb,royc1/gpdb,xuegang/gpdb,50wu/gpdb,xinzweb/gpdb,tangp3/gpdb