Skip to content

[5/5] libs/libc: Build popen() without the check for the apps copy. - #20839

Merged
acassis merged 2 commits into
apache:masterfrom
casaroli:popen-remove-guard
Oct 23, 2026
Merged

acassis merged 2 commits into
apache:masterfrom
casaroli:popen-remove-guard

Conversation

@casaroli

Copy link
Copy Markdown
Contributor

Summary

libc does not build popen(), pclose(), dpopen() and dpclose() when CONFIG_SYSTEM_POPEN selects the copy in apps/system/popen ([1/5] #20778). [4/5] apache/nuttx-apps#3890 removes that copy and the option from apps, so this PR removes the check from libs/libc/stdio and libs/libc/unistd (Make.defs and CMakeLists.txt).

The second commit removes the documentation page of apps/system/popen and describes the libc functions in a new page of the libc documentation: the options they need, the shell they start, and how they start a command when there is no shell.

Impact

No change for configurations without CONFIG_SYSTEM_POPEN, which are all configurations after [3/5] #20792 and [4/5]. With an older apps tree that still sets CONFIG_SYSTEM_POPEN=y, both copies are compiled; the link takes the apps copy, as before.

Testing

Built with [4/5] (apps); in each, libc builds lib_popen.o and lib_dpopen.o, and no option of the defconfig is lost after make olddefconfig:

Configuration Result
qemu-armv8a:fastboot builds, CONFIG_SYSTEM_FASTBOOTD_SHELL=y
sabre-6quad:citest, rv-virt:citest, rv-virt:citest64 build, CONFIG_EXAMPLES_POPEN=y
lx_cpu:nsh builds
esp32s3-devkit:fastboot, :fastboot_tcp, :fastboot_usb, lckfb-szpi-esp32s3:fastboot, :fastboot_tcp, :fastboot_usb build, CONFIG_SYSTEM_FASTBOOTD_SHELL=y
sim:citest, sim:quickjs (x86_64 Linux in Docker) build, CONFIG_EXAMPLES_POPEN=y in sim:citest
qemu-intel64:citest_smp (x86_64 Linux in Docker) builds, CONFIG_EXAMPLES_POPEN=y

sim:sqlite was not built: the build host has no tclsh, which the SQLite build needs.

Runtime on qemu-armv8a:knsh and qemu-armv8a:nsh (QEMU with HVF) with CONFIG_TESTING_POPEN and CONFIG_EXAMPLES_POPEN: popen_test ends with === Results: 0 failed === (8 tests), and the popen example reads the output of help and exits with 0.

With apps master (system/popen still present) and CONFIG_SYSTEM_POPEN=y on qemu-armv8a:nsh: both copies compile, the image links without errors and has one popen(), the apps copy.

tools/checkpatch.sh -c -u -m -g passes.

depends-on: [apache/nuttx-apps/pull/3890]

libc did not build popen(), pclose(), dpopen() and dpclose() when
CONFIG_SYSTEM_POPEN selected the copy in apps/system/popen.  That copy
and its option are removed from apps, so remove the check.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <[email protected]>
apps/system/popen is removed, so remove its page.  Describe the libc
popen(), pclose(), dpopen() and dpclose() in a new page of the libc
documentation: the options they need, the shell they start, and the
fallback when there is no shell.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <[email protected]>
@github-actions github-actions Bot added Area: Documentation Improvements or additions to documentation Size: S The size of the change in this PR is small labels Oct 20, 2026
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

MemBrowse Memory Report · Explore what changed →

qemu-armv8a

  • Code: .text.hostfs_open +8 B, .text.nsh_builtin -64 B, .text.nsh_parse_command +24 B (-0.0%, 351,880 B)

qemu-intel64

  • Code: .text -68 B (-0.0%, 8,685,677 B)

No memory changes detected for:


Catch memory regressions in CI with MemBrowse. Free for open source.

@github-actions

Copy link
Copy Markdown

🔗 Cross-repo PR dependencies

The read-only Build run reported the following dependent PR(s) and fetched head SHA(s):

CI run: https://github.com/apache/nuttx/actions/runs/39420528204

@casaroli casaroli closed this Oct 21, 2026
@casaroli casaroli reopened this Oct 21, 2026
@github-actions

Copy link
Copy Markdown

🔗 Cross-repo PR dependencies

The read-only Build run reported the following dependent PR(s) and fetched head SHA(s):

CI run: https://github.com/apache/nuttx/actions/runs/39563368119

@xiaoxiang781216
xiaoxiang781216 marked this pull request as ready for review October 22, 2026 08:31
@casaroli casaroli closed this Oct 22, 2026
@casaroli casaroli reopened this Oct 22, 2026
@github-actions

Copy link
Copy Markdown

🔗 Cross-repo PR dependencies

The read-only Build run reported the following dependent PR(s) and fetched head SHA(s):

CI run: https://github.com/apache/nuttx/actions/runs/39773652187

@acassis
acassis merged commit 717c93c into apache:master Oct 23, 2026
142 of 162 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Documentation Improvements or additions to documentation Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants