Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Jun 2018 10:27:41 -0400
From:      Justin Hibbits <jrh29@alumni.cwru.edu>
To:        Ed Maste <emaste@freebsd.org>
Cc:        Kirk McKusick <mckusick@freebsd.org>, src-committers <src-committers@freebsd.org>,  svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r334814 - head/sbin/dump
Message-ID:  <CAHSQbTDq23CcAWsXZu6zDBj0VyPPiKJdCOuMSf9P8iw%2B0VThWg@mail.gmail.com>
In-Reply-To: <CAPyFy2DxmjVw57vu9Cbn7X1qfgR58UtTzvMk2rzEHxfhBHm79g@mail.gmail.com>
References:  <201806072049.w57Kn1Mk057119@repo.freebsd.org> <CAPyFy2DxmjVw57vu9Cbn7X1qfgR58UtTzvMk2rzEHxfhBHm79g@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Jun 8, 2018 at 10:08 AM, Ed Maste <emaste@freebsd.org> wrote:
> On 7 June 2018 at 16:49, Kirk McKusick <mckusick@freebsd.org> wrote:
>> Author: mckusick
>> Date: Thu Jun  7 20:49:01 2018
>> New Revision: 334814
>> URL: https://svnweb.freebsd.org/changeset/base/334814
>>
>> Log:
>>   Ensure proper initialization of superblock.
>>
> ...
>> --- head/sbin/dump/main.c       Thu Jun  7 19:57:55 2018        (r334813)
>> +++ head/sbin/dump/main.c       Thu Jun  7 20:49:01 2018        (r334814)
>> @@ -433,6 +433,7 @@ main(int argc, char *argv[])
>>                 msgtail("to %s\n", tape);
>>
>>         sync();
>> +       sblock = NULL;
>>         if ((ret = sbget(diskfd, &sblock, -1)) != 0) {
>
> sblock is initialized to NULL at the beginning of ffs_sbget, so I'm
> not really sure what's happening here.
>

Diane just found possibly the real cause of the problem.  dump.h is
included by almost every .c file, but defines variables, doesn't just
declare them.  I think the real solution would be to  define them in
main.c, or somewhere else, and just declare them in dump.h.  Or if
they're truly only needed on a per-file basis, not as globals, they
could be marked static so there is no chance of conflict, and they're
pre-initialized to 0.  The linker "might" merge them into the common
section, or might not, resulting in bizarre conflicts like what she's
seeing.  Though, I'm surprised we're not seeing a linker error or
warning anyway.

- Justin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHSQbTDq23CcAWsXZu6zDBj0VyPPiKJdCOuMSf9P8iw%2B0VThWg>