man-pages bug: 211029 https://bugzilla.kernel.org/show_bug.cgi?id=211029 Complete workaround (it was too long for the page, but it may be useful here): ...... $ sudo ln -s -T /usr/bin/echo /usr/bin/-echo; $ cc -o system_hyphen -x c - ; int main(void) { system(" -echo Hello world!"); exit(EXIT_SUCCESS); } $ ./system_hyphen; Hello world! Reported-by: Ciprian Dorin Craciun <ciprian.craciun@xxxxxxxxx> Cc: Florian Weimer <fweimer@xxxxxxxxxx> Signed-off-by: Alejandro Colomar <alx.manpages@xxxxxxxxx> --- Hi Michael, I forgot to remove some escapings in the commit message in v2. I hope it arrives in time :) Cheers, Alex man3/system.3 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/man3/system.3 b/man3/system.3 index 753d46f7d..ead35ab30 100644 --- a/man3/system.3 +++ b/man3/system.3 @@ -255,6 +255,26 @@ are not executed. Such risks are especially grave when using .BR system () from a privileged program. +.SH BUGS +.\" [BUG 211029](https://bugzilla.kernel.org/show_bug.cgi?id=211029) +.\" [Glibc bug](https://sourceware.org/bugzilla/show_bug.cgi?id=27143) +.\" [POSIX bug](https://www.austingroupbugs.net/view.php?id=1440) +If the command name starts with a hyphen, +.BR sh (1) +interprets the command name as an option, +and the behavior is undefined. +(See the +.B \-c +option to +.BR sh (1).) +To work around this problem, +prepend the command with a space as in the following call: +.PP +.RS 4 +.EX + system(" \-unfortunate\-command\-name"); +.EE +.RE .SH SEE ALSO .BR sh (1), .BR execve (2), -- 2.29.2