\b character escapes in CLI usage
- From
- Yaakov Smith <yaakov.smith@wisetechglobal.com>
- Date
- Feb 25, 2025, 23:44 UTC
- Message-ID
- <SYBPR01MB579278DD5EC6E13CA9A213FDE2C32@SYBPR01MB5792.ausprd01.prod.outlook.com>
Hi all,
I'm not sure if this is a bug, but it definitely feels like a bug.
A colleague of mine was going through the documentation for the git configuration file format and noticed that \b is a permitted escape.
In some places, such as trying to fetch a remote with this in the URL, git will render the character differently.
[remote "backslashb"]
url = "\b"
fetch = +refs/heads/*:refs/remotes/backslashb/*$ git fetch backslashb fatal: '?' does not appear to be a git repository fatal: Could not read from remote repository.
When using "git config --list" however, this is emitted in its raw format, and can be used to mask or hide an actual (probably invalid) value:
$ cat .git/config
[core]
somevalue = "true\b\b\b\bfalse"
$ git config --local --list
core.somevalue=falseShould "git config" be smarter here and print something other than a literal backspace to the terminal, like "git fetch" does?
[System Info] git version: git version 2.34.1 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Linux 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 compiler info: gnuc: 11.4 libc info: glibc: 2.35 $SHELL (typically, interactive shell): /bin/bash
Kind regards, Yaakov Smith Principal Software Engineer Pronouns: he/him e yaakov.smith@wisetechglobal.com t +61 (2) 8001 2200 d +61 (2) 8986 2753 wisetechglobal.com
Enabling and empowering the world's supply chains. This email is subject to our Confidentiality Statement