Hacker News new | ask | show | jobs
by stefan_ 2490 days ago
I thought this is what the Unix philosophy is supposed to be all about.

(Realistically, calling wordexp should just abort the program. Now I actually want to make a hacked up musl that aborts in all the various "libc functions no one should ever use" and see how far I get into a Ubuntu boot..)

3 comments

Would be pretty awesome if Perl called wordexp(3) somewhere along this code path
I seem to recall that perl used to shell out to /bin/sh for some related task...
Yep, still there in the latest perl5: Perl_start_glob https://github.com/Perl/perl5/blob/blead/doio.c

It's somewhat messier than I remember, because it uses csh as the first choice and falls back to sh.

> I thought this is what the Unix philosophy is supposed to be all about.

Perhaps from the perspective of an end user running things from a shell. Generally speaking though, shelling out from within a program is not ideal.

/* wordexp is also rife with security "challenges", unless you pass it WRDE_NOCMD it must support subshell expansion, and even if you don't beause it has to support so much of the standard shell (all the odd little variable expansion options for example) it is hard to do without a subshell). It is probbably just plan a Bad Idea to call in anything setuid, or executing remotely. */