casaroli opened a new pull request, #20987: URL: https://github.com/apache/nuttx/pull/20987
## Summary `<glob.h>` had no `GLOB_TILDE`, so programs that call `glob()` on a pattern such as `~/.config/name` did not compile. This PR adds `GLOB_TILDE` and `GLOB_TILDE_CHECK`, with the values of glibc and musl (0x1000, 0x4000): - With `GLOB_TILDE`, a `~` at the start of the pattern is the value of `HOME`, or else the home directory of the user in the password database, and `~name` is the home directory of the user `name`. - When the home directory is not known, `GLOB_TILDE` uses the pattern as it is, and `GLOB_TILDE_CHECK` returns `GLOB_NOMATCH`, as glibc does. No page described `glob()`, so the second commit adds it, with its flags, to `Documentation/reference/user/10_filesystem.rst`. ## Impact Two new flags. Without them `glob()` does not change. Every build mode (C library code). ## Testing Test program `globtilde.c` on `qemu-armv8a:knsh` (QEMU with HVF), `HOME=/system/bin` for the first cases: | Case | master | this PR | |---|---|---| | `~/globtilde`, `GLOB_TILDE` | does not compile | `/system/bin/globtilde`: PASS | | `~`, `GLOB_TILDE` | does not compile | `/system/bin`: PASS | | `~root`, `GLOB_TILDE` | does not compile | the home directory of root: PASS | | `~` with `HOME` unset | does not compile | `getpwuid(getuid())->pw_dir`: PASS | | `~nosuchuser/x`, `GLOB_TILDE \| GLOB_NOCHECK` | does not compile | the pattern as it is: PASS | | `~nosuchuser/x`, `GLOB_TILDE_CHECK` | does not compile | `GLOB_NOMATCH`: PASS | | `~/x`, `GLOB_NOCHECK` (no tilde flag) | does not compile | `~/x`: PASS | ostest exits with status 0 on `qemu-armv8a:knsh` and `qemu-armv8a:nsh`. Build, each OK: `qemu-armv8a:nsh` (flat, arm64), `qemu-armv8a:knsh` (kernel, arm64), `rv-virt:pnsh64` (protected, rv64), `rv-virt:knsh64` (kernel, rv64), `lm3s6965-ek:qemu-protected` (protected, armv7-m). `tools/checkpatch.sh -c -u -m -g` passes. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
