wrong shell trap

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: wrong shell trap
Date: 2022-09-13 18:10:02
Message-ID: 20220913181002.hzsosy7qkemb7ky7@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

While messing with the new guc.h stuff I happened run headerscheck and
wanted to abort it right away, and in doing so I realized that its
'trap' line is incorrect: it only removes its temp dir, but it doesn't
exit the program; so after you C-c it, it will spew a ton of complaints
about its temp dir not existing.

AFAICT almost all of our shell scripts contain the same mistake. I
propose to fix them all as in the attached demo patch, which makes
headerscheck exit properly (no silly noise) when interrupted.

(I confess to not fully understanding why every other trap does
"rm && exit $ret" rather than "rm ; exit", but I guess rm -fr should not
fail anyway thus this should OK.)

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/

Attachment Content-Type Size
fixtrap.patch text/x-diff 445 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2022-09-13 19:02:55 Re: postgres_fdw hint messages
Previous Message Peter Geoghegan 2022-09-13 17:53:06 Re: New strategies for freezing, advancing relfrozenxid early