{"thread":{"id":"47330","subject":"[PATCH] repository: fix a sparse 'using integer as NULL pointer' warning","startedAt":"2017-11-28T03:01:27Z","lastAt":"2017-11-29T17:58:57Z","messageCount":4,"participants":["Ramsay Jones","Junio C Hamano","brian m. carlson"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"333672","messageId":"69fdc850-da71-6df3-5299-eb67ef5d74df@ramsayjones.plus.com","threadId":"47330","inReplyTo":null,"subject":"[PATCH] repository: fix a sparse 'using integer as NULL pointer' warning","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2017-11-28T03:01:19Z","receivedAt":"2017-11-28T03:01:27Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nCommit 78a6766802 (\"Integrate hash algorithm support with repo setup\",\n2017-11-12) added a 'const struct git_hash_algo *hash_algo' field to the\nrepository structure, without modifying the initializer of the 'the_repo'\nvariable. This does not actually introduce a bug, since the '0' initializer\nfor the 'ignore_env:1' bit-field is interpreted as a NULL pointer (hence\nthe warning), and the final field (now with no initializer) receives a\ndefault '0'.\n\nSigned-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\n---\n\nHi Junio,\n\nI don't recall Brian doing a re-roll of the 'bc/hash-algo' branch[1], but\nnow that it has been merged into the 'next' branch, sparse is barking on\nthat branch too. This patch (slightly different to the last one) applies\non top of 'next'.\n\nATB,\nRamsay Jones\n\n[1] https://public-inbox.org/git/%3C91150cfc-3271-16b0-33d3-9a4e149dc9fe@ramsayjones.plus.com%3E/\n\n repository.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/repository.c b/repository.c\nindex c6ceb9f9e..998413b8b 100644\n--- a/repository.c\n+++ b/repository.c\n@@ -5,7 +5,7 @@\n \n /* The main repository */\n static struct repository the_repo = {\n-\tNULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &the_index, 0, 0\n+\tNULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &the_index, NULL, 0, 0\n };\n struct repository *the_repository = &the_repo;\n \n-- \n2.15.0\n"},{"id":"333678","messageId":"xmqqtvxf6o7t.fsf@gitster.mtv.corp.google.com","threadId":"47330","inReplyTo":"69fdc850-da71-6df3-5299-eb67ef5d74df@ramsayjones.plus.com","subject":"Re: [PATCH] repository: fix a sparse 'using integer as NULL pointer' warning","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-11-28T04:07:02Z","receivedAt":"2017-11-28T04:07:12Z","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> Hi Junio,\n>\n> I don't recall Brian doing a re-roll of the 'bc/hash-algo' branch[1], but\n> now that it has been merged into the 'next' branch, sparse is barking on\n> that branch too. This patch (slightly different to the last one) applies\n> on top of 'next'.\n\nThanks.  Will queue on that topic.\n\n"},{"id":"333719","messageId":"20171129013518.GB598034@genre.crustytoothpaste.net","threadId":"47330","inReplyTo":"69fdc850-da71-6df3-5299-eb67ef5d74df@ramsayjones.plus.com","subject":"Re: [PATCH] repository: fix a sparse 'using integer as NULL pointer' warning","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2017-11-29T01:35:18Z","receivedAt":"2017-11-29T01:35:29Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On Tue, Nov 28, 2017 at 03:01:19AM +0000, Ramsay Jones wrote:\n> \n> Commit 78a6766802 (\"Integrate hash algorithm support with repo setup\",\n> 2017-11-12) added a 'const struct git_hash_algo *hash_algo' field to the\n> repository structure, without modifying the initializer of the 'the_repo'\n> variable. This does not actually introduce a bug, since the '0' initializer\n> for the 'ignore_env:1' bit-field is interpreted as a NULL pointer (hence\n> the warning), and the final field (now with no initializer) receives a\n> default '0'.\n> \n> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\n> ---\n> \n> Hi Junio,\n> \n> I don't recall Brian doing a re-roll of the 'bc/hash-algo' branch[1], but\n> now that it has been merged into the 'next' branch, sparse is barking on\n> that branch too. This patch (slightly different to the last one) applies\n> on top of 'next'.\n\nThanks for the patch; it's obviously correct.  I'll get sparse set up\nfor future patch series.\n-- \nbrian m. carlson / brian with sandals: Houston, Texas, US\nhttps://www.crustytoothpaste.net/~bmc | My opinion only\nOpenPGP: https://keybase.io/bk2204\n"},{"id":"333791","messageId":"423b4a07-dac3-20f2-ad60-d87fa08968f9@ramsayjones.plus.com","threadId":"47330","inReplyTo":"20171129013518.GB598034@genre.crustytoothpaste.net","subject":"Re: [PATCH] repository: fix a sparse 'using integer as NULL pointer' warning","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2017-11-29T17:58:47Z","receivedAt":"2017-11-29T17:58:57Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\n\nOn 29/11/17 01:35, brian m. carlson wrote:\n> On Tue, Nov 28, 2017 at 03:01:19AM +0000, Ramsay Jones wrote:\n>>\n>> Commit 78a6766802 (\"Integrate hash algorithm support with repo setup\",\n>> 2017-11-12) added a 'const struct git_hash_algo *hash_algo' field to the\n>> repository structure, without modifying the initializer of the 'the_repo'\n>> variable. This does not actually introduce a bug, since the '0' initializer\n>> for the 'ignore_env:1' bit-field is interpreted as a NULL pointer (hence\n>> the warning), and the final field (now with no initializer) receives a\n>> default '0'.\n>>\n>> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\n>> ---\n>>\n>> Hi Junio,\n>>\n>> I don't recall Brian doing a re-roll of the 'bc/hash-algo' branch[1], but\n>> now that it has been merged into the 'next' branch, sparse is barking on\n>> that branch too. This patch (slightly different to the last one) applies\n>> on top of 'next'.\n> \n> Thanks for the patch; it's obviously correct.  I'll get sparse set up\n> for future patch series.\n\nHeh, at this point I usually remark that you would need to build\nsparse from source, since all the packaged versions are so old\nas to be virtually useless (to run over git).\n\nThat may still be the case, depending on your distro, since there\nwas a new release a couple of months ago. However, you know how\nlong it takes to get into some distros! ;-)\n\n[I _think_ it may be in Debian Unstable]\n\nOh, the release (v0.5.1) was tagged on 17 Aug 2017.\n(I'm currently running v0.5.1-30-gf1e4ba1, built from source).\n\nATB,\nRamsay Jones\n\n"}]}