[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
git amend commit with backticks on cli causes tty to crash
From: |
Wiley Young |
Subject: |
git amend commit with backticks on cli causes tty to crash |
Date: |
Thu, 20 Jul 2023 10:31:47 -0700 |
Hi,
I'm seeing this behavior on Fedora 38. Possibly it's just some user error
again, since i'm figuring out how to use vim and git at a slightly above
novice level. :-)
#+++++++++++++++++++++++++++
$ uname -a
Linux localhost-live 6.3.7-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jun
9 15:21:11 UTC 2023 x86_64 GNU/Linux
$ vim --version | head -n 3
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Jun 05 2023 00:00:00)
Included patches: 1-1607
Modified by <bugzilla@redhat.com>
$ cat ~/.vimrc | grep -v ^'"'
set number
filetype plugin indent on
set tabstop=2
set shiftwidth=2
set expandtab
autocmd BufWritePost * execute '! if [[ -d ./.git ]] ; then git commit -S
-a --file=- --verbose ; fi'
$ git --version
git version 2.41.0
$ bash --version
GNU bash, version 5.2.15(1)-release (x86_64-redhat-linux-gnu)
$ xfce4-terminal --version
xfce4-terminal 1.0.4 (Xfce 4.18)
#+++++++++++++++++++++++++++
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.
#+++++++++++++++++++++++++++
[liveuser@localhost-live ~]$ tty
/dev/pts/4
[liveuser@localhost-live ~]$ ls /dev/pts
0 1 2 4 ptmx
#+++++++++++++++++++++++++++
The original pre-amend commit message was 'LiveUsb1: At error handling, add
if block to `source ./functions.bash`'. From within vim (and tty6), I'd
place an additional '#' at line 30 and press ':w'.
#+++++++++++++++++++++++++++
30 # <> debug string ##
31
32 unset -f er_x rm_oa
33 function er_x(){ : ; local exit_code="$?" ; echo -e Error: "$@" >&2 ;
exit "${exit_code}"; }
34 ## rm_oa: '--' is placed at fn call
35 function rm_oa(){ :
"./LiveUsb1" 653L, 20976B written
:!if [[ -d ./.git ]] ; then git commit -S -a --file=- --verbose ; fi
(reading log message from standard input)
#+++++++++++++++++++++++++++
After pasting in the faulty commit message, pressing [enter] and [Ctrl-d],
git shows a standard message:
#+++++++++++++++++++++++++++
LiveUsb1: At error handling, add if block to `source ./functions.bash`
[main e02d0aa] LiveUsb1: At error handling, add if block to `source
./functions.bash`
1 file changed, 1 insertion(+), 1 deletion(-)
Press ENTER or type command to continue
#+++++++++++++++++++++++++++
I'd press [enter], vim would return to normal viewing mode and pressing
':q!' would close vim. Then I'd try (on tty5) to amend the commit message
by starting a string with a single quote and adding newlines within, based
on my understanding that git reads the first line of a commit messages a
something akin to a an email subject line, and then after an empty line,
the rest of the message is parsed by git as the "details" or "body" section
of the commit message.
#+++++++++++++++++++++++++++
[liveuser@localhost-live ~]$ git -S --amend -m 'LiveUsb1: Add `source
./functions.bash`
>
> LiveUsb1: At error handling, in if-fi block at line 23
>
#+++++++++++++++++++++++++++
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.
#+++++++++++++++++++++++++++
[liveuser@localhost-live ~]$ ls /dev/pts
0 1 2 4 6 ptmx
[liveuser@localhost-live ~]$ tty
/dev/pts/4
# in xfce4-terminal: [ctrl]-[shift]-t
[liveuser@localhost-live ~]$ ls /dev/pts
0 1 2 4 5 6 ptmx
#+++++++++++++++++++++++++++
Wiley
"The bashful never learn, and the short tempered cannot teach." -- Talmud
- git amend commit with backticks on cli causes tty to crash,
Wiley Young <=