Re: Tilde (~) in bash(1) is typeset incorrectly as Unicode character

2023-07-30 Thread Bjarni Ingi Gislason
On Sun, Jul 30, 2023 at 02:05:19AM +, Bjarni Ingi Gislason wrote:
>   Simply add
> 
> .if t .tr ~\(ti
> 
>   to "tmac/an.tmac",
> instead of changing (hard coding) it in the sources (man pages).

Correction:

  Drop '.if t' as -Tutf8 is an nroff mode.



Re: Tilde (~) in bash(1) is typeset incorrectly as Unicode character

2023-07-30 Thread Bjarni Ingi Gislason
  Simply add

.if t .tr ~\(ti

  to "tmac/an.tmac",
instead of changing (hard coding) it in the sources (man pages).



Re: git amend commit with backticks on cli causes tty to crash

2023-07-30 Thread Ángel
On 2023-07-20 at 10:31 -0700, Wiley Young wrote:
> But of course, I forgot the second single quote! Press [Ctrl-d].
> 
> #+++
> bash: unexpected EOF while looking for matching `''
> #+++
> 
> Add one single quote, press [Ctrl-d}; no response. Press [enter] and
> [ctrl-d]:
> 
> #+++
> bash: unexpected EOF while looking for matching `''
> #+++
> 
> Press [ctrl-d] again and tab (tty 5) crashes.

This is not a bug. It can be simplified as:

$ echo '
> ^D
bash: unexpected EOF while looking for matching `''
bash: syntax error: unexpected end of file
$ ^D


A ^D (Ctrl+D) sends an EOF.

If you have a command with incomplete quoting when it reaches EOF,
bash complains "unexpected EOF while looking for matching" and stops
the parsing.

At this point you are at a normal shell prompt, not continuing the
previous command.
If you do a Ctrl-D instead of entering any command, bash finishes. And
the tty is closed when the shell finishes, as well as your xfce4-
terminal tab (some terminal emulators have a configuration setting for
not closing the tab, though). It's not a crash.

Regards






Re: git amend commit with backticks on cli causes tty to crash

2023-07-30 Thread Martin D Kealey
On Fri, 21 Jul 2023, 03:31 Wiley Young,  wrote:

> The first time I saw this bug, tty3 crashed and isn't available any more
> in /dev/pts . Partially reproducing the bug, ttys have crashed but they
> become available for use again when I press Ctrl-Shift-t from
> xfce4-terminal.
>

Point of order, this is NOT a crash.

It's important to understand that the terminal emulator and the Shell are
separate processes that know very little about each other.

>
A ptx/pty pair is what connects them, as a pair of pseudo serial devices in
the kernel. If that crashed your whole machine would panic and reboot.

A terminal emulator will normally close its ptx connection automatically
when there are no processes still connected to the corresponding pty. In
Linux this triggers the kernel to destroy the pty entirely. Some terminal
emulators can be configured not to close immediately, but it's not the
default.

You also mentioned /dev/tty3, which is the Linux VT (console) #3. It
doesn't do anything when its connected process goes away, BUT the system
init process will notice when your Shell terminates, and run a new login
process, and THAT will often send a request to clear the screen.

But of course, I forgot the second single quote! Press [Ctrl-d].
>

Without the quote, the Shell is still waiting for the closing quote; it
never actually runs git.

So when you press ctrl-D to signal end of input, that's sent to the shell.

This has the same meaning as reaching the end of an actual file (containing
a script): there is nothing more for the Shell to do, so it exits.

For an interactive Shell this can be prevented by setting IGNOREEOF=5 (e.g.
in ~/.bashrc), however there's a known issue that this can be unreliable
when the Shell is looking for a quote mark or other closing token, meaning
that it may still exit immediately despite that setting.

(The number assigned to IGNOREEOF indicates how many times you have to type
ctrl-D to cause the Shell to exit. Numbers in the range 3-15 can be useful)

-Martin


Re: comments inside command subst are handled inconsistently

2023-07-30 Thread Martin D Kealey
On Sun, 30 Jul 2023, 08:22 Chet Ramey,  wrote:

> On 7/28/23 1:51 PM, Martin D Kealey wrote:
>
> > maybe it's time to start issuing a warning
> > when [backticks are] used at all? 🤪
>
> There's no reason to use `` over $(...), but that form is still a required
> POSIX expansion.


Oh, then only warn when set +o posix and shopt -u
compat_im_too_lazy_to_fix_backticks is in effect!

(Insert large tongue-in-cheek smiley)

Seriously though, the internet is awash with "helpful" Shell guides and
examples loaded with poor practices. The only way this is going to improve
is if there's a "linting mode" is included in the Shell and on by default.

Consider this a feature request for a linting mode, on when invoked with
bash -n or bash6.

-Martin