From owner-freebsd-bugs Sat Mar 17 17:50: 7 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id BBC5437B719 for ; Sat, 17 Mar 2001 17:50:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f2I1o1D86309; Sat, 17 Mar 2001 17:50:01 -0800 (PST) (envelope-from gnats) Received: from stash.attlabs.att.com (mpfg.attlabs.net [12.106.35.2]) by hub.freebsd.org (Postfix) with ESMTP id 830CE37B718 for ; Sat, 17 Mar 2001 17:42:10 -0800 (PST) (envelope-from fenner@stash.attlabs.att.com) Received: (from fenner@localhost) by stash.attlabs.att.com (8.11.2/8.11.2) id f2I1cel91374; Sat, 17 Mar 2001 17:38:40 -0800 (PST) (envelope-from fenner) Message-Id: <200103180138.f2I1cel91374@stash.attlabs.att.com> Date: Sat, 17 Mar 2001 17:38:40 -0800 (PST) From: Bill Fenner Reply-To: fenner@research.att.com To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: bin/25886: cgetset(3) doesn't get cleared when switching databases Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 25886 >Category: bin >Synopsis: cgetset(3) doesn't get cleared when switching databases >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Mar 17 17:50:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: Bill Fenner >Release: FreeBSD 5.0-CURRENT i386 >Organization: AT&T Labs - Research >Environment: System: FreeBSD stash.attlabs.att.com 5.0-CURRENT FreeBSD 5.0-CURRENT #2: Tue Feb 27 18:26:16 PST 2001 root@stash.attlabs.att.com:/usr/obj/usr/src/sys/GENERIC i386 The bug is also present in 4.2-RELEASE and 4.3-BETA. >Description: The getcap(3) library provides the ability, using cgetset(), to prepend an entry to a capabilities database. This is used, e.g., by libtermcap when the $TERMCAP environment variable is set. However, if an application using libtermcap also uses getcap(3) itself, the value prepended by libtermcap is also prepended to the application's database. This is noted in the getcap(3) BUGS section, so I suppose this is vaugely an lpc bug. >How-To-Repeat: % eval `tset -s` % lpc lpc> stat all Notice the extra printer named after your terminal type. % echo "$TERMCAP" aha, that's where it came from. >Fix: Workaround: call cgetset(NULL) right before the first cgetfirst() in any getcap(3) consumer (e.g. usr.sbin/lpr/common_source/printcap.c), particularly those that link with -ltermcap (but who knows what other library function might use cgetset(), so better safe than sorry). Fix: Change the getcap(3) API? Make cgetfirst() notice that it's being called with a different db_array without a cgetset() call in between and call cgetset(NULL)? (eeew) Make cgetclose() call cgetset(NULL) if gottoprec == 1? (subtle API change but less eeew) >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message