Date: Mon, 29 Apr 2024 15:07:27 +0000 From: bugzilla-noreply@freebsd.org To: standards@FreeBSD.org Subject: [Bug 278653] sh: fix sh -c -e cmd as per POSIX Message-ID: <bug-278653-99@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D278653 Bug ID: 278653 Summary: sh: fix sh -c -e cmd as per POSIX Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: standards Assignee: standards@FreeBSD.org Reporter: naddy@FreeBSD.org Created attachment 250294 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D250294&action= =3Dedit fix sh -c -e cmd as per POSIX POSIX requires sh(1) to handle -c like an option that does not take an argument. We already handle the special case of attached options after -c... $ sh -ce 'echo hello world' hello world ... but these fail: $ sh -c -e 'echo hello world' echo hello world: -e: not found $ sh -c -- 'echo hello world' echo hello world: --: not found NetBSD fixed this 21 years ago. With their fix: $ sh -c -e 'echo hello world' hello world $ sh -c -- 'echo hello world' hello world $ sh -c -e 'echo hello; false; echo world' hello Patch attached. I also added a minimal regression test. I have only tested this on 14-STABLE, but there are no relevant changes bet= ween 14-STABLE and 15-CURRENT in sh. --=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-278653-99>