From owner-freebsd-bugs Wed Sep 26 6:10: 8 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 E085337B426 for ; Wed, 26 Sep 2001 06:10:00 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f8QDA0025640; Wed, 26 Sep 2001 06:10:00 -0700 (PDT) (envelope-from gnats) Received: from vbook.express.ru (asplinux.ru [195.133.213.194]) by hub.freebsd.org (Postfix) with ESMTP id 90D1E37B418 for ; Wed, 26 Sep 2001 06:08:53 -0700 (PDT) Received: from vova by vbook.express.ru with local (Exim 3.31 #2) id 15mESR-0000Q8-00 for FreeBSD-gnats-submit@freebsd.org; Wed, 26 Sep 2001 17:10:35 +0400 Message-Id: Date: Wed, 26 Sep 2001 17:10:35 +0400 From: "Vladimir B.Grebenschikov" Reply-To: "Vladimir B.Grebenschikov" To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.113 Subject: bin/30843: pkg_add don't threat -t flag properly Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 30843 >Category: bin >Synopsis: pkg_add don't threat -t flag properly >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Sep 26 06:10:00 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Vladimir B. Grebenschikov >Release: FreeBSD 5.0-CURRENT i386, 4.4-RELEASE >Organization: TSB "Russian Express" >Environment: System: FreeBSD vbook.express.ru 5.0-CURRENT FreeBSD 5.0-CURRENT #3: Mon Sep 24 15:59:42 MSD 2001 root@walder.asplinux.ru:/usr/obj/ext/current/src/sys/VBOOK i386 >Description: pkg_add don't understand -t flag according man: -t template Use template as the input to mktemp(3) when creating a `staging area''. By default, this is the string /var/tmp/instmp.XXXXXX, but it may be necessary to override it in the situation where space in your /var/tmp directory is limited. Be sure to leave some number of characters for mktemp(3) to fill in with a unique ID. reading source src/usr.sbin/pkg_install/lib/pen.c: find_play_pen(char *pen, size_t sz) { char *cp; struct stat sb; if (pen[0] && stat(pen, &sb) != FAIL && (min_free(pen) >= sz)) ----------------- ^^^^^^^^^^^^^^ return pen; else if ((cp = getenv("PKG_TMPDIR")) != NULL && stat(cp, &sb) != FAIL && (min_free(cp) >= sz)) sprintf(pen, "%s/instmp.XXXXXX", cp); else if ((cp = getenv("TMPDIR")) != NULL && stat(cp, &sb) != FAIL && (min_free(cp) >= sz)) sprintf(pen, "%s/instmp.XXXXXX", cp); else if (stat("/var/tmp", &sb) != FAIL && min_free("/var/tmp") >= sz) strcpy(pen, "/var/tmp/instmp.XXXXXX"); else if (stat("/tmp", &sb) != FAIL && min_free("/tmp") >= sz) strcpy(pen, "/tmp/instmp.XXXXXX"); else if ((stat("/usr/tmp", &sb) == SUCCESS || mkdir("/usr/tmp", 01777) == SUCCESS) && min_free("/usr/tmp") >= sz) strcpy(pen, "/usr/tmp/instmp.XXXXXX"); else { cleanup(0); So, if we run "pkg_add -t /tmp/SOMEXXXXX.tmp package" pkg_add will check /tmp/SOMEXXXXX.tmp for existance and then completly ignore -t parametr instead of create /tmp/SOME.tmp directory >How-To-Repeat: pkg_add -t /tmp/some-none-existant-dir-for-template.XXXXX >Fix: >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message