Skip to content

Conversation

CUGLIJIE
Copy link

@CUGLIJIE CUGLIJIE commented Sep 12, 2025

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

[

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

实际项目中,需要使用ymodem传输多文件到板子中,但是原来的代码不支持;

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

修改_rym_recv_begin函数,每一个文件路径单独使用一个独立的局部数组,而不是直接改变cctx->fpath,否则第二个以及后面的文件传输时,会导致文件路径错误,导致无法传输;

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

我是基于STM32L4R5的板子测试的,主线这边没有测试;

  • 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/ALL_BSP_COMPILE.json 详细请参考链接BSP自查

Copy link

📌 Code Review Assignment

🏷️ Tag: components

Reviewers: @Maihuanyi

Changed Files (Click to expand)
  • components/utilities/ymodem/ry_sy.c

🏷️ Tag: components_utilities_ymodem

Reviewers: @wdfk-prog

Changed Files (Click to expand)
  • components/utilities/ymodem/ry_sy.c

📊 Current Review Status (Last Updated: 2025-09-12 15:02 CST)


📝 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.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


jli seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

*/
char user_path[DFS_PATH_MAX]={0};
rt_snprintf(user_path, DFS_PATH_MAX, "%s%s", cctx->fpath, buf);
cctx->fd = open(user_path, O_CREAT | O_WRONLY | O_TRUNC, 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

char insert_0 = '\0';
    char *ret;
    rt_err_t err;
    ret = strchr(cctx->fpath,insert_0);
    if(ret)
    {
        *ret = '/';
    }
    else
    {
        rt_kprintf("No end character\n");
        return RYM_ERR_ACK;
    }
    rt_strncpy(ret + 1, (const char *)buf, len - 1);
    cctx->fd = open(cctx->fpath, O_CREAT | O_WRONLY | O_TRUNC, 0);
  • 这一块判断逻辑为啥不要了?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这段逻辑会直接篡改cctx->fpath,这个cctx->fpath是要传输的目录路径,buf才是文件名,如果按照之前的方式,那么当下载多个文件时,第二个文件的cctx->fpath就不对了,完整路径拼接时会出现问题,路径异常;下面的图是修改后的源码ymodem下载的截图
image

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

补充一个图:使用gdb调试,未修改的代码,下载两个文件,第二个文件路径异常:
image

@wdfk-prog
Copy link
Contributor

  • 第二次传输时是什么意思?
  • 是指当前ymode没传输完成又开了一个传输吗?

@CUGLIJIE
Copy link
Author

  • 第二次传输时是什么意思?
    指的是,我一次下载多个文件时,第二个文件传输的时候,不是第二次,还是一个会话,同一个命令
  • 是指当前ymode没传输完成又开了一个传输吗?
    不是,同上;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants