pkgsrc-Bugs archive

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

pkg/46048: pkg_add fails to create missing subdirectories when registering a package in PKGDB



>Number:         46048
>Category:       pkg
>Synopsis:       pkg_add fails to create missing subdirectories when 
>registering a package in PKGDB
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Feb 18 19:15:00 +0000 2012
>Originator:     Nicolas Thauvin
>Release:        5.1.2
>Organization:
>Environment:
NetBSD panther.orgrim.net 5.1.2 NetBSD 5.1.2 (GENERIC) #0: Thu Feb  2 17:22:10 
UTC 2012  
builds%b6.netbsd.org@localhost:/home/builds/ab/netbsd-5-1-2-RELEASE/i386/201202021012Z-obj/home/builds/ab/netbsd-5-1-2-RELEASE/src/sys/arch/i386/compile/GENERIC
 i386
>Description:
This affects pkg_install-20120128

pkg_add fails to install a package when subdiretories are missing in the path 
to package diretory in /var/db/pkg

The mkdir_p function uses stat() on the wrong path when checking if a missing 
subdirectory has been successufully created.
>How-To-Repeat:
Run pkg_add -K /path/to/db pkg where at least the "to" component does not exists

>Fix:
Index: pkgtools/pkg_install/files/add/perform.c
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/pkg_install/files/add/perform.c,v
retrieving revision 1.101
diff -u -p -r1.101 perform.c
--- pkgtools/pkg_install/files/add/perform.c    28 Jan 2012 12:33:04 -0000      
1.101
+++ pkgtools/pkg_install/files/add/perform.c    18 Feb 2012 19:02:56 -0000
@@ -206,7 +206,7 @@ mkdir_p(const char *path)
 
                if (mkdir(p, 0777) == -1) {
                        saved_errno = errno;
-                       if (stat(path, &sb) == 0) {
+                       if (stat(p, &sb) == 0) {
                                if (S_ISDIR(sb.st_mode))
                                        goto pass;
                                errno = ENOTDIR;



Home | Main Index | Thread Index | Old Index