Opened 4 years ago

Last modified 12 months ago

#16257 new enhancement

wordexp is unsupported

Reported by: ddevault Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: System/POSIX Version: R1/beta2
Keywords: Cc: davidkaroly
Blocked By: Blocking:
Platform: All

Description

Change History (4)

comment:1 by davidkaroly, 22 months ago

Cc: davidkaroly added

comment:2 by davidkaroly, 22 months ago

This should be easily adaptable from MUSL, see: https://git.musl-libc.org/cgit/musl/tree/src/misc/wordexp.c

However... MUSL wordexp implementation uses pipe2 which is non-POSIX (but it's there in most actual implementations like Linux, FreeBSD, Illumos, MUSL)

So if we want to be really careful then we should implement _pipe2() in libroot and use that from wordexp. Then we can export pipe2() from libbsd. Or just make a shortcut and define pipe2() in libroot - the question is: do we think there might be open source POSIX software that wants to redefine pipe2.

comment:3 by waddlesplash, 22 months ago

It's worth noting that OpenBSD does not support wordexp at all (probably because there is no "safe" way to implement it; note the musl implementation invokes /bin/sh!) So I'm not entirely sure we should support it either.

comment:4 by davidkaroly, 22 months ago

yes the backtick handling in musl is not so nice

eh forget about my previous comment that was completely off the mark.

MUSL does the same thing as FreeBSD, NetBSD, DragonflyBSD which is doing the whole thing with sh - so you're right, this does not look like a good way forward.

This leaves us with either the current situation (no wordexp) or adapt from glibc which does seem to have a more proper implementation. (calling out to shell only for the backticks and dollar-parentheses)

Last edited 22 months ago by davidkaroly (previous) (diff)
Note: See TracTickets for help on using tickets.