Repository navigation
nshlib: Do not remove nsh_catfile() when cat is enabled - #4047
Merged
Merged
Conversation
nsh.h undefines NSH_HAVE_CATFILE when cat, ifconfig, ifup/down, df, free and env are all enabled, and irqinfo and the mount list are not. The test of the six commands is inverted: cat always uses nsh_catfile(). With procfs, no network, no IRQ monitor and CONFIG_FS_PROCFS_EXCLUDE_MOUNT=y, the build fails: nsh_command.c: error: 'cmd_mount' undeclared here More commands use nsh_catfile() than the list names (dmesg, fdinfo, route, ...). Remove the test, so nsh_catfile() is always built. With --gc-sections, the linker removes it when no command uses it. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
GUIDINGLI
approved these changes
Nov 13, 2026
xiaoxiang781216
approved these changes
Nov 13, 2026
🔗 Cross-repo PR dependenciesThe read-only Build run reported the following dependent PR(s) and fetched head SHA(s):
CI run: https://github.com/apache/nuttx-apps/actions/runs/43391400555 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
nshlib/nsh.hundefinesNSH_HAVE_CATFILEwhen cat, ifconfig, ifup/down, df, free and env are all enabled, and irqinfo and the mount list are not. The test of the six commands is inverted:catalways usesnsh_catfile(). With procfs, no network, no IRQ monitor andCONFIG_FS_PROCFS_EXCLUDE_MOUNT=y(qemu-armv8a:nsh), NSH does not build:More commands call
nsh_catfile()than the list names (dmesg, fdinfo, route, ...). This PR removes the test, sonsh_catfile()is always built.Impact
NSH_HAVE_CATFILEwas already defined, so they do not change.nsh_catfile()in nsh_fsutils.c; with--gc-sectionsthe linker removes it.Testing
qemu-armv8a:nsh,
EXTRAFLAGS="-Wno-cpp -Werror", aarch64-none-elf-gcc 14.2.1, nuttx master 562db43781f with apache/nuttx#21824 (the procfsfs/mountlink fix): all 8 combinations ofFS_PROCFS_EXCLUDE_MOUNT,_BLOCKSand_USAGEbuild with no warnings. In QEMU withFS_PROCFS_EXCLUDE_MOUNT=y,cat,dfanddf -hwork. nuttx-apps master fails as shown above.tools/checkpatch.sh -c -u -m -gpasses.