Bug 71667

Summary: [patch] cleanup of the usr.sbin/bootparamd code
Product: Base System Reporter: Dan Lukes <dan>
Component: binAssignee: Yoshihiro Takahashi <nyan>
Status: Closed FIXED    
Severity: Affects Some People CC: dan+freebsd.org, ngie, nyan
Priority: Normal Flags: ngie: mfc-stable11?
ngie: mfc-stable10?
ngie: mfc-stable9-
Version: 5.3-BETA3   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff
none
callbootd.c.diff
none
bootparamd.c.diff
none
main.c.diff none

Description Dan Lukes 2004-09-12 18:40:26 UTC
	There are more than 5000 warnings issued during "make buildworld".
Some of them are false positives, but some of them are sign of true errors.

	Nobody is upset by warnings due it's amount, so some errors remain
uncorrected.

	I want to cleanup the code-base from warnings, so warnings will
become "attention mark" again.

usr.sbin/bootparamd/callbootd/callbootd.c:83: warning: 'clnt' might be used uninitialized in this function
bootparam_prot_clnt.c:24: warning: implicit declaration of function `memset'

How-To-Repeat: 	N/A
Comment 1 Rebecca Cran freebsd_committer freebsd_triage 2008-09-04 19:10:13 UTC
The bootparamd code needs quite a few more changes to make it compile
with WARNS=6 with GCC 4.  I've attached a patch for
callbootd/callbootd.c, but changes are also needed for
bootparamd/bootparamd.c

-- 
Bruce Cran
Comment 2 Rebecca Cran freebsd_committer freebsd_triage 2008-09-04 23:01:35 UTC
I have attached a patch which fixes some of the problems with
bootparamd/bootparamd.c and bootparamd/main.c.   More changes are
required to bootparamd.c for it to compile with WARNS=6
though.

-- 
Bruce Cran
Comment 3 commit-hook freebsd_committer freebsd_triage 2015-11-10 11:20:20 UTC
A commit references this bug:

Author: ngie
Date: Tue Nov 10 11:19:37 UTC 2015
New revision: 290645
URL: https://svnweb.freebsd.org/changeset/base/290645

Log:
  Fix some trivial warnings with bootparamd/main.c

  - Convert K&R to something a bit less ancient
  - Remove an incorrect, duplicate prototype for bootparamprog_1(..)

  MFC after: 1 week
  PR: 71667
  Submitted by: bcran
  Sponsored by: EMC / Isilon Storage Division

Changes:
  head/usr.sbin/bootparamd/bootparamd/main.c
Comment 4 commit-hook freebsd_committer freebsd_triage 2015-11-19 00:15:18 UTC
A commit references this bug:

Author: ngie
Date: Thu Nov 19 00:14:23 UTC 2015
New revision: 291042
URL: https://svnweb.freebsd.org/changeset/base/291042

Log:
  MFC r290645:

  Fix some trivial warnings with bootparamd/main.c

  - Convert K&R to something a bit less ancient
  - Remove an incorrect, duplicate prototype for bootparamprog_1(..)

  PR: 71667
  Submitted by: bcran
  Sponsored by: EMC / Isilon Storage Division

Changes:
_U  stable/10/
  stable/10/usr.sbin/bootparamd/bootparamd/main.c
Comment 5 commit-hook freebsd_committer freebsd_triage 2015-11-19 00:19:22 UTC
A commit references this bug:

Author: ngie
Date: Thu Nov 19 00:19:09 UTC 2015
New revision: 291043
URL: https://svnweb.freebsd.org/changeset/base/291043

Log:
  MFstable/10 r291042:

  MFC r290645:

  Fix some trivial warnings with bootparamd/main.c

  - Convert K&R to something a bit less ancient
  - Remove an incorrect, duplicate prototype for bootparamprog_1(..)

  PR: 71667
  Submitted by: bcran
  Sponsored by: EMC / Isilon Storage Division

Changes:
_U  stable/9/
_U  stable/9/usr.sbin/
_U  stable/9/usr.sbin/bootparamd/
  stable/9/usr.sbin/bootparamd/bootparamd/main.c
Comment 6 commit-hook freebsd_committer freebsd_triage 2017-08-17 20:38:07 UTC
A commit references this bug:

Author: ngie
Date: Thu Aug 17 20:37:02 UTC 2017
New revision: 322635
URL: https://svnweb.freebsd.org/changeset/base/322635

Log:
  Fix WARNS

  - Remove ad hoc inet_ntoa prototype declaration; it's already handled
    by the included headers.
  - De-K&Rify the function prototypes for eachres_whoami(..),
    eachres_getfile(..), and main(..).

  MFC after:	1 week
  PR:		71667
  Tested with:	clang (5.0), gcc (4.2.1, 5)

Changes:
  head/usr.sbin/bootparamd/callbootd/callbootd.c
Comment 7 Enji Cooper freebsd_committer freebsd_triage 2017-08-17 20:42:11 UTC
A lot of these warnings were fixed in the clang integration project BTW.
Comment 8 Dan Lukes 2017-08-18 07:20:40 UTC
(In reply to Ngie Cooper from comment #7)

May be, but despite of it, there are 10648 warnings fired during compilation of 11.0-RELEASE-p12.

But I'm not going to analyze them in attempt to identify possible race conditions and bug. 

I spent so much time to something like it 13 years ago and I'm not willing to do it again as it seems to be pure waste of time.

Even those PR related to true bugs and race conditions (e.g. no just meaningless warning) has been left untouched for years. 

It seems commiters doesn't support/welcome neither bug hunting nor cleanup of code in attempt to help bug hunters.

But thank you very much for the time you spent to process this 13 years old PR.
Comment 9 commit-hook freebsd_committer freebsd_triage 2017-09-30 20:51:17 UTC
A commit references this bug:

Author: ngie
Date: Sat Sep 30 20:50:32 UTC 2017
New revision: 324142
URL: https://svnweb.freebsd.org/changeset/base/324142

Log:
  MFC r322635:

  Fix WARNS

  - Remove ad hoc inet_ntoa prototype declaration; it's already handled
    by the included headers.
  - De-K&Rify the function prototypes for eachres_whoami(..),
    eachres_getfile(..), and main(..).

  PR:		71667
  Tested with:	clang (5.0), gcc (4.2.1, 5)

Changes:
_U  stable/10/
  stable/10/usr.sbin/bootparamd/callbootd/callbootd.c
Comment 10 Enji Cooper freebsd_committer freebsd_triage 2017-11-05 21:04:04 UTC
I have no way to test this. Untaking.
Comment 11 Yoshihiro Takahashi freebsd_committer freebsd_triage 2021-01-02 03:33:45 UTC
I'll take.
Comment 12 commit-hook freebsd_committer freebsd_triage 2021-01-02 03:38:18 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=e03764d931d820185a019334259b18df2e3f6b6c

commit e03764d931d820185a019334259b18df2e3f6b6c
Author:     Yoshihiro Takahashi <nyan@FreeBSD.org>
AuthorDate: 2021-01-02 03:36:09 +0000
Commit:     Yoshihiro Takahashi <nyan@FreeBSD.org>
CommitDate: 2021-01-02 03:36:09 +0000

    bootparamd: Fix several warnings and increase warn level to 6.

    - Increase WARNS to 6.
    - Except -Wcast-align and -Wincompatible-pointer-types-discards-qualifiers
      checks.
    - Use ANSI C prototype.
    - Statically variables and functions.
    - Add extern declaration for global variables.
    - Rename local variables to resolve shadow warnings.

    PR:             71667
    MFC after:      2 weeks

 usr.sbin/bootparamd/Makefile.inc            |  4 +-
 usr.sbin/bootparamd/bootparamd/bootparamd.c | 83 +++++++++++++----------------
 usr.sbin/bootparamd/bootparamd/main.c       | 15 +++---
 usr.sbin/bootparamd/callbootd/callbootd.c   | 26 ++++-----
 4 files changed, 59 insertions(+), 69 deletions(-)
Comment 13 Dan Lukes 2021-01-02 09:07:11 UTC
Thank you very for taking this 17 years old challenge.
Comment 14 commit-hook freebsd_committer freebsd_triage 2021-01-19 14:58:44 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=b96f027b71024cccc475d4d9f69176d372956756

commit b96f027b71024cccc475d4d9f69176d372956756
Author:     Yoshihiro Takahashi <nyan@FreeBSD.org>
AuthorDate: 2021-01-02 03:36:09 +0000
Commit:     Yoshihiro Takahashi <nyan@FreeBSD.org>
CommitDate: 2021-01-19 14:55:16 +0000

    bootparamd: Fix several warnings and increase warn level to 6.

    - Increase WARNS to 6.
    - Except -Wcast-align and -Wincompatible-pointer-types-discards-qualifiers
      checks.
    - Use ANSI C prototype.
    - Statically variables and functions.
    - Add extern declaration for global variables.
    - Rename local variables to resolve shadow warnings.

    PR:             71667

    (cherry picked from commit e03764d931d820185a019334259b18df2e3f6b6c)

 usr.sbin/bootparamd/Makefile.inc            |  4 +-
 usr.sbin/bootparamd/bootparamd/bootparamd.c | 83 +++++++++++++----------------
 usr.sbin/bootparamd/bootparamd/main.c       | 15 +++---
 usr.sbin/bootparamd/callbootd/callbootd.c   | 26 ++++-----
 4 files changed, 59 insertions(+), 69 deletions(-)
Comment 15 Yoshihiro Takahashi freebsd_committer freebsd_triage 2021-01-19 15:05:56 UTC
Commited.  Thanks.