Bug 199641

Summary: Growfs does not compile in debugmode (GFSDBG)
Product: Base System Reporter: Willem Jan Withagen <wjw>
Component: binAssignee: Edward Tomasz Napierala <trasz>
Status: Closed FIXED    
Severity: Affects Only Me CC: trasz, wjw
Priority: ---    
Version: 10.1-STABLE   
Hardware: Any   
OS: Any   

Description Willem Jan Withagen 2015-04-23 11:12:41 UTC
cd /usr/src/sbin/growfs
make -DGFSDBG
Returns errors while building.

Probably because the debug code is normally execluded.

2* int versus u_int_32
2* char-pointer cast to uint-pointer

First is fixed by changing type
Second is fixed by getting the compiler to ignore the warning.
Which IMHO is valid since compiling GFSDBG is only done if you sort of know what is going on.....

Perhaps a suggestion on debugging on the manual page would be approriate as well.

Tested on 10.1, but probably valid on others as well.

svn diff:
Index: sbin/growfs/Makefile
===================================================================
--- sbin/growfs/Makefile        (revision 281869)
+++ sbin/growfs/Makefile        (working copy)
@@ -17,6 +17,8 @@

 .if defined(GFSDBG)
 SRCS+=  debug.c
+CFLAGS+=-DFS_DEBUG
+NO_WCAST_ALIGN= yes
 .endif

 DPADD= ${LIBUTIL}
Index: sbin/growfs/growfs.c
===================================================================
--- sbin/growfs/growfs.c        (revision 281869)
+++ sbin/growfs/growfs.c        (working copy)
@@ -161,7 +161,7 @@
 #ifdef FS_DEBUG
        {
                struct csum *dbg_csp;
-               int dbg_csc;
+               u_int32_t dbg_csc;
                char dbg_line[80];

                dbg_csp = fscs;
@@ -242,7 +242,7 @@
 #ifdef FS_DEBUG
        {
                struct csum     *dbg_csp;
-               int     dbg_csc;
+               u_int32_t       dbg_csc;
                char    dbg_line[80];

                dbg_csp = fscs;
Comment 1 commit-hook freebsd_committer freebsd_triage 2015-04-24 12:49:13 UTC
A commit references this bug:

Author: trasz
Date: Fri Apr 24 12:48:49 UTC 2015
New revision: 281929
URL: https://svnweb.freebsd.org/changeset/base/281929

Log:
  Fix growfs(8) build with debug enabled (make -DGFSDBG).

  PR:		199641
  Submitted by:	Willem Jan Withagen <wjw at digiware dot nl>
  MFC after:	1 month
  Sponsored by:	The FreeBSD Foundation

Changes:
  head/sbin/growfs/Makefile
  head/sbin/growfs/growfs.c
Comment 2 Edward Tomasz Napierala freebsd_committer freebsd_triage 2016-11-04 13:55:42 UTC
MFC-ed to 10 as r284669.