[LINUX] Error handling when updating Fish shell

Fish shell now throws an error after updating Ubuntu packages

Recently (February 25, 2020), when I updated according to the update request of Ubuntu, the following error came to occur when starting Fish shell. According to apt history, the fish shell has been updated.

The error that is occurring

~/.config/fish/functions/fish_prompt.fish (line 162): Expected a string, but instead found a '&'
      git rev-parse --quiet --verify HEAD > /dev/null ^&1; or set empty 1
                                                       ^
from sourcing file ~/.config/fish/functions/fish_prompt.fish
in command substitution
source: Error while reading file '/home/dev-user/.config/fish/functions/fish_prompt.fish'
Welcome to fish, the friendly interactive shell

Also, not only the error but also the prompt is displayed differently as follows.

dev-user@thinkpad /home/dev-user >

In my environment, it should be displayed as simple as ">" when I am in $ HOME.

environment

Ubuntu 18.04.4 LTS fish-common:amd64 (3.0.2-1~bionic, 3.1.0-1~bionic) fish:amd64 (3.0.2-1~bionic, 3.1.0-1~bionic)

I have Ubuntu natively installed on my ThinkPad X1C 2017 as a desktop OS. The terminal software uses terminator 1.91.

First aid

Probably the cause ~/.config/fish/functions/fish_prompt.fish The 162nd line of is as follows.

      git rev-parse --quiet --verify HEAD > /dev/null ^&1; or set empty 1

The "^ & 1" part is the problem. In fish, "^" seems to indicate an error output (reference), so I imagine that I made a mistake trying to synthesize the descriptor. And changed as follows.

      git rev-parse --quiet --verify HEAD > /dev/null 2>&1; or set empty 1

For the time being, the error has disappeared.

Interpretation

This time, the error output was combined with the standard output, and the result was passed to null to hide all the outputs. When I changed the pattern so that the standard output is not erased, the git rev-parse ~~ command is executed every time the folder is moved, and in the directory under git management that has a difference from HEAD, it looks like a hash string. Is now displayed. Since it is strange that such a display appears at the prompt, I imagined that it was the intention of the implementer to hide it including the error output, but I took the above measures, but use it at my own risk. ..

Recommended Posts

Error handling when updating Fish shell
Error handling when installing mecab-python
Mainframe error handling
Python Error Handling
SikuliX error handling
django.db.migrations.exceptions.InconsistentMigrationHistory error handling
Summary of error handling methods when installing TensorFlow (2)
Error handling in PythonBox
GraphQL (gqlgen) error handling
Around feedparser error handling
What to do when a Remove Error occurs when updating conda
[Error countermeasures] django-heroku installation error handling
About FastAPI ~ Endpoint error handling ~
Error when playing with python
PyCUDA build error handling memorandum
polyfit error when installing matplotlib
Atom: Note for Indentation Error when copying Python script to shell