Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pXECL-0006vt-46 for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Mar 2023 04:36:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pXECK-0004Oe-10 for pgsql-hackers@arkaria.postgresql.org; Wed, 01 Mar 2023 04:36:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pXECJ-0004OV-M5 for pgsql-hackers@lists.postgresql.org; Wed, 01 Mar 2023 04:36:11 +0000 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pXECG-0007hL-2y for pgsql-hackers@lists.postgresql.org; Wed, 01 Mar 2023 04:36:11 +0000 Received: by mail-pf1-x42b.google.com with SMTP id cp12so6406744pfb.5 for ; Tue, 28 Feb 2023 20:36:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=HHpLwBpwmxWOIHDXNk0LD7wpRAnJnRukGKqlB6iMnAQ=; b=KbgnDznqx/rBK+enwX701k05laVNtBdEOJ7QlrjUFmMNJdpcyJis7l/2nH42G06GYh ngwycNI9ggzCHrxAAlkDQlf7dJXZLDLc7jUmEZUcm6TNiTeR75CQGgSyDfCiH9+ePTnG /M9AH15P/PjjkYVdxq/1snBEQpRKqhQUU/gNpFGRCfoCKSZnXeAg1eefdsG0UNfGjMjg Btif0vtZQLqtVsblKXjjPvoi5U1H8nG7QsxwI+sShjaUTLLtl4TEz1juAkhdfQM/DY6l IEF1XoYuJwXaa0k2PPTnqDBI2ytsiQI43KWHHMxpynqHHYDFR5foF5wqmr3oJYhyp7KF y1GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=HHpLwBpwmxWOIHDXNk0LD7wpRAnJnRukGKqlB6iMnAQ=; b=SNiNbajIxUKx0UiKZ03xOV+4lXl8C8VaPwD8k3eEiO5ETLutsa6WTrEm8vHwi450Y4 AryE3Vbl02ts0BB1TKpf1pXbTV42oea/TmhOyRJf9EZBu9zX1TaA0xr0mIE6XmF/h7Sn MxkryDEBkdUmdzSFzHsgmL1dvBOqwg4SoEf0kiiwDp1pLm9Hq8wN0eC5qRLxCORoT/k2 hMC+jQt6Ua8ZNEGc1JkagpTx3Z9MZzqUfPpYl5f0V+0vQ7EczrpDhH8Sdd78pSgBD3Rc AAI0HA605YrOiUssMsen82K1wRpb4NwX34OYoxYXLJOl7jnUUJauod3U8QH4rcdFKr53 dV7w== X-Gm-Message-State: AO0yUKUU82s+CfKANMRNUYgXHVL8LVeXS5+4p1ce2YYTHXqpiaPmoLo7 QJT6tkjeppPU2T3z3LeKxpU= X-Google-Smtp-Source: AK7set8Qk+u8oE6znsUVtRHSjt2NafXmbG5oqcuNmN4pEW5HjftUTRThJkqiwcoyPqkaOou95VvTvQ== X-Received: by 2002:a62:5e43:0:b0:5a8:c3ec:e24e with SMTP id s64-20020a625e43000000b005a8c3ece24emr4157463pfb.4.1677645365954; Tue, 28 Feb 2023 20:36:05 -0800 (PST) Received: from nathanxps13 ([50.47.162.83]) by smtp.gmail.com with ESMTPSA id x64-20020a638643000000b00502fdc789c5sm6572701pgd.27.2023.02.28.20.36.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 20:36:05 -0800 (PST) Date: Tue, 28 Feb 2023 20:36:03 -0800 From: Nathan Bossart To: Andres Freund Cc: Thomas Munro , Michael Paquier , Robert Haas , Tom Lane , Fujii Masao , Postgres hackers Subject: Re: stopgap fix for signal handling during restore_command Message-ID: <20230301043603.GD1453450@nathanxps13> References: <20230223231503.GA743455@nathanxps13> <20230224043323.GA821522@nathanxps13> <20230225190742.lfopue3nkrvxxoie@awork3.anarazel.de> <20230225192825.GA868928@nathanxps13> <20230225195253.hzp6pyllhn4kw4g6@awork3.anarazel.de> <20230225220629.GA1021641@nathanxps13> <20230226180029.djk7cth4o3o5doom@awork3.anarazel.de> <20230226193900.GA1248604@nathanxps13> <20230226201227.cner3cdicropu4q5@awork3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230226201227.cner3cdicropu4q5@awork3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Feb 26, 2023 at 12:12:27PM -0800, Andres Freund wrote: > On 2023-02-26 11:39:00 -0800, Nathan Bossart wrote: >> What precisely did you have in mind? AFAICT you are asking for a wrapper >> around write(). > > Partially I just want something that can easily be searched for, that can have > comments attached to it documenting why what it is doing is safe. > > It'd not be a huge amount of work to have a slow and restricted string > interpolation support, to make it easier to write messages. Converting floats > is probably too hard to do safely, and I'm not sure %m can safely be > supported. But basic things like %d would be pretty simple. > > Basically a loop around the format string that directly writes to stderr using > write(), and only supports a signal safe subset of normal format strings. Got it, thanks. I will try to put something together along these lines, although I don't know if I'll pick up the interpolation support in this thread. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com