git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Build failure of 'seen'

From
Ramsay Jones <ramsay@ramsayjones.plus.com>
Date
Oct 16, 2021, 23:18 UTC
Message-ID
<48748e0e-7c18-b7ff-e1c3-ac0733cc7d34@ramsayjones.plus.com>
Hi Junio,
Tonight's build of 'seen' failed for me (on Linux and Cygwin):
      CC refs/files-backend.o
  refs/files-backend.c: In function ‘files_reflog_expire’:
  refs/files-backend.c:3212:11: error: ‘type’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
   3212 |    !(type & REF_ISSYMREF) &&
        |     ~~~~~~^~~~~~~~~~~~~~~
  cc1: all warnings being treated as errors
  make: *** [Makefile:2555: refs/files-backend.o] Error 1
  $ 

gcc correctly complains, since 'type' _will_ be used uninitialized. Note that, despite passing &type to the lock_ref_oid_basic() function, the body of that function does not mention the parameter at all.

I just did the obvious to get it to compile:
  $ git diff
  diff --git a/refs/files-backend.c b/refs/files-backend.c
  index ca35950a80..c7ac1d1d6b 100644
  --- a/refs/files-backend.c
  +++ b/refs/files-backend.c
  @@ -3132,7 +3132,7 @@ static int files_reflog_expire(struct ref_store *ref_store,
          struct strbuf log_file_sb = STRBUF_INIT;
          char *log_file;
          int status = 0;
  -       int type;
  +       int type = 0;
          struct strbuf err = STRBUF_INIT;
          const struct object_id *oid;
   
  $ 
... but (as you already noted) it fails the testsuite anyway.

Don't quote me (because I didn't look too hard), but I think that commit 5bad105452 ("refs/files: remove "name exist?" check in lock_ref_oid_basic()", 2021-10-14) removed the last use of the 'type' parameter to lock_ref_oid_basic(). (when removing a call to the function refs_resolve_ref_unsafe()).

ATB, Ramsay Jones

Next: Junio C Hamano
Message 1 of 4 in “Build failure of 'seen'”
  1. Ramsay JonesOct 16, 2021
  2. Junio C HamanoOct 17, 2021
  3. Ævar Arnfjörð BjarmasonOct 17, 2021
  4. Ramsay JonesOct 17, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.