[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Escaped percent sign in shell escape (bang) command (ed 1.16)
From: |
Antonio Diaz Diaz |
Subject: |
Re: Escaped percent sign in shell escape (bang) command (ed 1.16) |
Date: |
Wed, 12 Jan 2022 17:27:31 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 |
Andrew L. Moore wrote:
There are a couple of issues that I'd encourage you to explore:
Thank you. Your suggestions are very welcome. :-)
1) Though POSIX doesn't specify ed's behavior when commands are read
from a pipe, historically, errors do not cause ed to exit.
Nonetheless, errors should be reported, even with option -s, which
POSIX is very explicit about, i.e., from
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ed.html:
-s
Suppress the writing of byte counts by e, E, r, and
w commands and of the '!' prompt after a !command.
This is something I plan to implement in GNU ed and also in zcmp from zutils
because the POSIX cmp manual states that "Future versions of this standard
may require that diagnostic messages are written to standard error when the
-s option is specified."[1].
[1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/cmp.html
I have not done it yet because GNU requires that "Every program accepting
'--quiet' should accept '--silent' as a synonym" and vice versa.[2]
[2] http://www.gnu.org/prep/standards/html_node/Option-Table.html
My plan to implement it in GNU ed is to follow your original suggestion of
using --script as the long name for -s and introduce the short option -q as
a synonym of both '--quiet' and '--silent'.
BTW, it seems that -s still suppress diagnostics in the three BSDs. See for
example http://man.netbsd.org/ed.1
"-s Suppress diagnostics. This should be used if ed standard input
is from a script."
2) Backslash-escape processing of filenames should be restricted to a
leading exclamation mark, if any, or eliminated altogether. The
intent of backslash escape processing was to support reading files
whose names begin with an exclamation mark without forking a shell.
But systemd, in particular, likes to generate files and directories
with backslashes (see, for example,
https://www.freedesktop.org/software/systemd/man/systemd-escape.html#).
This is problematic for
commands like `systemctl edit' if your editor is set to ed.
Thanks. I'll look into this as time permits.
Best regards,
Antonio.