Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Sep 2001 17:10:35 +0400
From:      "Vladimir B.Grebenschikov" <vova@express.ru>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/30843: pkg_add don't threat -t flag properly
Message-ID:  <E15mESR-0000Q8-00@vbook.express.ru>

next in thread | raw e-mail | index | archive | help

>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<UNIQNUM>.tmp directory


>How-To-Repeat:

  pkg_add -t /tmp/some-none-existant-dir-for-template.XXXXX <package>

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E15mESR-0000Q8-00>