Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rhZq5-00CERe-UF for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Mar 2024 18:48:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rhZq3-001oZ4-6X for pgsql-hackers@arkaria.postgresql.org; Tue, 05 Mar 2024 18:48:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rhZq2-001oYv-TQ for pgsql-hackers@lists.postgresql.org; Tue, 05 Mar 2024 18:48:31 +0000 Received: from mail-lj1-x232.google.com ([2a00:1450:4864:20::232]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rhZpz-0030nF-9x for pgsql-hackers@postgresql.org; Tue, 05 Mar 2024 18:48:29 +0000 Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2d2505352e6so79094481fa.3 for ; Tue, 05 Mar 2024 10:48:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709664507; x=1710269307; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Lk7eStZN9tBv0H7WhJ7w+TowEVKYAwDymYQWniy/rz0=; b=j83IAIZRBkUoz6mJqnUk8P0aUYMoQwEJdSZojT6I1WB3YkJy1XY40EArlb8aDUHK44 JnaCPO/sxqGMMskhRPMlswmwys0Z5ApwxeVddE2JCyO7GMCTzFxQrFf1RPl9G5SYtACx BIl/XZvJgqirwO/Uoez42ATrB6K5Ydx5R52b9ol4EWHU9QKMKzIqfYCTpkNqlGdbXVNF NDmBgq3rWp9314btynRieEHPOhuT/bCXpdEXx8nb2N4dw4GI9rvVr/k+HXmpsYd0QOOD d5nG+cLMH8OReGxYPMj4hopyuThZdMyh1WQG6XWYttXuJwrIA0amsSnkYGaehyvAlNQb J4QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709664507; x=1710269307; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Lk7eStZN9tBv0H7WhJ7w+TowEVKYAwDymYQWniy/rz0=; b=HyOh+eRKVqgI62eS0WuMDW/Jvi8LQOKhk7wTzw2q6fERSQNoVXlGfIZY8kutvOm3HQ 658PK1eSLilBJusx3i8D8jwlSf3xjBxAtMnLQWwquVbM6oR8U3zqM6B+m+PUMwpPCGP5 Ra4OLnjY6fmTjKTOqrMByI4O7vlqz1WRAL340cyWpcQO2NQPuPTHz4qv/+SCO7U7laMs ubICA2Ooj1uGwuc2xvx9xPCJV47x92opz/SOktp7lnltNiOFsT7LYeX/0mxlBfHOb1uk Hy2/u6mTQcQthQ4jYvlic+bR4GjpV76OPlh40qOmunvBuBlXE2DNcUUjzwkcVJGiBgtV xfHA== X-Forwarded-Encrypted: i=1; AJvYcCXMZymOA/Q27wbCwEwACxbYzshl+r64bZ2gk4K82CMFPXqWYUeT4MDES+brhYpf8HIKjfwByDy71YtVsl38JHEHgzvUR28HXOp4iGJS X-Gm-Message-State: AOJu0YxW5rp17afcL5+QDdk841ZAAA54wtlGqYJWdROAeBTUMxLgL41V rkF9U8UHHuwifUAItszgF9bKNV/C+SoIGkmRNY+iwgPXfaWzqlzAI7cGTRmkMfuG5RhITfnakxw WTxhglC4QvemGYPvkOSCpAH4Pv+w= X-Google-Smtp-Source: AGHT+IGf6sAIrfd8XtmeIG05vNalGWIkJVZmwULFL6qu9JtW6EfUeg2EXC73T+2lJ59n9j7WWfDyEoyQpxBAsqJoybg= X-Received: by 2002:a2e:9b85:0:b0:2d3:e954:221d with SMTP id z5-20020a2e9b85000000b002d3e954221dmr1960893lji.34.1709664506518; Tue, 05 Mar 2024 10:48:26 -0800 (PST) MIME-Version: 1.0 References: <202402291035.op26n4voqmba@alvherre.pgsql> In-Reply-To: <202402291035.op26n4voqmba@alvherre.pgsql> From: Bharath Rupireddy Date: Wed, 6 Mar 2024 00:18:14 +0530 Message-ID: Subject: Re: Support a wildcard in backtrace_functions To: Alvaro Herrera Cc: Jelte Fennema-Nio , Daniel Gustafsson , PostgreSQL Hackers , Peter Eisentraut Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Feb 29, 2024 at 4:05=E2=80=AFPM Alvaro Herrera wrote: > > Hmm, so if I write "foo,*" this will work but check all function names > first and on the second entry. But if I write "foo*" the GUC value will > be accepted but match nothing (as will "*foo" or "foo*bar"). I don't > like either of these behaviors. I think we should tighten this up: an > asterisk should be allowed only if it appears alone in the string > (short-circuiting check_backtrace_functions before strspn); and let's > leave the strspn() call alone. +1 for disallowing *foo or foo* or foo*bar etc. combinations. I think we need to go a bit further and convert backtrace_functions of type GUC_LIST_INPUT so that check_backtrace_functions can just use SplitIdentifierString to parse the list of identifiers. Then, the strspn can just be something like below for each token: validlen =3D strspn(*tok, "0123456789_" "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ"); Does anyone see a problem with it? FWIW, I've recently noticed for my work on https://commitfest.postgresql.org/47/2863/ that there isn't any test covering all the backtrace related code - backtrace_functions GUC, backtrace_on_internal_error GUC, set_backtrace(), backtrace(), backtrace_symbols(). I came up with a test module covering these areas https://commitfest.postgresql.org/47/4823/. I could make the TAP tests pass on all the CF bot animals. Interestingly, the new code that gets added for this thread can also be covered with it. Any thoughts are welcome. -- Bharath Rupireddy PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com