From owner-freebsd-current Wed Mar 31 1: 8:21 1999 Delivered-To: freebsd-current@freebsd.org Received: from stampede.cs.berkeley.edu (stampede.CS.Berkeley.EDU [128.32.45.124]) by hub.freebsd.org (Postfix) with ESMTP id 8545B14C49; Wed, 31 Mar 1999 01:08:19 -0800 (PST) (envelope-from asami@cs.berkeley.edu) Received: from silvia.hip.berkeley.edu (sji-ca3-65.ix.netcom.com [209.109.233.65]) by stampede.cs.berkeley.edu (8.8.7/8.7.3) with ESMTP id BAA16928; Wed, 31 Mar 1999 01:08:08 -0800 (PST) Received: (from asami@localhost) by silvia.hip.berkeley.edu (8.9.2/8.6.9) id BAA48078; Wed, 31 Mar 1999 01:07:51 -0800 (PST) Date: Wed, 31 Mar 1999 01:07:51 -0800 (PST) Message-Id: <199903310907.BAA48078@silvia.hip.berkeley.edu> X-Authentication-Warning: silvia.hip.berkeley.edu: asami set sender to asami@cs.berkeley.edu using -f To: Dom.Mitchell@palmerharvey.co.uk Cc: current@freebsd.org, jkh@freebsd.org In-reply-to: (message from Dom Mitchell on Wed, 31 Mar 1999 09:56:07 +0100) Subject: Re: /var/db/pkg/.mkversion From: asami@freebsd.org (Satoshi - the Wraith - Asami) References: Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * From: Dom Mitchell * Just a side note; this new file breaks pkg_info. I've appended a simple * patch below; somebody ought to do something better for the version in * the src tree. Eek. I didn't know it tries to open all files without checking whether it's a directory or not.... * if (chdir(log_dir) == FAIL) { * - warnx("can't change directory to '%s'!", log_dir); * - return 1; * + if (strcmp(log_dir, "/var/db/pkg/.mkversion") != 0) { * + warnx("can't change directory to '%s'!", log_dir); * + return 1; * + } This doesn't look right. I found where it's skipping "." and "..", either we add ".mkversion" there, skip all entries that start with an ".", or check whether a given entry is a directory. I implemented the second option, I think I can ensure that there will be no packages that start with a ".". Jordan, is this ok? === Index: perform.c =================================================================== RCS file: /usr/cvs/src/usr.sbin/pkg_install/info/perform.c,v retrieving revision 1.26 diff -u -r1.26 perform.c --- perform.c 1998/12/16 13:59:31 1.26 +++ perform.c 1999/03/31 09:04:50 @@ -57,7 +57,7 @@ dirp = opendir(tmp); if (dirp) { for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp)) - if (strcmp(dp->d_name, ".") && strcmp(dp->d_name, "..")) + if (dp->d_name[0] != '.') err_cnt += pkg_do(dp->d_name); (void)closedir(dirp); } === -W To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message