Re: purposes of quotearg
Pádraig Brady <[email protected]>
| Newsgroups | gmane.comp.lib.gnulib.bugs |
|---|---|
| Message-ID | <[email protected]> |
On 29/05/2026 23:51, Bruno Haible via Gnulib discussion list wrote: > Hi, > > I would like to document, in quotearg.h, the possible purposes of the > 'quotearg' module. > > Clearly, not all *_quoting_style styles fulfil all the possible purposes. > But once we have a list of possible purposes, we can make up the matrix > which style fulfils which purposes. > > The purposes I can think of are the following: > > * Avoid ambiguous diagnostics. For instance, if 'E.T.' is the name of > a network interface: > program: cannot connect to E.T. > is ambiguous, whereas > program: cannot connect to 'E.T.' > is less ambiguous. > > * Avoid emitting escape sequences that, by virtue of being ANSI > escape sequences <https://en.wikipedia.org/wiki/ANSI_escape_code>, > may cause trouble in the terminal, including (but not limited to) > - displaying fake results, > - crashing the terminal. > For instance, create a file like this: > $ touch `printf 'fooinv\x1b[3Dbar'` > Then some diagnostics might make the user think that they are about > 'foobar'. > > * Avoid printing characters that are "unprintable" in the terminal's > encoding. If that encoding is not UTF-8, they would typically leave > no traces on screen, thus end up presenting misleading results. > > Other purposes that I missed? Avoid printing shell meta-characters, which may cause side effects if pasted back to a shell command.