[PATCH] Print error when libpq-refs-stamp fails

Started by Rachel Heatonover 4 years ago9 messageshackers
Jump to latest
#1Rachel Heaton
rachelmheaton@gmail.com

Hello,

While developing I got this error and it was difficult to figure out what
was going on.

Thanks to Jacob, I was able to learn the context of the failure, so we
created this small patch.

The text of the error message, of course, is up for debate, but hopefully
this will make it more clear to others.

Thank you,
Rachel Heaton

Attachments:

0001-Print-error-when-libpq-refs-stamp-fails.patchapplication/octet-stream; name=0001-Print-error-when-libpq-refs-stamp-fails.patchDownload+3-2
#2Daniel Gustafsson
daniel@yesql.se
In reply to: Rachel Heaton (#1)
Re: [PATCH] Print error when libpq-refs-stamp fails

On 28 Sep 2021, at 00:55, Rachel Heaton <rachelmheaton@gmail.com> wrote:

While developing I got this error and it was difficult to figure out what was going on.

Thanks to Jacob, I was able to learn the context of the failure, so we created this small patch.

I can see that, and I think this patch makes sense even though we don't have
much of a precedent for outputting informational messages from Makefiles.

The text of the error message, of course, is up for debate, but hopefully this will make it more clear to others.

+ echo 'libpq must not call exit'; exit 1; \

Since it's not actually libpq which calls exit (no such patch would ever be
committed), I think it would be clearer to indicate that a library linked to is
the culprit. How about something like "libpq must not be linked against any
library calling exit"?

--
Daniel Gustafsson https://vmware.com/

#3Rachel Heaton
rachelmheaton@gmail.com
In reply to: Daniel Gustafsson (#2)
Re: [PATCH] Print error when libpq-refs-stamp fails

On Tue, Sep 28, 2021 at 6:14 AM Daniel Gustafsson <daniel@yesql.se> wrote:

Since it's not actually libpq which calls exit (no such patch would ever be
committed), I think it would be clearer to indicate that a library linked to is
the culprit. How about something like "libpq must not be linked against any
library calling exit"?

Excellent update to the error message. Patch attached.

Attachments:

0002-Print-error-when-libpq-refs-stamp-fails.patchapplication/octet-stream; name=0002-Print-error-when-libpq-refs-stamp-fails.patchDownload+3-2
#4Daniel Gustafsson
daniel@yesql.se
In reply to: Rachel Heaton (#3)
Re: [PATCH] Print error when libpq-refs-stamp fails

On 28 Sep 2021, at 17:52, Rachel Heaton <rachelmheaton@gmail.com> wrote:

Patch attached.

I tweaked the error message a little bit and pushed to master. Thanks!

--
Daniel Gustafsson https://vmware.com/

#5Anton Voloshin
a.voloshin@postgrespro.ru
In reply to: Rachel Heaton (#1)
Re: [PATCH] Print error when libpq-refs-stamp fails

Hello,

On 28/09/2021 05:55, Rachel Heaton wrote:

Hello,

While developing I got this error and it was difficult to figure out
what was going on.

Thanks to Jacob, I was able to learn the context of the failure, so we
created this small patch.

-	! nm -A -u $< 2>/dev/null | grep -v __cxa_atexit | grep exit
+	@if nm -a -u $< 2>/dev/null | grep -v __cxa_atexit | grep exit; then \
+		echo 'libpq must not be linked against any library calling exit'; 
exit 1; \
+	fi

Could you please confirm that the change from -A to -a in nm arguments
in this patch is intentional?

--
Anton Voloshin
Postgres Professional, The Russian Postgres Company
https://postgrespro.ru

#6Jacob Champion
jacob.champion@enterprisedb.com
In reply to: Anton Voloshin (#5)
Re: [PATCH] Print error when libpq-refs-stamp fails

On Mon, 2021-10-04 at 23:40 +0700, Anton Voloshin wrote:

Could you please confirm that the change from -A to -a in nm arguments
in this patch is intentional?

That was not intended by us, thank you for the catch! A stray
lowercasing in vim, perhaps.

--Jacob

#7Daniel Gustafsson
daniel@yesql.se
In reply to: Jacob Champion (#6)
Re: [PATCH] Print error when libpq-refs-stamp fails

On 4 Oct 2021, at 19:02, Jacob Champion <pchampion@vmware.com> wrote:

On Mon, 2021-10-04 at 23:40 +0700, Anton Voloshin wrote:

Could you please confirm that the change from -A to -a in nm arguments
in this patch is intentional?

That was not intended by us, thank you for the catch! A stray
lowercasing in vim, perhaps.

Hmm, I will take care of this shortly.

/ Daniel

#8Daniel Gustafsson
daniel@yesql.se
In reply to: Daniel Gustafsson (#7)
Re: [PATCH] Print error when libpq-refs-stamp fails

On 4 Oct 2021, at 19:21, Daniel Gustafsson <daniel@yesql.se> wrote:

On 4 Oct 2021, at 19:02, Jacob Champion <pchampion@vmware.com> wrote:

On Mon, 2021-10-04 at 23:40 +0700, Anton Voloshin wrote:

Could you please confirm that the change from -A to -a in nm arguments
in this patch is intentional?

That was not intended by us, thank you for the catch! A stray
lowercasing in vim, perhaps.

Hmm, I will take care of this shortly.

Right, so I missed this in reviewing and testing, and I know why the latter
didn't catch it. nm -A and -a outputs the same thing *for this input* on my
Debian and macOS boxes, with the small difference that -A prefixes the line
with the name of the input file. -a also include debugger symbols, but for
this usage it didn't alter the results. I will go ahead and fix this, thanks
for catching it!

--
Daniel Gustafsson https://vmware.com/

#9Rachel Heaton
rachelmheaton@gmail.com
In reply to: Daniel Gustafsson (#8)
Re: [PATCH] Print error when libpq-refs-stamp fails

Thanks to you both!

From: Daniel Gustafsson <daniel@yesql.se>
Date: Monday, October 4, 2021 at 11:36 AM
To: Jacob Champion <pchampion@vmware.com>
Cc: Rachel Heaton <rachelmheaton@gmail.com>, pgsql-hackers@lists.postgresql.org <pgsql-hackers@lists.postgresql.org>, a.voloshin@postgrespro.ru <a.voloshin@postgrespro.ru>
Subject: Re: [PATCH] Print error when libpq-refs-stamp fails

On 4 Oct 2021, at 19:21, Daniel Gustafsson <daniel@yesql.se> wrote:

On 4 Oct 2021, at 19:02, Jacob Champion <pchampion@vmware.com> wrote:

On Mon, 2021-10-04 at 23:40 +0700, Anton Voloshin wrote:

Could you please confirm that the change from -A to -a in nm arguments
in this patch is intentional?

That was not intended by us, thank you for the catch! A stray
lowercasing in vim, perhaps.

Hmm, I will take care of this shortly.

Right, so I missed this in reviewing and testing, and I know why the latter
didn't catch it. nm -A and -a outputs the same thing *for this input* on my
Debian and macOS boxes, with the small difference that -A prefixes the line
with the name of the input file. -a also include debugger symbols, but for
this usage it didn't alter the results. I will go ahead and fix this, thanks
for catching it!

--
Daniel Gustafsson https://vmware.com/