{"thread":{"id":"56727","subject":"Build failure of 'seen'","startedAt":"2021-10-16T23:18:31Z","lastAt":"2021-10-17T18:32:52Z","messageCount":4,"participants":["Ramsay Jones","Junio C Hamano","Ævar Arnfjörð Bjarmason"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"438956","messageId":"48748e0e-7c18-b7ff-e1c3-ac0733cc7d34@ramsayjones.plus.com","threadId":"56727","inReplyTo":null,"subject":"Build failure of 'seen'","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2021-10-16T23:18:19Z","receivedAt":"2021-10-16T23:18:31Z","isPatch":false,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"Hi Junio,\n\nTonight's build of 'seen' failed for me (on Linux and Cygwin):\n\n      CC refs/files-backend.o\n  refs/files-backend.c: In function ‘files_reflog_expire’:\n  refs/files-backend.c:3212:11: error: ‘type’ may be used uninitialized in this function [-Werror=maybe-uninitialized]\n   3212 |    !(type & REF_ISSYMREF) &&\n        |     ~~~~~~^~~~~~~~~~~~~~~\n  cc1: all warnings being treated as errors\n  make: *** [Makefile:2555: refs/files-backend.o] Error 1\n  $ \n\ngcc correctly complains, since 'type' _will_ be used uninitialized.\nNote that, despite passing &type to the lock_ref_oid_basic() function,\nthe body of that function does not mention the parameter at all. \n\nI just did the obvious to get it to compile:\n\n  $ git diff\n  diff --git a/refs/files-backend.c b/refs/files-backend.c\n  index ca35950a80..c7ac1d1d6b 100644\n  --- a/refs/files-backend.c\n  +++ b/refs/files-backend.c\n  @@ -3132,7 +3132,7 @@ static int files_reflog_expire(struct ref_store *ref_store,\n          struct strbuf log_file_sb = STRBUF_INIT;\n          char *log_file;\n          int status = 0;\n  -       int type;\n  +       int type = 0;\n          struct strbuf err = STRBUF_INIT;\n          const struct object_id *oid;\n   \n  $ \n\n... but (as you already noted) it fails the testsuite anyway.\n\nDon't quote me (because I didn't look too hard), but I think that\ncommit 5bad105452 (\"refs/files: remove \"name exist?\" check in\nlock_ref_oid_basic()\", 2021-10-14) removed the last use of the 'type'\nparameter to lock_ref_oid_basic(). (when removing a call to the function\nrefs_resolve_ref_unsafe()).\n\nATB,\nRamsay Jones\n\n\n\n"},{"id":"438958","messageId":"xmqqo87o1mgm.fsf@gitster.g","threadId":"56727","inReplyTo":"48748e0e-7c18-b7ff-e1c3-ac0733cc7d34@ramsayjones.plus.com","subject":"Re: Build failure of 'seen'","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2021-10-17T01:14:49Z","receivedAt":"2021-10-17T01:14:53Z","isPatch":false,"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> Tonight's build of 'seen' failed for me (on Linux and Cygwin):\n\nYes, I saw the same with the report at\n\nhttps://lore.kernel.org/git/xmqqh7djba6e.fsf@gitster.g/\n\nthe ball is in Ævar's court.\n\nThanks.\n"},{"id":"438969","messageId":"87mtn8c633.fsf@evledraar.gmail.com","threadId":"56727","inReplyTo":"xmqqo87o1mgm.fsf@gitster.g","subject":"Re: Build failure of 'seen'","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2021-10-17T10:06:22Z","receivedAt":"2021-10-17T10:13:13Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Sat, Oct 16 2021, Junio C Hamano wrote:\n\n> Ramsay Jones <ramsay@ramsayjones.plus.com> writes:\n>\n>> Hi Junio,\n>>\n>> Tonight's build of 'seen' failed for me (on Linux and Cygwin):\n>\n> Yes, I saw the same with the report at\n>\n> https://lore.kernel.org/git/xmqqh7djba6e.fsf@gitster.g/\n>\n> the ball is in Ævar's court.\n\nYou'll probably saw this already, but just for the list's reference &\nRamsay's (b.t.w. thanks for the report, and sorry) I'd already re-rolled\nthis:\nhttps://lore.kernel.org/git/cover-v2-00.21-00000000000-20211016T093845Z-avarab@gmail.com/; Hopefully that fixes any failures\n\nAs an aside is that \"uninitialized\" found by any tool/compiler? I didn't\ntrigger it with anything I tried.\n"},{"id":"438971","messageId":"ab2082f4-dd6b-ece9-cc59-cb8ecdfc0f9e@ramsayjones.plus.com","threadId":"56727","inReplyTo":"87mtn8c633.fsf@evledraar.gmail.com","subject":"Re: Build failure of 'seen'","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2021-10-17T18:32:46Z","receivedAt":"2021-10-17T18:32:52Z","isPatch":false,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\n\nOn 17/10/2021 11:06, Ævar Arnfjörð Bjarmason wrote:\n> \n> On Sat, Oct 16 2021, Junio C Hamano wrote:\n> \n>> Ramsay Jones <ramsay@ramsayjones.plus.com> writes:\n>>\n>>> Hi Junio,\n>>>\n>>> Tonight's build of 'seen' failed for me (on Linux and Cygwin):\n>>\n>> Yes, I saw the same with the report at\n>>\n>> https://lore.kernel.org/git/xmqqh7djba6e.fsf@gitster.g/\n>>\n>> the ball is in Ævar's court.\n\nOops! Sorry for the duplicate report.\nI'm obviously not reading the list closely enough. :(\n\n> As an aside is that \"uninitialized\" found by any tool/compiler? I didn't\n> trigger it with anything I tried.\n\nI only get the warning with gcc (v9.3.0 on Linux, and v11.2.0 on Cygwin).\n\n[clang version 10.0.0-4ubuntu1 on Linux and clang version 8.0.1 on Cygwin\ndo not issue any warnings]\n\nAlso, this particular warning depends on the level of optimization\nused with the command. I build with the default 'CFLAGS = -g -O2 -Wall'\nand with 'DEVELOPER=1'.\n\nOn Linux:\n\n  $ make V=1 refs/files-backend.o\n  GIT_VERSION = 2.33.1.1033.g957ac05270\n  cc -o refs/files-backend.o -c -MF refs/.depend/files-backend.o.d -MQ refs/files-backend.o -MMD -MP  -Werror -Wall -pedantic -Wpedantic -Wdeclaration-after-statement -Wformat-security -Wold-style-definition -Woverflow -Wpointer-arith -Wstrict-prototypes -Wunused -Wvla -fno-common -Wextra -Wmissing-prototypes -Wno-empty-body -Wno-missing-field-initializers -Wno-sign-compare -Wno-unused-parameter  -g -O2 -Wall -I. -DHAVE_SYSINFO -DGIT_HOST_CPU=\"\\\"x86_64\\\"\" -DHAVE_ALLOCA_H  -DUSE_CURL_FOR_IMAP_SEND -DSUPPORTS_SIMPLE_IPC -DSHA1_DC -DSHA1DC_NO_STANDARD_INCLUDES -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\"\\\"cache.h\\\"\" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"\\\"git-compat-util.h\\\"\" -DSHA256_BLK  -DHAVE_PATHS_H -DHAVE_DEV_TTY -DHAVE_CLOCK_GETTIME -DHAVE_CLOCK_MONOTONIC -DHAVE_SYNC_FILE_RANGE -DHAVE_GETDELIM '-DPROCFS_EXECUTABLE_PATH=\"/proc/self/exe\"'  -DFREAD_READS_DIRECTORIES -DNO_STRLCPY -DSHELL_PATH='\"/bin/sh\"' -DPAGER_ENV='\"LESS=FRX LV=-c\"'  refs/files-backend.c\n  refs/files-backend.c: In function ‘files_reflog_expire’:\n  refs/files-backend.c:3212:11: error: ‘type’ may be used uninitialized in this function [-Werror=maybe-uninitialized]\n   3212 |    !(type & REF_ISSYMREF) &&\n        |     ~~~~~~^~~~~~~~~~~~~~~\n  cc1: all warnings being treated as errors\n  make: *** [Makefile:2555: refs/files-backend.o] Error 1\n  $ \n\nATB,\nRamsay Jones\n"}]}