Skip to content

fix(kernel)/improve(utest):fix the legacy issue related to the length of the object name version #10537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 30, 2025

Conversation

kurisaW
Copy link
Member

@kurisaW kurisaW commented Jul 25, 2025

拉取/合并请求描述:(PR description)

[

Fixed: #10528

feature:object name超过RT_NAME_MAX-1,返回断言
improve:完善object测试用例

image

为什么提交这份PR (why to submit this PR)

你的解决方案是什么 (what is your solution)

请提供验证的bsp和config (provide the config and bsp)

  • BSP:
  • .config:
  • action:

]

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 代码是高质量的 Code in this PR is of high quality
  • 已经使用formatting 等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification
  • 如果是新增bsp, 已经添加ci检查到.github/workflows/bsp_buildings.yml 详细请参考链接BSP自查

@kurisaW kurisaW requested a review from Rbb666 as a code owner July 25, 2025 01:22
@github-actions github-actions bot added Kernel PR has src relate code testcase labels Jul 25, 2025
Copy link

github-actions bot commented Jul 25, 2025

📌 Code Review Assignment

🏷️ Tag: kernel

Reviewers: GorrayLi ReviewSun hamburger-os lianux-mm wdfk-prog xu18838022837

Changed Files (Click to expand)
  • src/klibc/utest/TC_rt_memcmp.c
  • src/object.c

🏷️ Tag: workflow

Reviewers: Rbb666 kurisaW supperthomas

Changed Files (Click to expand)
  • .github/utest/kernel/object.cfg
  • .github/workflows/utest_auto_run.yml

📊 Current Review Status (Last Updated: 2025-07-30 10:36 CST)

  • GorrayLi Pending Review
  • Rbb666 Pending Review
  • ReviewSun Pending Review
  • hamburger-os Pending Review
  • kurisaW Pending Review
  • lianux-mm Pending Review
  • supperthomas Pending Review
  • wdfk-prog Pending Review
  • xu18838022837 Pending Review

📝 Review Instructions

  1. 维护者可以通过单击此处来刷新审查状态: 🔄 刷新状态
    Maintainers can refresh the review status by clicking here: 🔄 Refresh Status

  2. 确认审核通过后评论 LGTM/lgtm
    Comment LGTM/lgtm after confirming approval

  3. PR合并前需至少一位维护者确认
    PR must be confirmed by at least one maintainer before merging

ℹ️ 刷新CI状态操作需要具备仓库写入权限。
ℹ️ Refresh CI status operation requires repository Write permission.

@kurisaW kurisaW marked this pull request as draft July 25, 2025 02:31
@github-actions github-actions bot added the action github action yml imporve label Jul 25, 2025
@kurisaW kurisaW force-pushed the object branch 2 times, most recently from 8bdbbce to 9263b8a Compare July 28, 2025 01:16
@kurisaW kurisaW marked this pull request as ready for review July 28, 2025 01:19
@kurisaW kurisaW requested a review from supperthomas as a code owner July 28, 2025 01:19
@kurisaW
Copy link
Member Author

kurisaW commented Jul 28, 2025

object utest ci测试通过:

image

@Rbb666
Copy link
Member

Rbb666 commented Jul 28, 2025

如果这种传入的字符串超过 RT_NAME_MAX 限制的设备,万一匹配错设备怎么办,比如 RT_NAME_MAX=8 ,字符串是:norflash01norflash02

建议:直接在对象注册那边卡一下,如果名字超过长度,直接注册设备失败,给个失败警告,然后返回。
然后针对object的测试用例也可以针对这种情况完善下

@kurisaW kurisaW marked this pull request as draft July 28, 2025 03:32
@kurisaW kurisaW force-pushed the object branch 2 times, most recently from 87ed8fd to 1c61ab2 Compare July 28, 2025 07:47
@kurisaW kurisaW marked this pull request as ready for review July 28, 2025 08:00
@dongly
Copy link
Contributor

dongly commented Jul 29, 2025

如果这种传入的字符串超过 RT_NAME_MAX 限制的设备,万一匹配错设备怎么办,比如 RT_NAME_MAX=8 ,字符串是:norflash01norflash02

建议:直接在对象注册那边卡一下,如果名字超过长度,直接注册设备失败,给个失败警告,然后返回。 然后针对object的测试用例也可以针对这种情况完善下

这样的话,现在的很多东西的名字要改,建议 RT_NAME_MAX 默认值改为12

@kurisaW kurisaW force-pushed the object branch 3 times, most recently from 5b21596 to 8e48a65 Compare July 29, 2025 11:08
@Rbb666 Rbb666 merged commit 62f3fb4 into RT-Thread:master Jul 30, 2025
63 checks passed
unicornx added a commit to unicornx/rt-thread that referenced this pull request Aug 18, 2025
Fixes: 62f3fb4: fix(kernel)/improve(utest):fix the legacy issue related to the length of the object name version RT-Thread#10537

After this patch, if length of object name exceeds (RT_NAME_MAX - 1),
RTT will assert and oops when runing, but not in period of building.
Though I don't think it's a good solution, but don't want to argue more
about this.

Old RT_NAME_MAX is 8 for k230, and some object names, such as
"hwtimer0", which name length is 8, breaking the new rule.

Just update configuration of k230 bsp and increase RT_NAME_MAX from
8 to 16, which should be long enough for k230.

Signed-off-by: Chen Wang <[email protected]>
unicornx added a commit to unicornx/rt-thread that referenced this pull request Aug 18, 2025
Fixes: 62f3fb4: fix(kernel)/improve(utest):fix the legacy issue related to the length of the object name version RT-Thread#10537

After this patch, if length of object name exceeds (RT_NAME_MAX - 1),
RTT will assert and oops when runing, but not in period of building.
Though I don't think it's a good solution, but don't want to argue more
about this.

Old RT_NAME_MAX is 8 for k230, and some object names, such as
"hwtimer0", which name length is 8, breaking the new rule.

Just update configuration of k230 bsp and increase RT_NAME_MAX from
8 to 16, which should be long enough for k230.

Signed-off-by: Chen Wang <[email protected]>
Rbb666 pushed a commit that referenced this pull request Aug 18, 2025
Fixes: 62f3fb4: fix(kernel)/improve(utest):fix the legacy issue related to the length of the object name version #10537

After this patch, if length of object name exceeds (RT_NAME_MAX - 1),
RTT will assert and oops when runing, but not in period of building.
Though I don't think it's a good solution, but don't want to argue more
about this.

Old RT_NAME_MAX is 8 for k230, and some object names, such as
"hwtimer0", which name length is 8, breaking the new rule.

Just update configuration of k230 bsp and increase RT_NAME_MAX from
8 to 16, which should be long enough for k230.

Signed-off-by: Chen Wang <[email protected]>
yandld pushed a commit to yandld/rt-thread that referenced this pull request Aug 20, 2025
Fixes: 62f3fb4: fix(kernel)/improve(utest):fix the legacy issue related to the length of the object name version RT-Thread#10537

After this patch, if length of object name exceeds (RT_NAME_MAX - 1),
RTT will assert and oops when runing, but not in period of building.
Though I don't think it's a good solution, but don't want to argue more
about this.

Old RT_NAME_MAX is 8 for k230, and some object names, such as
"hwtimer0", which name length is 8, breaking the new rule.

Just update configuration of k230 bsp and increase RT_NAME_MAX from
8 to 16, which should be long enough for k230.

Signed-off-by: Chen Wang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action github action yml imporve BSP component: drivers/core component: drivers/ipc component: drivers component: lwp Component Doc This PR/issue related with documents Kernel PR has src relate code RT-Smart RT-Thread Smart related PR or issues testcase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] 使用 rt_object_find()时,当 name 的长度 > RT_NAME_MAX, 查找不到,同之前的行为不一致
4 participants