{"thread":{"id":"48131","subject":"[RFC PATCH 0/1] json-writer: incorrect format specifier","startedAt":"2018-03-24T05:37:23Z","lastAt":"2018-03-27T10:24:41Z","messageCount":12,"participants":["Wink Saville","Jeff Hostetler","Ramsay Jones","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":1},"messages":[{"id":"342724","messageId":"cover.1521868951.git.wink@saville.com","threadId":"48131","inReplyTo":null,"subject":"[RFC PATCH 0/1] json-writer: incorrect format specifier","fromName":"Wink Saville","fromEmail":"wink@saville.com","sentAt":"2018-03-24T05:37:10Z","receivedAt":"2018-03-24T05:37:23Z","isPatch":true,"sender":{"key":"wink@saville.com","avatar":"https://avatars.githubusercontent.com/u/1024284?v=4"},"body":"Building the pu branch at commit 8b49f5c076c using Travis-CI all\nof the linux builds are green but the two OSX builds are red[1] and\nthe logs show compile errors:\n\n    CC ident.o\n    CC json-writer.o\n\njson-writer.c:123:38:  error:  format specifies type 'uintmax_t' (aka 'unsigned long') but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]\n\n        strbuf_addf(&jw->json, \":%\"PRIuMAX, value);\n                                 ~~         ^~~~~\njson-writer.c:228:37:  error:  format specifies type 'uintmax_t' (aka 'unsigned long') but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat] [0m\n\n        strbuf_addf(&jw->json, \"%\"PRIuMAX, value);\n                                ~~         ^~~~~\n2 errors generated.\nmake: *** [json-writer.o] Error 1\nmake: *** Waiting for unfinished jobs....\n\n[RFC Patch 1/1] changes the PRIuMax to PRIu64 to correct the compile error\nand now Travis-CI is green [2].\n\n[1]: https://travis-ci.org/winksaville/git/builds/357660624\n[2]: https://travis-ci.org/winksaville/git/builds/357681929\n\nWink Saville (1):\n  json-writer: incorrect format specifier\n\n json-writer.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\n-- \n2.16.2\n\n"},{"id":"342725","messageId":"140b7646e7efa4175f9d82e6eb2909f2f94771fe.1521868951.git.wink@saville.com","threadId":"48131","inReplyTo":"cover.1521868951.git.wink@saville.com","subject":"[RFC PATCH 1/1] json-writer: incorrect format specifier","fromName":"Wink Saville","fromEmail":"wink@saville.com","sentAt":"2018-03-24T05:37:11Z","receivedAt":"2018-03-24T05:37:25Z","isPatch":true,"sender":{"key":"wink@saville.com","avatar":"https://avatars.githubusercontent.com/u/1024284?v=4"},"body":"In routines jw_object_uint64 and jw_object_double strbuf_addf is\ninvoked with strbuf_addf(&jw->json, \":%\"PRIuMAX, value) where value\nis a uint64_t. This causes a compile error on OSX.\n\nThe correct format specifier is PRIu64 instead of PRIuMax.\n\nSigned-off-by: Wink Saville <wink@saville.com>\n---\n json-writer.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/json-writer.c b/json-writer.c\nindex 89a6abb57..04045448a 100644\n--- a/json-writer.c\n+++ b/json-writer.c\n@@ -120,7 +120,7 @@ void jw_object_uint64(struct json_writer *jw, const char *key, uint64_t value)\n \tmaybe_add_comma(jw);\n \n \tappend_quoted_string(&jw->json, key);\n-\tstrbuf_addf(&jw->json, \":%\"PRIuMAX, value);\n+\tstrbuf_addf(&jw->json, \":%\"PRIu64, value);\n }\n \n void jw_object_double(struct json_writer *jw, const char *fmt,\n@@ -225,7 +225,7 @@ void jw_array_uint64(struct json_writer *jw, uint64_t value)\n \tassert_in_array(jw);\n \tmaybe_add_comma(jw);\n \n-\tstrbuf_addf(&jw->json, \"%\"PRIuMAX, value);\n+\tstrbuf_addf(&jw->json, \"%\"PRIu64, value);\n }\n \n void jw_array_double(struct json_writer *jw, const char *fmt, double value)\n-- \n2.16.2\n\n"},{"id":"342813","messageId":"d6af477d-6865-9580-0389-182a5c19d935@jeffhostetler.com","threadId":"48131","inReplyTo":"140b7646e7efa4175f9d82e6eb2909f2f94771fe.1521868951.git.wink@saville.com","subject":"Re: [RFC PATCH 1/1] json-writer: incorrect format specifier","fromName":"Jeff Hostetler","fromEmail":"git@jeffhostetler.com","sentAt":"2018-03-24T11:11:59Z","receivedAt":"2018-03-24T11:12:06Z","isPatch":true,"sender":{"key":"git@jeffhostetler.com","avatar":null},"body":"\n\nOn 3/24/2018 1:37 AM, Wink Saville wrote:\n> In routines jw_object_uint64 and jw_object_double strbuf_addf is\n> invoked with strbuf_addf(&jw->json, \":%\"PRIuMAX, value) where value\n> is a uint64_t. This causes a compile error on OSX.\n> \n> The correct format specifier is PRIu64 instead of PRIuMax.\n> \n> Signed-off-by: Wink Saville <wink@saville.com>\n\nThat's odd.\n\nA grep on the Git source tree did not find a \"PRIu64\" symbol.\nSearching public-inbox only found one message [1] talking about it\n(other than the ones associated with your messages here).\n\nI have to wonder if that is defined in a OSX header file and\nyou're getting it from there [2].  (I don't have a MAC in front of\nme, so I can't verify what's in that header.)  But [2] defines\nPRIuMAX as PRIu64, so we shouldn't need to make that change in\njson-writer -- unless something is getting lost in the #ifdefs.\n\nCould you double check this in the header files on your system?\nAny chance you are doing a 32-bit build?\n\nThanks\nJeff\n\n[1] \nhttps://public-inbox.org/git/MWHPR21MB0478181AE0B64901DA2C07CDF4600@MWHPR21MB0478.namprd21.prod.outlook.com/raw\n\n[2] https://opensource.apple.com/source/gcc/gcc-926/inttypes.h.auto.html\n\n\n> ---\n>   json-writer.c | 4 ++--\n>   1 file changed, 2 insertions(+), 2 deletions(-)\n> \n> diff --git a/json-writer.c b/json-writer.c\n> index 89a6abb57..04045448a 100644\n> --- a/json-writer.c\n> +++ b/json-writer.c\n> @@ -120,7 +120,7 @@ void jw_object_uint64(struct json_writer *jw, const char *key, uint64_t value)\n>   \tmaybe_add_comma(jw);\n>   \n>   \tappend_quoted_string(&jw->json, key);\n> -\tstrbuf_addf(&jw->json, \":%\"PRIuMAX, value);\n> +\tstrbuf_addf(&jw->json, \":%\"PRIu64, value);\n>   }\n>   \n>   void jw_object_double(struct json_writer *jw, const char *fmt,\n> @@ -225,7 +225,7 @@ void jw_array_uint64(struct json_writer *jw, uint64_t value)\n>   \tassert_in_array(jw);\n>   \tmaybe_add_comma(jw);\n>   \n> -\tstrbuf_addf(&jw->json, \"%\"PRIuMAX, value);\n> +\tstrbuf_addf(&jw->json, \"%\"PRIu64, value);\n>   }\n>   \n>   void jw_array_double(struct json_writer *jw, const char *fmt, double value)\n> \n"},{"id":"342822","messageId":"4f4221d9-2ad9-2282-d26f-412ba0bfd719@ramsayjones.plus.com","threadId":"48131","inReplyTo":"140b7646e7efa4175f9d82e6eb2909f2f94771fe.1521868951.git.wink@saville.com","subject":"Re: [RFC PATCH 1/1] json-writer: incorrect format specifier","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2018-03-24T15:14:03Z","receivedAt":"2018-03-24T15:14:11Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\n\nOn 24/03/18 05:37, Wink Saville wrote:\n> In routines jw_object_uint64 and jw_object_double strbuf_addf is\n> invoked with strbuf_addf(&jw->json, \":%\"PRIuMAX, value) where value\n> is a uint64_t. This causes a compile error on OSX.\n> \n> The correct format specifier is PRIu64 instead of PRIuMax.\n> \n> Signed-off-by: Wink Saville <wink@saville.com>\n> ---\n>  json-writer.c | 4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n> \n> diff --git a/json-writer.c b/json-writer.c\n> index 89a6abb57..04045448a 100644\n> --- a/json-writer.c\n> +++ b/json-writer.c\n> @@ -120,7 +120,7 @@ void jw_object_uint64(struct json_writer *jw, const char *key, uint64_t value)\n>  \tmaybe_add_comma(jw);\n>  \n>  \tappend_quoted_string(&jw->json, key);\n> -\tstrbuf_addf(&jw->json, \":%\"PRIuMAX, value);\n> +\tstrbuf_addf(&jw->json, \":%\"PRIu64, value);\n\nIn this code-base, that would normally be written as:\n\n\tstrbuf_addf(&jw->json, \":%\"PRIuMAX, (uintmax_t) value);\n\nATB,\nRamsay Jones\n"},{"id":"342823","messageId":"c8628770-71d7-42f4-4bc5-444ea0160d26@ramsayjones.plus.com","threadId":"48131","inReplyTo":"4f4221d9-2ad9-2282-d26f-412ba0bfd719@ramsayjones.plus.com","subject":"Re: [RFC PATCH 1/1] json-writer: incorrect format specifier","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2018-03-24T16:07:43Z","receivedAt":"2018-03-24T16:07:52Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\n\nOn 24/03/18 15:14, Ramsay Jones wrote:\n> \n> \n> On 24/03/18 05:37, Wink Saville wrote:\n>> In routines jw_object_uint64 and jw_object_double strbuf_addf is\n>> invoked with strbuf_addf(&jw->json, \":%\"PRIuMAX, value) where value\n>> is a uint64_t. This causes a compile error on OSX.\n>>\n>> The correct format specifier is PRIu64 instead of PRIuMax.\n>>\n>> Signed-off-by: Wink Saville <wink@saville.com>\n>> ---\n>>  json-writer.c | 4 ++--\n>>  1 file changed, 2 insertions(+), 2 deletions(-)\n>>\n>> diff --git a/json-writer.c b/json-writer.c\n>> index 89a6abb57..04045448a 100644\n>> --- a/json-writer.c\n>> +++ b/json-writer.c\n>> @@ -120,7 +120,7 @@ void jw_object_uint64(struct json_writer *jw, const char *key, uint64_t value)\n>>  \tmaybe_add_comma(jw);\n>>  \n>>  \tappend_quoted_string(&jw->json, key);\n>> -\tstrbuf_addf(&jw->json, \":%\"PRIuMAX, value);\n>> +\tstrbuf_addf(&jw->json, \":%\"PRIu64, value);\n> \n> In this code-base, that would normally be written as:\n> \n> \tstrbuf_addf(&jw->json, \":%\"PRIuMAX, (uintmax_t) value);\n\nheh, I should learn not to reply in a hurry, just before\ngoing out ...\n\nI had not noticed that 'value' was declared with an 'sized type'\nof uint64_t, so using PRIu64 should be fine. Well, except that\nyou may have to add a 'fallback' definition of PRIu64 to one of\nthe 'compat/mingw.h', 'compat/msvc.h' or 'git-compat-util.h'\nheader files. (see e.g. PRId64 at compat/mingw.h:429).\n\n[About a decade ago, I heard microsoft were implementing C99\n'real soon now' ;-) ]\n\nATB,\nRamsay Jones\n\n\n"},{"id":"342835","messageId":"cover.1521916335.git.wink@saville.com","threadId":"48131","inReplyTo":"cover.1521868951.git.wink@saville.com","subject":"[RFC PATCH 0/1] json-writer: add cast to uintmax_t","fromName":"Wink Saville","fromEmail":"wink@saville.com","sentAt":"2018-03-24T18:38:31Z","receivedAt":"2018-03-24T18:38:59Z","isPatch":true,"sender":{"key":"wink@saville.com","avatar":"https://avatars.githubusercontent.com/u/1024284?v=4"},"body":"Building the pu branch at commit 8b49f5c076c using Travis-Ci all linux\nbuilds worked but the two OSX builds failed with:\n\n    CC ident.o\n    CC json-writer.o\n\njson-writer.c:123:38: error: format specifies type 'uintmax_t' (aka 'unsigned long') but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]\n\n        strbuf_addf(&jw->json, \":%\"PRIuMAX, value);\n\njson-writer.c:228:37: error: format specifies type 'uintmax_t' (aka 'unsigned long') but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]\n\n        strbuf_addf(&jw->json, \"%\"PRIuMAX, value);\n\nCorrected in Patch 1/1 by casting value to uintmax_t.\n\nWink Saville (1):\n  json-writer: add cast to uintmax_t\n\n json-writer.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\n-- \n2.16.2\n\n"},{"id":"342836","messageId":"1a6a4983b824e7b9f4eb1f7b83a39d24f72e552f.1521916335.git.wink@saville.com","threadId":"48131","inReplyTo":"cover.1521916335.git.wink@saville.com","subject":"[RFC PATCH v2 1/1] json-writer: add cast to uintmax_t","fromName":"Wink Saville","fromEmail":"wink@saville.com","sentAt":"2018-03-24T18:38:32Z","receivedAt":"2018-03-24T18:39:02Z","isPatch":true,"sender":{"key":"wink@saville.com","avatar":"https://avatars.githubusercontent.com/u/1024284?v=4"},"body":"Correct a compile error on Mac OSX by adding a cast to uintmax_t\nin calls to strbuf_addf.\n\nHelped-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\nTested-by: travis-ci\nSigned-off-by: Wink Saville <wink@saville.com>\n---\n json-writer.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/json-writer.c b/json-writer.c\nindex 89a6abb57..1f40482ff 100644\n--- a/json-writer.c\n+++ b/json-writer.c\n@@ -120,7 +120,7 @@ void jw_object_uint64(struct json_writer *jw, const char *key, uint64_t value)\n \tmaybe_add_comma(jw);\n \n \tappend_quoted_string(&jw->json, key);\n-\tstrbuf_addf(&jw->json, \":%\"PRIuMAX, value);\n+\tstrbuf_addf(&jw->json, \":%\"PRIuMAX, (uintmax_t)value);\n }\n \n void jw_object_double(struct json_writer *jw, const char *fmt,\n@@ -225,7 +225,7 @@ void jw_array_uint64(struct json_writer *jw, uint64_t value)\n \tassert_in_array(jw);\n \tmaybe_add_comma(jw);\n \n-\tstrbuf_addf(&jw->json, \"%\"PRIuMAX, value);\n+\tstrbuf_addf(&jw->json, \"%\"PRIuMAX, (uintmax_t)value);\n }\n \n void jw_array_double(struct json_writer *jw, const char *fmt, double value)\n-- \n2.16.2\n\n"},{"id":"343029","messageId":"xmqqr2o6dayt.fsf@gitster-ct.c.googlers.com","threadId":"48131","inReplyTo":"c8628770-71d7-42f4-4bc5-444ea0160d26@ramsayjones.plus.com","subject":"Re: [RFC PATCH 1/1] json-writer: incorrect format specifier","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-03-26T17:04:58Z","receivedAt":"2018-03-26T17:05:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ramsay Jones <ramsay@ramsayjones.plus.com> writes:\n\n>>> @@ -120,7 +120,7 @@ void jw_object_uint64(struct json_writer *jw, const char *key, uint64_t value)\n>>>  \tmaybe_add_comma(jw);\n>>>  \n>>>  \tappend_quoted_string(&jw->json, key);\n>>> -\tstrbuf_addf(&jw->json, \":%\"PRIuMAX, value);\n>>> +\tstrbuf_addf(&jw->json, \":%\"PRIu64, value);\n>> \n>> In this code-base, that would normally be written as:\n>> \n>> \tstrbuf_addf(&jw->json, \":%\"PRIuMAX, (uintmax_t) value);\n>\n> heh, I should learn not to reply in a hurry, just before\n> going out ...\n>\n> I had not noticed that 'value' was declared with an 'sized type'\n> of uint64_t, so using PRIu64 should be fine.\n\nBut why is this codepath using a sized type in the first place?  It\nis not like it wants to read/write a fixed binary file format---it\njust wants to use an integer type that is wide enough to handle any\ninttype the platform uses, for which uintmax_t would be a more\nappropriate type, no?\n"},{"id":"343034","messageId":"f8db1d34-122b-8381-e273-6d955948ea56@jeffhostetler.com","threadId":"48131","inReplyTo":"1a6a4983b824e7b9f4eb1f7b83a39d24f72e552f.1521916335.git.wink@saville.com","subject":"Re: [RFC PATCH v2 1/1] json-writer: add cast to uintmax_t","fromName":"Jeff Hostetler","fromEmail":"git@jeffhostetler.com","sentAt":"2018-03-26T17:36:41Z","receivedAt":"2018-03-26T17:36:47Z","isPatch":true,"sender":{"key":"git@jeffhostetler.com","avatar":null},"body":"\n\nOn 3/24/2018 2:38 PM, Wink Saville wrote:\n> Correct a compile error on Mac OSX by adding a cast to uintmax_t\n> in calls to strbuf_addf.\n> \n> Helped-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\n> Tested-by: travis-ci\n> Signed-off-by: Wink Saville <wink@saville.com>\n> ---\n>   json-writer.c | 4 ++--\n>   1 file changed, 2 insertions(+), 2 deletions(-)\n> \n> diff --git a/json-writer.c b/json-writer.c\n> index 89a6abb57..1f40482ff 100644\n> --- a/json-writer.c\n> +++ b/json-writer.c\n> @@ -120,7 +120,7 @@ void jw_object_uint64(struct json_writer *jw, const char *key, uint64_t value)\n>   \tmaybe_add_comma(jw);\n>   \n>   \tappend_quoted_string(&jw->json, key);\n> -\tstrbuf_addf(&jw->json, \":%\"PRIuMAX, value);\n> +\tstrbuf_addf(&jw->json, \":%\"PRIuMAX, (uintmax_t)value);\n>   }\n>   \n>   void jw_object_double(struct json_writer *jw, const char *fmt,\n> @@ -225,7 +225,7 @@ void jw_array_uint64(struct json_writer *jw, uint64_t value)\n>   \tassert_in_array(jw);\n>   \tmaybe_add_comma(jw);\n>   \n> -\tstrbuf_addf(&jw->json, \"%\"PRIuMAX, value);\n> +\tstrbuf_addf(&jw->json, \"%\"PRIuMAX, (uintmax_t)value);\n>   }\n>   \n>   void jw_array_double(struct json_writer *jw, const char *fmt, double value)\n> \n\nFYI.  I included and squashed this change into V4 of my json-writer series.\n\nJeff\n\n"},{"id":"343035","messageId":"db400047-ac2e-100c-8d5a-12f1d05b93be@jeffhostetler.com","threadId":"48131","inReplyTo":"xmqqr2o6dayt.fsf@gitster-ct.c.googlers.com","subject":"Re: [RFC PATCH 1/1] json-writer: incorrect format specifier","fromName":"Jeff Hostetler","fromEmail":"git@jeffhostetler.com","sentAt":"2018-03-26T17:39:18Z","receivedAt":"2018-03-26T17:39:25Z","isPatch":true,"sender":{"key":"git@jeffhostetler.com","avatar":null},"body":"\n\nOn 3/26/2018 1:04 PM, Junio C Hamano wrote:\n> Ramsay Jones <ramsay@ramsayjones.plus.com> writes:\n> \n>>>> @@ -120,7 +120,7 @@ void jw_object_uint64(struct json_writer *jw, const char *key, uint64_t value)\n>>>>   \tmaybe_add_comma(jw);\n>>>>   \n>>>>   \tappend_quoted_string(&jw->json, key);\n>>>> -\tstrbuf_addf(&jw->json, \":%\"PRIuMAX, value);\n>>>> +\tstrbuf_addf(&jw->json, \":%\"PRIu64, value);\n>>>\n>>> In this code-base, that would normally be written as:\n>>>\n>>> \tstrbuf_addf(&jw->json, \":%\"PRIuMAX, (uintmax_t) value);\n>>\n>> heh, I should learn not to reply in a hurry, just before\n>> going out ...\n>>\n>> I had not noticed that 'value' was declared with an 'sized type'\n>> of uint64_t, so using PRIu64 should be fine.\n> \n> But why is this codepath using a sized type in the first place?  It\n> is not like it wants to read/write a fixed binary file format---it\n> just wants to use an integer type that is wide enough to handle any\n> inttype the platform uses, for which uintmax_t would be a more\n> appropriate type, no?\n> \n\n[Somehow the conversation forked and this compiler warning\nappeared in both the json-writer and the rebase-interactive\nthreads.  I'm copying here the response that I already made\non the latter.]\n\n\nI defined that routine to take a uint64_t because I wanted to\npass a nanosecond value received from getnanotime() and that's\nwhat it returns.\n\nMy preference would be to change the PRIuMAX to PRIu64, but there\naren't any other references in the code to that symbol and I didn't\nwant to start a new trend here.\n\nI am concerned that the above compiler error message says that uintmax_t\nis defined as an \"unsigned long\" (which is defined as *at least* 32 bits,\nbut not necessarily 64.  But a uint64_t is defined as a \"unsigned long long\"\nand guaranteed as a 64 bit value.\n\nSo while I'm not really worried about 128 bit integers right now, I'm\nmore concerned about 32 bit compilers truncating that value without any\nwarnings.\n\nJeff\n"},{"id":"343094","messageId":"9512a1eb-2b9d-fda5-f2a5-c9f59dff972c@ramsayjones.plus.com","threadId":"48131","inReplyTo":"xmqqr2o6dayt.fsf@gitster-ct.c.googlers.com","subject":"Re: [RFC PATCH 1/1] json-writer: incorrect format specifier","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2018-03-27T03:26:14Z","receivedAt":"2018-03-27T03:26:21Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\n\nOn 26/03/18 18:04, Junio C Hamano wrote:\n> Ramsay Jones <ramsay@ramsayjones.plus.com> writes:\n> \n>>>> @@ -120,7 +120,7 @@ void jw_object_uint64(struct json_writer *jw, const char *key, uint64_t value)\n>>>>  \tmaybe_add_comma(jw);\n>>>>  \n>>>>  \tappend_quoted_string(&jw->json, key);\n>>>> -\tstrbuf_addf(&jw->json, \":%\"PRIuMAX, value);\n>>>> +\tstrbuf_addf(&jw->json, \":%\"PRIu64, value);\n>>>\n>>> In this code-base, that would normally be written as:\n>>>\n>>> \tstrbuf_addf(&jw->json, \":%\"PRIuMAX, (uintmax_t) value);\n>>\n>> heh, I should learn not to reply in a hurry, just before\n>> going out ...\n>>\n>> I had not noticed that 'value' was declared with an 'sized type'\n>> of uint64_t, so using PRIu64 should be fine.\n> \n> But why is this codepath using a sized type in the first place?  It\n> is not like it wants to read/write a fixed binary file format---it\n> just wants to use an integer type that is wide enough to handle any\n> inttype the platform uses, for which uintmax_t would be a more\n> appropriate type, no?\n\nI must confess to not having given any thought to the wider\nimplications of the code. I don't really know what this code\nis going to be used for. [Although I did shudder when I read\nsome mention of a 'universal interchange format' - I still\nhave nightmares about XML :-D ]\n\nATB,\nRamsay Jones\n\n\n"},{"id":"343118","messageId":"d3fc60d1-2d8f-ec8c-cafe-f96547eff9ca@jeffhostetler.com","threadId":"48131","inReplyTo":"9512a1eb-2b9d-fda5-f2a5-c9f59dff972c@ramsayjones.plus.com","subject":"Re: [RFC PATCH 1/1] json-writer: incorrect format specifier","fromName":"Jeff Hostetler","fromEmail":"git@jeffhostetler.com","sentAt":"2018-03-27T10:24:35Z","receivedAt":"2018-03-27T10:24:41Z","isPatch":true,"sender":{"key":"git@jeffhostetler.com","avatar":null},"body":"\n\nOn 3/26/2018 11:26 PM, Ramsay Jones wrote:\n> On 26/03/18 18:04, Junio C Hamano wrote:\n>> Ramsay Jones <ramsay@ramsayjones.plus.com> writes:\n[...]\n> I must confess to not having given any thought to the wider\n> implications of the code. I don't really know what this code\n> is going to be used for. [Although I did shudder when I read\n> some mention of a 'universal interchange format' - I still\n> have nightmares about XML :-D ]\n[...]\n\nMy current goals are to add telemetry in a friendly way and\nhave events written in JSON to some audit destination.\nSomething like:\n\n     { \"argv\":[\"./git\",\"status\"],\n       \"pid\":84941,\n       \"exit-code\":0,\n       \"elapsed-time\":0.011121,\n       \"version\":\"2.16.2.5.g71445db.dirty\",\n       ... }\n\nLater, we could add a JSON formatter to a command like \"status\"\nand then do things like:\n\n     $ git status --json | python '... json.load ...'\n\nand eliminate the need to write custom parsers for normal\nor porcelain formats.  There are other commands that could\nbe similarly adapted and save callers a lot of screen-scraping\ncode.  But that is later.\n\nThanks,\nJeff\n"}]}