{"thread":{"id":"48946","subject":"[PATCH v1] msvc: fix non-standard escape sequence in source","startedAt":"2018-07-24T14:43:07Z","lastAt":"2018-07-25T12:30:45Z","messageCount":5,"participants":["git@jeffhostetler.com","Eric Sunshine","Junio C Hamano","Beat Bolli","Jeff Hostetler"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"353464","messageId":"20180724144249.2857-1-git@jeffhostetler.com","threadId":"48946","inReplyTo":null,"subject":"[PATCH v1] msvc: fix non-standard escape sequence in source","fromName":"","fromEmail":"git@jeffhostetler.com","sentAt":"2018-07-24T14:42:49Z","receivedAt":"2018-07-24T14:43:07Z","isPatch":true,"sender":{"key":"git@jeffhostetler.com","avatar":null},"body":"From: Jeff Hostetler <jeffhost@microsoft.com>\n\nReplace non-standard \"\\e\" escape sequence with \"\\x1B\".\n\nIn commit 7a17918c34f4e83982456ffe22d880c3cda5384f a trace message with\nseveral \"\\e\" escape sequences was added.  This causes a compiler warning\nunder MSVC.\n\nAccording to [1], the \"\\e\" sequence is an extension supported by GCC,\nclang, and tcc.\n\n[1] https://en.wikipedia.org/wiki/Escape_sequences_in_C\n\nSigned-off-by: Jeff Hostetler <jeffhost@microsoft.com>\n---\n convert.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/convert.c b/convert.c\nindex 56cfe31..52092be 100644\n--- a/convert.c\n+++ b/convert.c\n@@ -335,7 +335,7 @@ static void trace_encoding(const char *context, const char *path,\n \tstrbuf_addf(&trace, \"%s (%s, considered %s):\\n\", context, path, encoding);\n \tfor (i = 0; i < len && buf; ++i) {\n \t\tstrbuf_addf(\n-\t\t\t&trace,\"| \\e[2m%2i:\\e[0m %2x \\e[2m%c\\e[0m%c\",\n+\t\t\t&trace,\"| \\x1B[2m%2i:\\x1B[0m %2x \\x1B[2m%c\\x1B[0m%c\",\n \t\t\ti,\n \t\t\t(unsigned char) buf[i],\n \t\t\t(buf[i] > 32 && buf[i] < 127 ? buf[i] : ' '),\n-- \n2.9.3\n\n"},{"id":"353498","messageId":"CAPig+cSzJQS9PnHgEbyUpOAQGQgWJuwZDP7nsgBMECzy2C3wkQ@mail.gmail.com","threadId":"48946","inReplyTo":"20180724144249.2857-1-git@jeffhostetler.com","subject":"Re: [PATCH v1] msvc: fix non-standard escape sequence in source","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2018-07-24T17:33:13Z","receivedAt":"2018-07-24T17:33:26Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Tue, Jul 24, 2018 at 10:43 AM <git@jeffhostetler.com> wrote:\n> Replace non-standard \"\\e\" escape sequence with \"\\x1B\".\n>\n> In commit 7a17918c34f4e83982456ffe22d880c3cda5384f a trace message with\n> several \"\\e\" escape sequences was added.  This causes a compiler warning\n> under MSVC.\n\nWrong commit. That code was actually introduced by 541d059cd9\n(convert: add tracing for 'working-tree-encoding' attribute,\n2018-04-15).\n\n> diff --git a/convert.c b/convert.c\n> @@ -335,7 +335,7 @@ static void trace_encoding(const char *context, const char *path,\n>         strbuf_addf(&trace, \"%s (%s, considered %s):\\n\", context, path, encoding);\n>         for (i = 0; i < len && buf; ++i) {\n>                 strbuf_addf(\n> -                       &trace,\"| \\e[2m%2i:\\e[0m %2x \\e[2m%c\\e[0m%c\",\n> +                       &trace,\"| \\x1B[2m%2i:\\x1B[0m %2x \\x1B[2m%c\\x1B[0m%c\",\n\nIn this codebase, ESC is always spelled as octal \\033 rather than hex \\x1b.\n"},{"id":"353501","messageId":"xmqq6014zf33.fsf@gitster-ct.c.googlers.com","threadId":"48946","inReplyTo":"20180724144249.2857-1-git@jeffhostetler.com","subject":"Re: [PATCH v1] msvc: fix non-standard escape sequence in source","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-07-24T18:03:12Z","receivedAt":"2018-07-24T18:03:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"git@jeffhostetler.com writes:\n\n> From: Jeff Hostetler <jeffhost@microsoft.com>\n>\n> Replace non-standard \"\\e\" escape sequence with \"\\x1B\".\n>\n> In commit 7a17918c34f4e83982456ffe22d880c3cda5384f a trace message with\n> several \"\\e\" escape sequences was added.  This causes a compiler warning\n> under MSVC.\n>\n> According to [1], the \"\\e\" sequence is an extension supported by GCC,\n> clang, and tcc.\n\nGood spotting.  Please spell it \\x1b (or \\033 if you are a\ntraditionalist), as it seems nobody in the existing code uses\nuppercase, according to\n\n    $ git grep -e '\\\\x[A-F][0-9A-F]' -e '\\\\x[0-9A-F][A-F]' \\*.c\n\nand \"\\033\"  is already used in many places\n\n    $ git grep -e '\\\\0[0-7][0-7]' \\*.c\n\n\n\n> [1] https://en.wikipedia.org/wiki/Escape_sequences_in_C\n>\n> Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>\n> ---\n>  convert.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/convert.c b/convert.c\n> index 56cfe31..52092be 100644\n> --- a/convert.c\n> +++ b/convert.c\n> @@ -335,7 +335,7 @@ static void trace_encoding(const char *context, const char *path,\n>  \tstrbuf_addf(&trace, \"%s (%s, considered %s):\\n\", context, path, encoding);\n>  \tfor (i = 0; i < len && buf; ++i) {\n>  \t\tstrbuf_addf(\n> -\t\t\t&trace,\"| \\e[2m%2i:\\e[0m %2x \\e[2m%c\\e[0m%c\",\n> +\t\t\t&trace,\"| \\x1B[2m%2i:\\x1B[0m %2x \\x1B[2m%c\\x1B[0m%c\",\n>  \t\t\ti,\n>  \t\t\t(unsigned char) buf[i],\n>  \t\t\t(buf[i] > 32 && buf[i] < 127 ? buf[i] : ' '),\n"},{"id":"353503","messageId":"e443fe24-e072-d11c-a6b0-53e7de8a7f5c@drbeat.li","threadId":"48946","inReplyTo":"20180724144249.2857-1-git@jeffhostetler.com","subject":"Re: [PATCH v1] msvc: fix non-standard escape sequence in source","fromName":"Beat Bolli","fromEmail":"dev+git@drbeat.li","sentAt":"2018-07-24T18:13:00Z","receivedAt":"2018-07-24T18:13:13Z","isPatch":true,"sender":{"key":"dev+git@drbeat.li","avatar":"https://avatars.githubusercontent.com/u/21444?v=4"},"body":"Hi Jeff\n\nOn 24.07.18 16:42, git@jeffhostetler.com wrote:\n> From: Jeff Hostetler <jeffhost@microsoft.com>\n> \n> Replace non-standard \"\\e\" escape sequence with \"\\x1B\".\n\nThis was already fixed in <20180708144342.11922-4-dev+git@drbeat.li>.\n\nCheers,\nBeat\n\n\n> \n> In commit 7a17918c34f4e83982456ffe22d880c3cda5384f a trace message with\n> several \"\\e\" escape sequences was added.  This causes a compiler warning\n> under MSVC.\n> \n> According to [1], the \"\\e\" sequence is an extension supported by GCC,\n> clang, and tcc.\n> \n> [1] https://en.wikipedia.org/wiki/Escape_sequences_in_C\n> \n> Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>\n> ---\n>  convert.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/convert.c b/convert.c\n> index 56cfe31..52092be 100644\n> --- a/convert.c\n> +++ b/convert.c\n> @@ -335,7 +335,7 @@ static void trace_encoding(const char *context, const char *path,\n>  \tstrbuf_addf(&trace, \"%s (%s, considered %s):\\n\", context, path, encoding);\n>  \tfor (i = 0; i < len && buf; ++i) {\n>  \t\tstrbuf_addf(\n> -\t\t\t&trace,\"| \\e[2m%2i:\\e[0m %2x \\e[2m%c\\e[0m%c\",\n> +\t\t\t&trace,\"| \\x1B[2m%2i:\\x1B[0m %2x \\x1B[2m%c\\x1B[0m%c\",\n>  \t\t\ti,\n>  \t\t\t(unsigned char) buf[i],\n>  \t\t\t(buf[i] > 32 && buf[i] < 127 ? buf[i] : ' '),\n> \n\n\n"},{"id":"353562","messageId":"9559a485-1977-d7e8-1bfb-ab2b65b60c02@jeffhostetler.com","threadId":"48946","inReplyTo":"e443fe24-e072-d11c-a6b0-53e7de8a7f5c@drbeat.li","subject":"Re: [PATCH v1] msvc: fix non-standard escape sequence in source","fromName":"Jeff Hostetler","fromEmail":"git@jeffhostetler.com","sentAt":"2018-07-25T12:30:40Z","receivedAt":"2018-07-25T12:30:45Z","isPatch":true,"sender":{"key":"git@jeffhostetler.com","avatar":null},"body":"\n\nOn 7/24/2018 2:13 PM, Beat Bolli wrote:\n> Hi Jeff\n> \n> On 24.07.18 16:42, git@jeffhostetler.com wrote:\n>> From: Jeff Hostetler <jeffhost@microsoft.com>\n>>\n>> Replace non-standard \"\\e\" escape sequence with \"\\x1B\".\n> \n> This was already fixed in <20180708144342.11922-4-dev+git@drbeat.li>.\n> \n> Cheers,\n> Beat\n> \n\nThanks for the pointer.  I see that commit is in 'next'.\nI was only looking in 'master'.\n\nThanks,\nJeff\n\n"}]}