On Mon, Nov 2, 2026 at 2:45 PM Bruno Haible <[email protected]> wrote:
> > > On the platforms that have confstr(), confstr(_CS_PATH) returns > > > _PATH_STDPATH, not _PATH_DEFPATH. For instance, on NetBSD: > > > confstr(_CS_PATH) => > > > > "/usr/bin:/bin:/usr/sbin:/sbin:/usr/pkg/bin:/usr/pkg/sbin:/usr/local/bin:/usr/local/sbin" > > > _PATH_STDPATH = > > > > "/usr/bin:/bin:/usr/sbin:/sbin:/usr/pkg/bin:/usr/pkg/sbin:/usr/local/bin:/usr/local/sbin" > > > _PATH_DEFPATH = "/usr/bin:/bin:/usr/pkg/bin:/usr/local/bin" > > > > > > Anyway, on Android, where normal user programs cannot access > > > /bin/ etc. and where /bin/sh does not exist, the current directory > > > is the only reasonable fallback, I would say. > > > > > > > neither of those claims is true on current Android... > > Indeed, while on Android 4.3 I had to use /system/bin/sh, on Android 11 > there is /bin/sh. > > > an untrusted app > > can't _search_ /bin, it can execute stuff from there as long as it knows > > what it's called. and sh has there since at least android 5.0 > > So, which default PATH would you suggest for Android ≥ 5.0? _PATH_DEFPATH > = > "/product/bin:/apex/com.android.runtime/bin:/apex/com.android.art/bin:/apex/com.android.virt/bin:/system_ext/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin", > or something else? > yeah, _PATH_DEFPATH is the only path string we offer anyway, but it should be reasonable for this kind of use case. > And which binaries exist in /bin = /system/bin ? > "all the usual unix stuff [that we have]". the other stuff is probably a mistake, but nothing i cared enough about to fight. (xbin is the stuff that's not normally there on a production build, such as su. the /apex/* stuff is for things like dex2oat that are supplied by a mainline module. and all the other [non-system] partitions get to add their own bin directory. which to me has always felt as crazy as having "." on your path :-) ) > Bruno > > > >
