All of lore.kernel.org
 help / color / mirror / Atom feed
* Build failure of 'seen'
@ 2021-10-16 23:18 Ramsay Jones
  2021-10-17  1:14 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Ramsay Jones @ 2021-10-16 23:18 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing-list, Ævar Arnfjörð Bjarmason

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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Build failure of 'seen'
  2021-10-16 23:18 Build failure of 'seen' Ramsay Jones
@ 2021-10-17  1:14 ` Junio C Hamano
  2021-10-17 10:06   ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2021-10-17  1:14 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: GIT Mailing-list, Ævar Arnfjörð Bjarmason

Ramsay Jones <ramsay@ramsayjones.plus.com> writes:

> Hi Junio,
>
> Tonight's build of 'seen' failed for me (on Linux and Cygwin):

Yes, I saw the same with the report at

https://lore.kernel.org/git/xmqqh7djba6e.fsf@gitster.g/

the ball is in Ævar's court.

Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Build failure of 'seen'
  2021-10-17  1:14 ` Junio C Hamano
@ 2021-10-17 10:06   ` Ævar Arnfjörð Bjarmason
  2021-10-17 18:32     ` Ramsay Jones
  0 siblings, 1 reply; 4+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2021-10-17 10:06 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Ramsay Jones, GIT Mailing-list


On Sat, Oct 16 2021, Junio C Hamano wrote:

> Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
>
>> Hi Junio,
>>
>> Tonight's build of 'seen' failed for me (on Linux and Cygwin):
>
> Yes, I saw the same with the report at
>
> https://lore.kernel.org/git/xmqqh7djba6e.fsf@gitster.g/
>
> the ball is in Ævar's court.

You'll probably saw this already, but just for the list's reference &
Ramsay's (b.t.w. thanks for the report, and sorry) I'd already re-rolled
this:
https://lore.kernel.org/git/cover-v2-00.21-00000000000-20211016T093845Z-avarab@gmail.com/; Hopefully that fixes any failures

As an aside is that "uninitialized" found by any tool/compiler? I didn't
trigger it with anything I tried.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Build failure of 'seen'
  2021-10-17 10:06   ` Ævar Arnfjörð Bjarmason
@ 2021-10-17 18:32     ` Ramsay Jones
  0 siblings, 0 replies; 4+ messages in thread
From: Ramsay Jones @ 2021-10-17 18:32 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason, Junio C Hamano; +Cc: GIT Mailing-list



On 17/10/2021 11:06, Ævar Arnfjörð Bjarmason wrote:
> 
> On Sat, Oct 16 2021, Junio C Hamano wrote:
> 
>> Ramsay Jones <ramsay@ramsayjones.plus.com> writes:
>>
>>> Hi Junio,
>>>
>>> Tonight's build of 'seen' failed for me (on Linux and Cygwin):
>>
>> Yes, I saw the same with the report at
>>
>> https://lore.kernel.org/git/xmqqh7djba6e.fsf@gitster.g/
>>
>> the ball is in Ævar's court.

Oops! Sorry for the duplicate report.
I'm obviously not reading the list closely enough. :(

> As an aside is that "uninitialized" found by any tool/compiler? I didn't
> trigger it with anything I tried.

I only get the warning with gcc (v9.3.0 on Linux, and v11.2.0 on Cygwin).

[clang version 10.0.0-4ubuntu1 on Linux and clang version 8.0.1 on Cygwin
do not issue any warnings]

Also, this particular warning depends on the level of optimization
used with the command. I build with the default 'CFLAGS = -g -O2 -Wall'
and with 'DEVELOPER=1'.

On Linux:

  $ make V=1 refs/files-backend.o
  GIT_VERSION = 2.33.1.1033.g957ac05270
  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
  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
  $ 

ATB,
Ramsay Jones

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-17 18:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-16 23:18 Build failure of 'seen' Ramsay Jones
2021-10-17  1:14 ` Junio C Hamano
2021-10-17 10:06   ` Ævar Arnfjörð Bjarmason
2021-10-17 18:32     ` Ramsay Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.