Subject: bin/35027: -current getconf(1) is badly broken
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <njoly@pasteur.fr>
List: netbsd-bugs
Date: 11/09/2006 22:55:00
>Number: 35027
>Category: bin
>Synopsis: -current getconf(1) is badly broken
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Nov 09 22:55:00 +0000 2006
>Originator: Nicolas Joly
>Release: NetBSD 4.99.3
>Organization:
Institut Pasteur, Paris.
>Environment:
System: NetBSD lanfeust.sis.pasteur.fr 4.99.3 NetBSD 4.99.3 (LANFEUST) #0: Tue Nov 7 20:44:06 CET 2006 njoly@lanfeust.sis.pasteur.fr:/local/src/NetBSD/obj/amd64/sys/arch/amd64/compile/LANFEUST amd64
Architecture: x86_64
Machine: amd64
>Description:
I just noticed that getconf(1) is badly broken with the latest revision
1.23 (new option -a from PR bin/31053). Where the previous version 1.22
worked fine, the new binary crash or show unexpected results ...
njoly@lanfeust [tmp/getconf]> getconf ARG_MAX
zsh: segmentation fault (core dumped) getconf ARG_MAX
njoly@lanfeust [tmp/getconf]> ./getconf.122 ARG_MAX
262144
njoly@lanfeust [tmp/getconf]> getconf NAME_MAX .
usage: getconf system_var
getconf -a
getconf path_var pathname
getconf -a pathname
njoly@lanfeust [tmp/getconf]> ./getconf.122 NAME_MAX .
255
Even the `-a' option does not seems to work as expected.
njoly@lanfeust [tmp/getconf]> getconf -a
usage: getconf system_var
getconf -a
getconf path_var pathname
getconf -a pathname
njoly@lanfeust [tmp/getconf]> getconf -a .
PATH = /usr/bin:/bin:/usr/sbin:/sbin:/usr/pkg/bin:/usr/pkg/sbin:/usr/local/bin:/usr/local/sbin
POSIX2_BC_BASE_MAX = 99
[...]
ATEXIT_MAX = undefined
GETGR_R_SIZE_MAX = 1024
GETPW_R_SIZE_MAX = 1024
>How-To-Repeat:
getconf ARG_MAX
getconf NAME_MAX .
getconf -a
getconf -a .
>Fix:
Index: usr.bin/getconf/getconf.c
===================================================================
RCS file: /cvsroot/src/usr.bin/getconf/getconf.c,v
retrieving revision 1.23
diff -u -r1.23 getconf.c
--- usr.bin/getconf/getconf.c 7 Oct 2006 15:20:44 -0000 1.23
+++ usr.bin/getconf/getconf.c 9 Nov 2006 18:47:40 -0000
@@ -205,7 +205,7 @@
usage();
/* NOTREACHED */
}
- if (a_flag) {
+ if (!a_flag) {
varname = argv[0];
argc--;
argv++;
@@ -244,7 +244,7 @@
if (a_flag)
(void)printf("%s = %ld\n", name, value);
else
- (void)printf("%ldn", value);
+ (void)printf("%ld\n", value);
}
static void