RT-Thread / RT-Thread/rt-thread

[Bug] Syntax error in blk.c

Open
#10,385 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
12.2k
Forks
5.4k
Avg merge
4d 12h
Merged PRs (30d)
40

Description

RT-Thread Version

v5.2.1

Hardware Type/Architectures

Not Apply

Develop Toolchain

IAR

Describe the bug

In components\drivers\block\blk.c line 549 and 565, there exist syntax errors that lead to build failure

rt_kprintf("%-*.s %3u.%-3u  %u %u.%u%s\t%u  disk %s\n",
        RT_NAME_MAX, to_disk_name(disk),
#ifdef RT_USING_DM
        disk->parent.master_id, disk->parent.device_id,
#else
        0, 0,
#endif
        disk->removable, cap, minor, size_name, disk->read_only,
        disk->max_partitions != RT_BLK_PARTITION_NONE ? "\b" :
            (dfs_filesystem_get_mounted_path(&disk->parent) ? : "\b"));

rt_list_for_each_entry(blk_dev, &disk->part_nodes, list)
{
    size_name = convert_size(&geome, blk_dev->sector_count, &cap, &minor);

    rt_kprintf("%c--%-*.s %3u.%-3u  %u %u.%u%s\t%u  part %s\n",
            blk_dev->list.next != &disk->part_nodes ? '|' : '`',
            RT_NAME_MAX - 3, to_blk_name(blk_dev),
    #ifdef RT_USING_DM
            blk_dev->parent.master_id, blk_dev->parent.device_id,
    #else
            0, 0,
    #endif
            disk->removable, cap, minor, size_name, disk->read_only,
            dfs_filesystem_get_mounted_path(&blk_dev->parent) ? : "");
}

Other additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open components/drivers/block/blk.c at lines 549 and 565 and inspect the reported syntax around the two formatted output calls. Rebuild RT-Thread v5.2.1 with the IAR toolchain; done means the file parses and the build completes without these errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
embedded-iot
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.