From owner-freebsd-current@FreeBSD.ORG Fri Mar 3 01:37:24 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F13D916A420; Fri, 3 Mar 2006 01:37:23 +0000 (GMT) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.FreeBSD.org (Postfix) with ESMTP id C7F8A43D48; Fri, 3 Mar 2006 01:37:21 +0000 (GMT) (envelope-from keramida@ceid.upatras.gr) Received: from flame.pc (aris.bedc.ondsl.gr [62.103.39.226]) (authenticated bits=128) by igloo.linux.gr (8.13.5/8.13.5/Debian-3) with ESMTP id k231b5mv013317 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 3 Mar 2006 03:37:06 +0200 Received: from flame.pc (flame [127.0.0.1]) by flame.pc (8.13.4/8.13.4) with ESMTP id k231aQln011021; Fri, 3 Mar 2006 03:36:26 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by flame.pc (8.13.4/8.13.4/Submit) id k231aQ1I011020; Fri, 3 Mar 2006 03:36:26 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Date: Fri, 3 Mar 2006 03:36:26 +0200 From: Giorgos Keramidas To: Craig Rodrigues Message-ID: <20060303013626.GA10925@flame.pc> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (score=-3.369, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.83, BAYES_00 -2.60, DNS_FROM_RFC_ABUSE 0.20) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr Cc: freebsd-current@freebsd.org Subject: NULL pointer passed to printf() in sbin/mount/mount.c X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Mar 2006 01:37:24 -0000 Hi Craig & -current, After a recent update to HEAD, I noticed that ``mount -p'' no longer prints the flags of the mounted filesystems correctly: keramida@flame:/home/keramida$ mount -p /dev/ad0s2a / ufs (null) 1 1 devfs /dev devfs (null) 0 0 /dev/ad0s2d /var ufs (null) 2 2 /dev/ad0s2e /usr ufs (null) 2 2 /dev/ad0s2f /home ufs (null) 2 2 /dev/md0 /tmp ufs (null) 2 2 devfs /var/named/dev devfs (null) 0 0 keramida@flame:/home/keramida$ Here ``(null)'' seems to be the output of a printf %s format which got a NULL pointer. The following patch for src/sbin/mount/mount.c triggers an assertion quite reproducibly: % build@flame:/home/build/src/sbin/mount$ svn di % Index: mount.c % =================================================================== % --- mount.c (revision 23) % +++ mount.c (working copy) % @@ -46,6 +46,7 @@ % #include % #include % % +#include % #include % #include % #include % @@ -754,6 +755,7 @@ % char *opts; % % opts = flags2opts(ent->f_flags); % + assert(opts != NULL); % printf("%s\t%s\t%s %s", ent->f_mntfromname, ent->f_mntonname, % ent->f_fstypename, opts); % free(opts); % build@flame:/home/build/src/sbin/mount$ Any idea how the following core dump can be fixed for HEAD? % build@flame:/home/build/src/sbin/mount$ export MAKEOBJDIRPREFIX=/home/build/obj % build@flame:/home/build/src/sbin/mount$ export DEBUG_FLAGS='-g' % build@flame:/home/build/src/sbin/mount$ make cleandir % rm -f mount mount.o mount_fs.o getmntopts.o vfslist.o mount.8.gz mount.8.cat.gz % rm -f .depend GPATH GRTAGS GSYMS GTAGS % build@flame:/home/build/src/sbin/mount$ make cleandir % rm -f mount mount.o mount_fs.o getmntopts.o vfslist.o mount.8.gz mount.8.cat.gz % rm -f .depend GPATH GRTAGS GSYMS GTAGS % build@flame:/home/build/src/sbin/mount$ make obj % /home/build/obj/home/build/src/sbin/mount created for /home/build/src/sbin/mount % build@flame:/home/build/src/sbin/mount$ make % cc -O2 -fno-strict-aliasing -pipe -g -Wsystem-headers -Werror -Wall \ % -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes \ % -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual \ % -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter \ % -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls \ % -c /home/build/src/sbin/mount/mount.c % cc -O2 -fno-strict-aliasing -pipe -g -Wsystem-headers -Werror -Wall \ % -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes \ % -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual \ % -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter \ % -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls \ % -c /home/build/src/sbin/mount/mount_fs.c % cc -O2 -fno-strict-aliasing -pipe -g -Wsystem-headers -Werror -Wall \ % -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes \ % -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual \ % -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter \ % -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls \ % -c /home/build/src/sbin/mount/getmntopts.c % cc -O2 -fno-strict-aliasing -pipe -g -Wsystem-headers -Werror -Wall \ % -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes \ % -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual \ % -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter \ % -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls \ % -c /home/build/src/sbin/mount/vfslist.c % cc -O2 -fno-strict-aliasing -pipe -g -Wsystem-headers -Werror -Wall \ % -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes \ % -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual \ % -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter \ % -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls \ % -o mount mount.o mount_fs.o getmntopts.o vfslist.o % gzip -cn /home/build/src/sbin/mount/mount.8 > mount.8.gz % build@flame:/home/build/src/sbin/mount$ /home/build/obj/home/build/src/sbin/mount/mount -p % Assertion failed: (opts != NULL), function putfsent, file /home/build/src/sbin/mount/mount.c, line 758. % Abort trap: 6 (core dumped) % build@flame:/home/build/src/sbin/mount$