https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=274650

            Bug ID: 274650
           Summary: sh does not accept -- after -c
           Product: Base System
           Version: 13.2-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: b...@freebsd.org
          Reporter: guil...@hadrons.org

After having seen a similar change implemented for glibc, I did the same in
dpkg to make its shell invocations more robust and avoid missparsing in case a
command starts with a «-» (which would be very unusual, but…). See
<https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=f013195c70995235340e99107058f591175f0a57>.

Just noticed afterwards that this did not work on FreeBSD's /bin/sh:

  ,---
  $ sh -c -- "echo \$0" name arg
  echo $0: --: not found
  `---

This though seems to work fine on posh, dash, ksh93, bash, and the default sh
on NetBSD, OpenBSD, Solaris and macOS. But neither on sh, ksh nor bsh on AIX
7.3.

For now I guess I'll need to make its usage conditional on the system.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to