Re: gettext calls in pgport

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: gettext calls in pgport
Date: 2004-11-02 03:18:22
Message-ID: 200411020318.iA23IM328131@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Dunstan wrote:
>
>
> Tom Lane wrote:
>
> >Somebody just yesterday stuck an
> >"fprintf(stderr,...); exit(1)" into one of the pgport routines. This
> >sucks, but there is not a lot else that can be done if the code needs
> >to exist in both backend and clients. It'd be better to propagate the
> >error condition back to the caller.
> >
> >An alternative possibility is to stop pretending that pgport is agnostic
> >about whether it is in backend or frontend. This might mean some
> >duplication of code between src/port/ and src/backend/port/, but if
> >that's what it takes to have sane error handling, that's what we should do.
> >
> >
> >
> >
>
> Maybe you're referring to the patch I sent in to strip the .exe suffix
> in get_progname? ;-)
>
> I wondered about that. The choices on strdup() error seemed to be:
>
> . ignore the error and return the unstripped path, knowing the program
> would fail in a minute on the next malloc call anyway
> . return NULL and patch the code in about 20 places (of which one is the
> backend) where get_progname() is called
> . print a message and exit
>
> I can see arguments for all of these ;-)

I added a comment to the exit() call:

exit(1); /* This could exit the postmaster */

This clearly marks that this could be a postmaster issue someday.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-11-02 03:35:19 Re: charset/collation in values
Previous Message Peter Eisentraut 2004-11-02 00:34:52 Path expansion in initdb