pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/45078: pkgtools/pkg_install expand %D to destdir/pkgsrc_root



>Number:         45078
>Category:       pkg
>Synopsis:       pkgtools/pkg_install expand %D to destdir/pkgsrc_root
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 17 14:45:00 +0000 2011
>Originator:     Thomas Cort
>Release:        N/A
>Organization:
Minix3
>Environment:
Minix 192.168.122.210 3.2.0 i686
>Description:
PLIST files can have commands to be executed using the @exec directive. 
Pkgin for instance uses "@exec ${MKDIR} %D/etc/pkgin". The %D is supposed
to be expanded to pkgsrc root. Earlier pkg_add would ignore the destdir
when expanding the %D. This changes pkg_add to expand %D to
destdir/pkgsrc_root.

This patch was moved from pkg/45047 so that the PR would
only deal with one problem.
>How-To-Repeat:

>Fix:
--- a/pkg_install/files/lib/plist.c     Thu Jun 16 19:34:17 2011
+++ b/pkg_install/files/lib/plist.c     Thu Jun 16 19:39:51 2011
@@ -514,6 +514,7 @@
        int     fail = SUCCESS;
        Boolean preserve;
        char    tmp[MaxPathSize];
+       char    cmd[MaxPathSize];
        const char *prefix = NULL, *name = NULL;
 
        if (!pkgdb_open(ReadWrite)) {
@@ -580,10 +581,12 @@
                case PLIST_UNEXEC:
                        if (NoDeleteFiles)
                                break;
-                       format_cmd(tmp, sizeof(tmp), p->name, prefix, 
last_file);
-                       printf("Executing `%s'\n", tmp);
-                       if (!Fake && system(tmp)) {
-                               warnx("unexec command for `%s' failed", tmp);
+                       (void) snprintf(tmp, sizeof(tmp), "%s%s%s",
+                                       destdir ? destdir : "", destdir ? "/" : 
"", prefix);
+                       format_cmd(cmd, sizeof(cmd), p->name, tmp, last_file);
+                       printf("Executing `%s'\n", cmd);
+                       if (!Fake && system(cmd)) {
+                               warnx("unexec command for `%s' failed", cmd);
                                fail = FAIL;
                        }
                        break;



Home | Main Index | Thread Index | Old Index