Add tests for object size limits of injection points
Hi all,
While looking at a recent patch for injection points that has resulted
in 16a2f706951e, I have been reminded that the point name, library
name and function name have hardcoded limits, and it is now possible
to have them tested by SQL.
Attached is a patch to do so. Thoughts?
--
Michael
Attachments:
0001-injection_points-Add-tests-for-name-limits.patchtext/x-diff; charset=us-asciiDownload+15-1
On Nov 10, 2025, at 09:11, Michael Paquier <michael@paquier.xyz> wrote:
Hi all,
While looking at a recent patch for injection points that has resulted
in 16a2f706951e, I have been reminded that the point name, library
name and function name have hardcoded limits, and it is now possible
to have them tested by SQL.Attached is a patch to do so. Thoughts?
--
Michael
<0001-injection_points-Add-tests-for-name-limits.patch>
Maybe not a problem of this patch, but
```
+SELECT injection_points_attach(repeat('a', 64), 'injection_notice',
+ 'TestInjectionNoticeFunc', NULL);
+ERROR: injection point name aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa too long (maximum of 64)
```
Is really confused. The error message says “maximum of 64”, but the test right uses a name of length 64. I know that the tricky is the ‘\0’ terminator, but should SQL writer have to keep mind about the ‘\0’ terminator? Should they just consider maximum length as 63?
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
On Mon, Nov 10, 2025 at 10:30:31AM +0800, Chao Li wrote:
Is really confused. The error message says “maximum of 64”, but the
test right uses a name of length 64. I know that the tricky is the
‘\0’ terminator, but should SQL writer have to keep mind about the
‘\0’ terminator? Should they just consider maximum length as 63?
Right. We could add a "- 1" to the error message printed.
--
Michael
Hi Michael, Chao,
On Mon, Nov 10, 2025 at 11:32 AM Michael Paquier <michael@paquier.xyz> wrote:
On Mon, Nov 10, 2025 at 10:30:31AM +0800, Chao Li wrote:
Is really confused. The error message says “maximum of 64”, but the
test right uses a name of length 64. I know that the tricky is the
‘\0’ terminator, but should SQL writer have to keep mind about the
‘\0’ terminator? Should they just consider maximum length as 63?Right. We could add a "- 1" to the error message printed.
Thanks for the patch. I also agree with Chao's suggestion that the
error message better reflects the actual character limits. I
implemented a patch for that and updated the test patch as well.
Please check.
Best,
Xuneng
Attachments:
v2-0001-injection_points-Report-actual-character-limits-i.patchapplication/octet-stream; name=v2-0001-injection_points-Report-actual-character-limits-i.patchDownload+8-12
v2-0002-injection_points-Add-tests-for-name-limits.patchapplication/octet-stream; name=v2-0002-injection_points-Add-tests-for-name-limits.patchDownload+15-1
On 10 Nov 2025, at 02:11, Michael Paquier <michael@paquier.xyz> wrote:
While looking at a recent patch for injection points that has resulted
in 16a2f706951e, I have been reminded that the point name, library
name and function name have hardcoded limits, and it is now possible
to have them tested by SQL.
While they do increase code coverage, which is a good thing, it seems somewhat
unlikely that they will catch bugs given the nature of of the code being
tested. That being said they come at a low cost so no objections to add.
--
Daniel Gustafsson
On Mon, Nov 10, 2025 at 06:27:41PM +0800, Xuneng Zhou wrote:
Thanks for the patch. I also agree with Chao's suggestion that the
error message better reflects the actual character limits. I
implemented a patch for that and updated the test patch as well.
Please check.
Yes, that works here.
--
Michael
On Mon, Nov 10, 2025 at 06:27:41PM +0800, Xuneng Zhou wrote:
Thanks for the patch. I also agree with Chao's suggestion that the
error message better reflects the actual character limits. I
implemented a patch for that and updated the test patch as well.
Please check.
The restriction related to the private area can be enlarged by 1 byte,
because we don't care about the null-termination in this case.
Done that, and adjusted the whole down to 17 where this has been
introduced. It's far from being critical, but consistency could
matter for future changes, including things outside of core. And it's
nice to keep the same rules across the board if we can do so for
testing facilities.
--
Michael
Hi,
On Wed, Nov 12, 2025 at 9:37 AM Michael Paquier <michael@paquier.xyz> wrote:
On Mon, Nov 10, 2025 at 06:27:41PM +0800, Xuneng Zhou wrote:
Thanks for the patch. I also agree with Chao's suggestion that the
error message better reflects the actual character limits. I
implemented a patch for that and updated the test patch as well.
Please check.The restriction related to the private area can be enlarged by 1 byte,
because we don't care about the null-termination in this case.
Makes sense to me.
Done that, and adjusted the whole down to 17 where this has been
introduced. It's far from being critical, but consistency could
matter for future changes, including things outside of core. And it's
nice to keep the same rules across the board if we can do so for
testing facilities.
--
Michael
Thanks.
--
Best,
Xuneng
On Nov 10, 2025, at 18:27, Xuneng Zhou <xunengzhou@gmail.com> wrote:
Hi Michael, Chao,
On Mon, Nov 10, 2025 at 11:32 AM Michael Paquier <michael@paquier.xyz> wrote:
On Mon, Nov 10, 2025 at 10:30:31AM +0800, Chao Li wrote:
Is really confused. The error message says “maximum of 64”, but the
test right uses a name of length 64. I know that the tricky is the
‘\0’ terminator, but should SQL writer have to keep mind about the
‘\0’ terminator? Should they just consider maximum length as 63?Right. We could add a "- 1" to the error message printed.
Thanks for the patch. I also agree with Chao's suggestion that the
error message better reflects the actual character limits. I
implemented a patch for that and updated the test patch as well.
Please check.Best,
Xuneng
<v2-0001-injection_points-Report-actual-character-limits-i.patch><v2-0002-injection_points-Add-tests-for-name-limits.patch>
The patch looks good to me.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/