| Summary: | pkg_add don't threat -t flag properly | ||
|---|---|---|---|
| Product: | Base System | Reporter: | vova <vova> |
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 5.0-CURRENT | ||
| Hardware: | Any | ||
| OS: | Any | ||
State Changed From-To: open->closed The fix for the problem has been committed into -current and will be MFC'ed into -stable shortly. Thank you for reporting! |
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>