Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Oct 2023 16:25:56 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 274650] sh does not accept -- after -c
Message-ID:  <bug-274650-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D274650

            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: bugs@FreeBSD.org
          Reporter: guillem@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 cas=
e a
command starts with a =C2=AB-=C2=BB (which would be very unusual, but=E2=80=
=A6). See
<https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=3Df013195c70995235340e9=
9107058f591175f0a57>.

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.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-274650-227>