Robert Elz wrote in
 <21180.1635554...@jinx.noi.kre.to>:
 |    Date:        Sat, 30 Oct 2021 02:23:40 +0200
 |    From:        Steffen Nurpmeso <stef...@sdaoden.eu>
 |    Message-ID:  <20211030002340.gtkvv%stef...@sdaoden.eu>
 |
 || Dear Robert Elz, on the other hand
 ||
 ||   #?127|unstable9s:$ /usr/xpg4/bin/sh  -c -- "echo Robert, let's sally"
 ||   Robert, lets sally
 ||   #?0|unstable9s:$ ll /usr/xpg4/bin/sh
 ||   -r-xr-xr-x   1 root     bin       202164 Mar 19  2012 /usr/xpg4/bin/sh*
 |
 |It isn't a question of sh support for -c --, we have to take that
 |as given (or we couldn't possibly want system() and popen() to use it).
 |What matters is libc support for use of the "--" in system() and popen()
 |so that all of those applications that are failing today because when
 |they try system("-some-tool") it fails currently don't need to be altered
 |to change that to be system(" -some-tool");

Ok, sure.  Even though it leads to nothing but syntax errors,
i think it is better to be explicit and add the -- instead of
documenting as below by and for Linux man-pages.  It can only
become better in the future, and maybe some code paths here and
there can avoid checking leading hyphen-minus and adding spaces in
some time from now on.

BUGS
   If  the command name starts with a hyphen, sh(1) interprets the command
   name as an option, and the behavior is undefined.  (See the  -c  option
   to  sh(1).)   To  work  around this problem, prepend the command with a
   space as in the following call:

           system(" -unfortunate-command-name");

I did not mention it in my commit message, but i wondered that
i never have seen that it is "c" not "c:" aka takes an argument,
which is why i implemented it right away after i consciously saw
Geoff Clare's "--" proposal, who got the according credit.
This was 02:30 am and therefore many hours before your message to
the NetBSD mailing list.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)

    • Re: Interpreta... Nick Stoughton via austin-group-l at The Open Group
    • Re: Interpreta... Robert Elz via austin-group-l at The Open Group
      • Re: Interp... Eric Blake via austin-group-l at The Open Group
      • Re: Interp... Robert Elz via austin-group-l at The Open Group
        • Re: In... Steffen Nurpmeso via austin-group-l at The Open Group
        • Re: In... Robert Elz via austin-group-l at The Open Group
          • Re... Stephane Chazelas via austin-group-l at The Open Group
            • ... Vincent Lefevre via austin-group-l at The Open Group
            • ... Stephane Chazelas via austin-group-l at The Open Group
            • ... Vincent Lefevre via austin-group-l at The Open Group
          • Re... Steffen Nurpmeso via austin-group-l at The Open Group
        • Re: In... Geoff Clare via austin-group-l at The Open Group
  • Re: Interpretation ... Steffen Nurpmeso via austin-group-l at The Open Group
  • Re: Interpretation ... Robert Elz via austin-group-l at The Open Group

Reply via email to