Ticket #39018: dpkg_1.17.25.patch
File dpkg_1.17.25.patch, 32.8 KB (added by xeron (Ivan Larionov), 10 years ago) |
---|
-
Portfile
diff --git a/Portfile b/Portfile index c6f72ca..90ec39e 100644
a b 1 # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 1 2 # $Id: Portfile 105815 2013-05-06 14:52:20Z landonf@macports.org $ 2 3 3 PortSystem 1.0 4 5 name dpkg 6 version 1.14.29 7 revision 4 8 platforms darwin freebsd 9 categories sysutils archivers 10 license GPL-2+ 11 maintainers nomaintainer 12 description Debian package maintenance system 13 long_description ${description} 14 homepage http://wiki.debian.org/Teams/Dpkg 15 16 master_sites debian:d/dpkg/ 17 checksums md5 4326172a959b5b6484b4bc126e9f628d \ 18 sha1 15a35dd96dac6a99f24844b2eff85f8fad37ab06 4 PortSystem 1.0 5 PortGroup perl5 1.0 6 7 name dpkg 8 version 1.17.25 9 platforms darwin freebsd 10 categories sysutils archivers 11 license GPL-2+ 12 maintainers gwmail.gwu.edu:egall openmaintainer 13 description Debian package maintenance system 14 long_description ${name} is the basis of the ${description}. 15 16 homepage http://wiki.debian.org/Teams/Dpkg 17 18 master_sites debian:d/${name}/ 19 checksums md5 e48fcfdb2162e77d72c2a83432d537ca \ 20 rmd160 7f6dde14a0bf587927f80bc39ed6ab88acda7913 \ 21 sha256 07019d38ae98fb107c79dbb3690cfadff877f153b8c4970e3a30d2e59aa66baa 22 23 use_xz yes 24 extract.asroot yes 25 26 depends_build-append \ 27 port:pkgconfig \ 28 port:autoconf-archive \ 29 port:xorg-util-macros \ 30 port:gnutar \ 31 port:perl${perl5.major} \ 32 bin:git:git-core \ 33 bin:lzma:xz 19 34 20 35 # Use MacPorts versions explicitly 21 depends_lib port:gettext \ 22 port:libiconv \ 23 port:perl5 \ 24 port:coreutils \ 25 port:bzip2 \ 26 port:zlib 27 28 depends_run bin:gnutar:gnutar \ 29 bin:lzma:xz 30 36 depends_lib-append port:gettext \ 37 port:libiconv \ 38 port:perl${perl5.major} \ 39 port:p${perl5.major}-timedate \ 40 port:coreutils \ 41 port:bzip2 \ 42 port:gzip \ 43 port:zlib \ 44 port:ncurses \ 45 port:gnutar \ 46 port:md5sha1sum \ 47 path:lib/pkgconfig/liblzma.pc:xz 48 49 depends_run-append port:gnutar \ 50 port:gzip \ 51 bin:lzma:xz \ 52 bin:perl5:perl${perl5.major} \ 53 port:debianutils 54 55 # got to do some underscore-to-hyphen twiddling... 56 distname ${name}_${version} 57 worksrcdir ${name}-${version} 58 59 configure.perl ${prefix}/bin/perl5 60 configure.pkg_config ${prefix}/bin/pkg-config 61 configure.env-append TAR=${prefix}/bin/gnutar 62 configure.args-append \ 63 --with-libintl-prefix=${prefix} \ 64 --with-libiconv-prefix=${prefix} \ 65 --with-admindir=${prefix}/var/db/${name} \ 66 --with-logdir=${prefix}/var/log \ 67 --mandir=${prefix}/share/man \ 68 --with-zlib \ 69 --with-bz2 \ 70 --with-liblzma \ 71 --disable-linker-optimisations \ 72 --disable-silent-rules \ 73 --disable-start-stop-daemon 74 # The start-stop-daemon patch now applies again, but now it leads to build 75 # errors, so disabling it with a configure flag again (as done above) 76 77 # ccache is trouble 78 configure.ccache no 79 80 # Older versions of gcc choke with the -Wvla warning flag 81 configure.cflags-delete -Wvla 82 configure.cppflags-delete -Wvla 83 configure.ldflags-delete -Wvla 84 85 post-configure { 86 reinplace "s|-Wvla||" ${worksrcpath}/Makefile 87 eval reinplace "s|-Wvla||" [glob ${worksrcpath}/*/Makefile] 88 eval reinplace "s|-Wvla||" [glob ${worksrcpath}/lib/*/Makefile] 89 reinplace "s|-Wvla||" ${worksrcpath}/lib/dpkg/test/Makefile 90 reinplace "s|-Wmissing-declarations||" ${worksrcpath}/dselect/Makefile 91 } 31 92 32 distname ${name}_${version} 33 worksrcdir ${name}-${version} 93 compiler.blacklist-append cc gcc-3.3 gcc-4.0 apple-gcc-4.0 34 94 35 patchfiles patch-lib_tarfn.c \ 36 patch-main_remove.c \ 37 patch-main_archives.c \ 38 patch-scripts-Makefile \ 39 patch-lib_dpkg.h \ 40 ncurses.diff 95 build.type gnu 41 96 42 configure.env PERL=${prefix}/bin/perl5 43 configure.args --without-sgml-doc --with-libintl-prefix=${prefix} \ 44 --with-libiconv-prefix=${prefix} --with-admindir=${prefix}/var/db/dpkg \ 45 --mandir=${prefix}/share/man \ 46 --with-zlib --with-bz2 \ 47 --disable-linker-optimisations 97 set vardpkg ${destroot}${prefix}/var/db/${name} 98 destroot.keepdirs-append \ 99 ${vardpkg} \ 100 ${vardpkg}/updates \ 101 ${vardpkg}/info \ 102 ${destroot}${prefix}/var/log \ 103 ${destroot}${prefix}/etc/${name} 48 104 49 build.type gnu 105 patchfiles-append patch-configure.ac.diff \ 106 patch-lib_dpkg_tarfn.c.diff \ 107 patch-src_remove.c.diff \ 108 patch-src_archives.c.diff \ 109 patch-utils_start-stop-daemon.c.diff \ 110 patch-scripts_Dpkg_Source_Archive.pm.diff 50 111 51 set vardpkg ${destroot}${prefix}/var/db/dpkg 52 destroot.keepdirs ${vardpkg} ${vardpkg}/updates ${vardpkg}/info 112 patch.args-append --backup 53 113 54 114 post-patch { 55 set scripts ${worksrcpath}/scripts 56 reinplace s|/etc/dpkg/|${prefix}/etc/dpkg/| \ 57 ${scripts}/dpkg-shlibdeps.pl \ 58 ${scripts}/dpkg-source.pl 59 60 reinplace s|/etc/alternatives|${prefix}/etc/alternatives|g \ 61 ${scripts}/update-alternatives.pl 115 set scripts ${worksrcpath}/scripts 116 reinplace "s|/etc/${name}/|${prefix}/etc/${name}/|" \ 117 ${scripts}/${name}-shlibdeps.pl \ 118 ${scripts}/${name}-source.pl 119 reinplace "s|AC_ERROR|AC_MSG_ERROR|" ${worksrcpath}/m4/dpkg-build.m4 120 file copy ${prefix}/share/aclocal/ax_check_gnu_make.m4 ${worksrcpath}/m4 121 file copy ${prefix}/share/aclocal/xorg-macros.m4 ${worksrcpath}/m4 122 system -W ${worksrcpath} "git init" 62 123 } 63 124 125 use_autoreconf yes 126 autoreconf.args -fvi --warnings=all 127 64 128 pre-destroot { 65 file mkdir ${destroot}${prefix}/share/doc/dpkg 129 file mkdir ${destroot}${prefix}/share/doc/${name} 66 130 } 67 131 68 132 post-destroot { 69 70 71 72 133 file mkdir ${vardpkg} 134 file mkdir ${vardpkg}/updates 135 file mkdir ${vardpkg}/info 136 system "touch ${vardpkg}/available ${vardpkg}/status" 73 137 } 74 138 139 # These platform variants had previously had patches associated 140 # with them... 75 141 platform darwin { 76 depends_build-append bin:gnumake:gmake 77 patchfiles-append patch-utils_start-stop-daemon.c bsd/patch-main_help.c 142 depends_build-append bin:gnumake:gmake 78 143 } 79 144 80 145 platform freebsd { 81 depends_build-append bin:gmake:gmake 82 patchfiles-append patch-utils_start-stop-daemon.c bsd/patch-main_help.c 146 depends_build-append bin:gmake:gmake 147 } 148 149 # This variant sometimes hangs while building... 150 variant docs description {Build documentation (warning: building documentation takes a long time)} { 151 depends_build-append port:doxygen \ 152 path:bin/dot:graphviz \ 153 port:fontconfig \ 154 port:freefont-ttf 155 set docdir ${prefix}/share/doc/${name} 156 configure.args-append --docdir=${docdir} \ 157 --htmldir=${docdir}/html \ 158 --dvidir=${docdir}/dvi \ 159 --pdfdir=${docdir}/pdf \ 160 --psdir=${docdir}/ps 161 build.target-append doc 162 pre-build { 163 elevateToRoot "doxygen" 164 system -W ${worksrcpath}/doc "${prefix}/bin/doxygen -u" 165 } 166 post-build { 167 system -W ${worksrcpath}/doc "${prefix}/bin/doxygen" 168 dropPrivileges 169 set destroot_docdir ${destroot}${prefix}/share/doc/${name} 170 xinstall -d ${destroot_docdir} 171 copy ${worksrcpath}/doc/doc ${destroot_docdir} 172 copy ${worksrcpath}/doc/html ${destroot_docdir} 173 foreach docfile {coding-style.txt triggers.txt README.feature-removal-schedule frontend.txt README.api} { 174 xinstall -m 644 ${worksrcpath}/doc/${docfile} ${destroot_docdir} 175 } 176 } 177 } 178 179 # Tests currently fail, this needs to be fixed eventually: 180 test.run yes 181 test.target check 182 183 pre-test { 184 elevateToRoot "test" 185 } 186 post-test { 187 dropPrivileges 83 188 } 84 189 85 livecheck.type 86 livecheck.url http://ftp.debian.org/debian/pool/main/d/dpkg/87 livecheck.regex 190 livecheck.type regex 191 livecheck.url http://ftp.debian.org/debian/pool/main/d/${name}/ 192 livecheck.regex "${name}_(\\d+\\.\\d+(\\.\\d+)*)" -
deleted file files/bsd/patch-main_help.c
diff --git a/files/bsd/patch-main_help.c b/files/bsd/patch-main_help.c deleted file mode 100644 index e4f4b89..0000000
+ - 1 --- src/help.c.old Thu Dec 9 16:35:16 20042 +++ src/help.c Thu Dec 9 16:35:38 20043 @@ -77,12 +77,11 @@4 5 void checkpath(void) {6 /* Verify that some programs can be found in the PATH. */7 - static const char *const checklist[]= { "ldconfig",8 + static const char *const checklist[]= {9 #if WITH_START_STOP_DAEMON10 "start-stop-daemon",11 #endif12 "install-info",13 - "update-rc.d",14 NULL15 };16 -
deleted file files/ncurses.diff
diff --git a/files/ncurses.diff b/files/ncurses.diff deleted file mode 100644 index 4e49161..0000000
+ - 1 --- dselect/Makefile.in.orig 2010-03-09 07:32:20.000000000 +11002 +++ dselect/Makefile.in 2011-03-11 12:01:25.000000000 +11003 @@ -640,7 +640,7 @@4 5 curkeys.$(OBJEXT): curkeys.h6 curkeys.h: $(srcdir)/keyoverride $(srcdir)/mkcurkeys.pl7 - cursesfile=`echo '#include <ncursesw/curses.h>' | \8 + cursesfile=`echo '#include <curses.h>' | \9 $(CC) -E - | grep 'curses.h' | head -n 1 | \10 sed -e 's/^[^"]*"//; s/".*$$//'`; \11 if [ "$$cursesfile" = "" ]; then \12 --- dselect/dselect.h.orig 2010-03-09 07:27:35.000000000 +110013 +++ dselect/dselect.h 2011-03-11 12:01:43.000000000 +110014 @@ -28,7 +28,7 @@15 16 #include <signal.h>17 #undef ERR18 -#include <ncursesw/curses.h>19 +#include <curses.h>20 21 struct helpmenuentry {22 char key;23 --- dselect/main.cc.orig 2010-03-09 07:27:35.000000000 +110024 +++ dselect/main.cc 2011-03-11 12:01:36.000000000 +110025 @@ -37,7 +37,7 @@ extern "C" {26 #include <ctype.h>27 #include <assert.h>28 29 -#include <ncursesw/term.h>30 +#include <term.h>31 32 extern "C" {33 #include <dpkg.h> -
new file files/patch-configure.ac.diff
diff --git a/files/patch-configure.ac.diff b/files/patch-configure.ac.diff new file mode 100644 index 0000000..131b917
- + 1 --- configure.ac.orig 2015-04-09 14:40:47.000000000 -0700 2 +++ configure.ac 2015-04-30 02:39:40.000000000 -0700 3 @@ -11,10 +11,10 @@ 4 5 AC_USE_SYSTEM_EXTENSIONS 6 7 -AM_INIT_AUTOMAKE([1.11 foreign nostdinc no-dist-gzip dist-xz]) 8 +AM_INIT_AUTOMAKE([1.11 dejagnu foreign nostdinc no-dist-gzip dist-xz tar-ustar -Wall]) 9 AM_SILENT_RULES([yes]) 10 11 -AM_GNU_GETTEXT_VERSION([0.18.2]) 12 +AM_GNU_GETTEXT_VERSION([0.18.3]) 13 AM_GNU_GETTEXT([external]) 14 DPKG_DIST_CHECK([test "$GMSGFMT" = ":" && test "$USE_NLS" = "yes"], 15 [gettext required when NLS support enabled]) 16 @@ -44,14 +44,33 @@ 17 DPKG_DEB_PROG_TAR 18 19 # Checks for programs. 20 -AC_PROG_CC 21 +AM_PROG_AR 22 +if test "x$CC" = "x"; then 23 + test -z "$CC" 24 + AC_PROG_CC 25 +else 26 + test ! -z "$CC" 27 + export CC 28 + AC_SUBST([CC]) 29 +fi 30 DPKG_C_C99 31 AC_PROG_CXX 32 DPKG_CXX_CXX11 33 -AC_PROG_LEX 34 -DPKG_DIST_CHECK([test "$LEX" = ":"], [lex program required]) 35 -AC_CHECK_PROGS([DOXYGEN], [doxygen]) 36 -AC_CHECK_PROG([HAVE_DOT], [dot], [YES], [NO]) 37 +if test "x$INSTALL" = "x"; then 38 + test -z "$INSTALL" 39 + AC_PROG_INSTALL 40 + AM_PROG_INSTALL_STRIP 41 +else 42 + test ! -z "$INSTALL" 43 + export INSTALL 44 + AC_SUBST([INSTALL]) 45 +fi 46 +AM_PROG_LEX 47 +DPKG_DIST_CHECK([test "$LEX" = ":"],[lex program required]) 48 +AC_CHECK_PROGS([DOXYGEN],[doxygen]) 49 +AC_CHECK_PROG([HAVE_DOT],[dot],[YES],[NO]) 50 +AX_CHECK_GNU_MAKE 51 +AC_PATH_PROG([TAR],[gnutar gtar tar]) 52 DPKG_PROG_PO4A 53 DPKG_PROG_PERL 54 DPKG_PROG_POD2MAN 55 @@ -59,6 +78,8 @@ 56 57 # Checks for operating system services and capabilities. 58 AC_SYS_LARGEFILE 59 +AC_OBJEXT 60 +AC_EXEEXT 61 62 # Checks for libraries. 63 DPKG_LIB_ZLIB 64 @@ -79,17 +100,36 @@ 65 sys/proc.h sys/pstat.h linux/fiemap.h]) 66 67 # Checks for typedefs, structures, and compiler characteristics. 68 +AC_HEADER_STDBOOL 69 AC_C_BIGENDIAN 70 AC_C_CONST 71 +AC_C_FLEXIBLE_ARRAY_MEMBER 72 AC_C_INLINE 73 +AC_C_PROTOTYPES 74 +AC_C_VARARRAYS 75 AC_C_VOLATILE 76 +AC_TYPE_INT16_T 77 +AC_TYPE_INT32_T 78 +AC_TYPE_INT8_T 79 AC_TYPE_MODE_T 80 +AC_FUNC_OBSTACK 81 +AC_TYPE_OFF_T 82 AC_TYPE_PID_T 83 AC_TYPE_SIZE_T 84 +AC_TYPE_SSIZE_T 85 +AC_CHECK_MEMBERS([struct stat.st_rdev]) 86 +AC_CHECK_DECLS([sys_siglist]) 87 +AC_TYPE_UINT16_T 88 +AC_TYPE_UINT32_T 89 +AC_TYPE_UINT64_T 90 +AC_TYPE_UINT8_T 91 +AC_TYPE_UID_T 92 DPKG_TYPES_U_INT_T 93 DPKG_TYPE_PTRDIFF_T 94 AC_CHECK_SIZEOF([unsigned int]) 95 +AC_CHECK_ALIGNOF([unsigned int]) 96 AC_CHECK_SIZEOF([unsigned long]) 97 +AC_CHECK_ALIGNOF([unsigned long]) 98 DPKG_DECL_SYS_SIGLIST 99 DPKG_DECL_SYS_ERRLIST 100 101 @@ -108,17 +148,28 @@ 102 DPKG_CHECK_COMPAT_FUNCS([getopt getopt_long obstack_free \ 103 strnlen strndup strerror strsignal asprintf \ 104 scandir alphasort unsetenv]) 105 +AC_FUNC_CHOWN 106 +AC_FUNC_ERROR_AT_LINE 107 +AC_FUNC_FORK 108 +AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK 109 +AC_FUNC_MALLOC 110 +AC_FUNC_MMAP 111 +AC_FUNC_REALLOC 112 +AC_FUNC_STRNLEN 113 AC_CHECK_DECLS([strnlen], [[#include <string.h>]]) 114 AC_CHECK_FUNCS([memcpy lchown], 115 [], [AC_MSG_ERROR([missing required function])]) 116 -AC_CHECK_FUNCS([strtoimax isascii setsid getdtablesize \ 117 - getprogname getexecname lutimes \ 118 - fallocate posix_fallocate posix_fadvise]) 119 +AC_CHECK_FUNCS([dup2 ftruncate getdtablesize getexecname \ 120 + getprogname gettimeofday isascii lutimes memchr memmove memset \ 121 + mkdir mkfifo munmap fallocate posix_fallocate posix_fadvise \ 122 + putenv regcomp rmdir select setenv setlocale \ 123 + setsid strcasecmp strchr strcspn strdup strncasecmp \ 124 + strpbrk strrchr strspn strstr strtoimax strtol]) 125 126 DPKG_MMAP 127 128 # Checks for the build machinery. 129 -AC_DEFINE(LIBDPKG_VOLATILE_API, 1, [Acknowledge the volatility of the API.]) 130 +AC_DEFINE(LIBDPKG_VOLATILE_API, [1], [Acknowledge the volatility of the API.]) 131 DPKG_COMPILER_WARNINGS 132 DPKG_COMPILER_OPTIMISATIONS 133 DPKG_LINKER_OPTIMISATIONS -
deleted file files/patch-lib_dpkg.h
diff --git a/files/patch-lib_dpkg.h b/files/patch-lib_dpkg.h deleted file mode 100644 index f683a0c..0000000
+ - 1 --- ./lib/dpkg.h.orig 2010-03-08 21:27:35.000000000 +01002 +++ ./lib/dpkg.h 2011-04-07 09:51:21.000000000 +02003 @@ -147,7 +147,7 @@4 #define DPKG "dpkg"5 #define DEBSIGVERIFY "/usr/bin/debsig-verify"6 7 -#define TAR "tar"8 +#define TAR "gnutar"9 #define GZIP "gzip"10 #define BZIP2 "bzip2"11 #define LZMA "lzma" -
new file files/patch-lib_dpkg_tarfn.c.diff
diff --git a/files/patch-lib_dpkg_tarfn.c.diff b/files/patch-lib_dpkg_tarfn.c.diff new file mode 100644 index 0000000..8145918
- + 1 --- lib/dpkg/tarfn.c.orig 2015-04-09 14:40:47.000000000 -0700 2 +++ lib/dpkg/tarfn.c 2015-04-30 02:48:06.000000000 -0700 3 @@ -40,6 +40,9 @@ 4 #define TAR_MAGIC_USTAR "ustar\0" "00" 5 #define TAR_MAGIC_GNU "ustar " " \0" 6 7 +static const char ustarMagic[] = { 'u', 's', 't', 'a', 'r', '\0', '0', '0', '\0' }; 8 +static const char gnutarMagic[] = { 'u', 's', 't', 'a', 'r', ' ', ' ', '\0' }; 9 + 10 struct tar_header { 11 char name[100]; 12 char mode[8]; 13 @@ -53,6 +56,7 @@ 14 15 /* Only valid on ustar and gnu. */ 16 char magic[8]; 17 + char MagicNumber[8]; /* POSIX: "ustar\000", GNU: "ustar \0" (blank blank null) */ 18 char user[32]; 19 char group[32]; 20 char devmajor[8]; 21 @@ -60,6 +64,7 @@ 22 23 /* Only valid on ustar. */ 24 char prefix[155]; 25 + char Prefix[155]; /* POSIX ustar header */ 26 }; 27 28 /** -
deleted file files/patch-lib_tarfn.c
diff --git a/files/patch-lib_tarfn.c b/files/patch-lib_tarfn.c deleted file mode 100644 index 1365bb8..0000000
+ - 1 --- lib/tarfn.c.orig Wed Jan 26 18:31:15 20052 +++ lib/tarfn.c Wed Jan 26 19:26:19 20053 @@ -18,6 +18,9 @@4 5 #include "strnlen.h"6 7 +static const char ustarMagic[] = { 'u', 's', 't', 'a', 'r', '\0', '0', '0', '\0' };8 +static const char gnutarMagic[] = { 'u', 's', 't', 'a', 'r', ' ', ' ', '\0' };9 +10 struct TarHeader {11 char Name[100];12 char Mode[8];13 @@ -28,11 +31,12 @@14 char Checksum[8];15 char LinkFlag;16 char LinkName[100];17 - char MagicNumber[8];18 + char MagicNumber[8]; /* POSIX: "ustar\000", GNU: "ustar \0" (blank blank null) */19 char UserName[32];20 char GroupName[32];21 char MajorDevice[8];22 char MinorDevice[8];23 + char Prefix[155]; /* POSIX ustar header */24 };25 typedef struct TarHeader TarHeader;26 27 @@ -78,6 +82,10 @@28 struct passwd * passwd = NULL;29 struct group * group = NULL;30 unsigned int i;31 + char *prefix, *name, *file;32 + size_t prefixLen;33 + size_t nameLen;34 + size_t fileLen;35 long sum;36 long checksum;37 38 @@ -86,7 +94,35 @@39 if ( *h->GroupName )40 group = getgrnam(h->GroupName);41 42 - d->Name = StoC(h->Name, sizeof(h->Name));43 + /*44 + * Is this a ustar archive entry?45 + * Is Prefix in use?46 + */47 + if ((memcmp(h->MagicNumber, ustarMagic, sizeof(h->MagicNumber)) == 0) && h->Prefix[0]) {48 + prefixLen = strnlen(h->Prefix, sizeof(h->Prefix));49 +50 + prefix = StoC(h->Prefix, prefixLen);51 + if (h->Prefix[prefixLen - 1] != '/') {52 + prefixLen++; /* Space for '/' */53 + /* The rest of the code doesn't care if malloc fails, so we won't either */54 + prefix = realloc(prefix, prefixLen + 1); /* prefix + \0 */55 + prefix[prefixLen - 1] = '/';56 + prefix[prefixLen] = '\0';57 + }58 +59 + nameLen = strnlen(h->Name, sizeof(h->Name));60 + name = StoC(h->Name, nameLen);61 +62 + file = realloc(prefix, prefixLen + nameLen + 1); /* prefix + name + \0 */63 + strcat(file, name);64 +65 + free(name);66 +67 + d->Name = file;68 + } else {69 + d->Name = StoC(h->Name, sizeof(h->Name));70 + }71 +72 d->LinkName = StoC(h->LinkName, sizeof(h->LinkName));73 d->Mode = (mode_t)OtoL(h->Mode, sizeof(h->Mode));74 d->Size = (size_t)OtoL(h->Size, sizeof(h->Size)); -
deleted file files/patch-main_archives.c
diff --git a/files/patch-main_archives.c b/files/patch-main_archives.c deleted file mode 100644 index 35dbe56..0000000
+ - 1 --- src/archives.c.orig Thu Nov 11 20:10:03 20042 +++ src/archives.c Fri Dec 17 17:34:55 20043 @@ -373,6 +373,7 @@4 static struct varbuf conffderefn, hardlinkfn, symlinkfn;5 static int fd;6 const char *usename;7 + char *s = NULL;8 9 struct conffile *conff;10 struct tarcontext *tc= (struct tarcontext*)ti->UserData;11 @@ -423,7 +424,15 @@12 }13 }14 15 - usename= namenodetouse(nifd->namenode,tc->pkg)->name + 1; /* Skip the leading `/' */16 + usename= namenodetouse(nifd->namenode,tc->pkg)->name; /* Skip the leading `/' */17 + if (*usename == '.' && *usename + 1 == '/') {18 + usename += 1; /* Skip the leading `.' */19 + } else if (*usename != '/') {20 + s = malloc(strlen(usename) + 2); /* 1 for NULL, one for `/' we're going to add */21 + strcpy(s + 1, usename);22 + *s = '/';23 + usename = s;24 + }25 26 if (nifd->namenode->flags & fnnf_new_conff) {27 /* If it's a conffile we have to extract it next to the installed28 @@ -435,6 +444,10 @@29 }30 31 setupfnamevbs(usename);32 +33 + if (s != NULL) {34 + free(s);35 + }36 37 statr= lstat(fnamevb.buf,&stab);38 if (statr) { -
deleted file files/patch-main_remove.c
diff --git a/files/patch-main_remove.c b/files/patch-main_remove.c deleted file mode 100644 index d9fe787..0000000
+ - 1 --- src/remove.c.orig Fri Dec 10 15:48:16 20042 +++ src/remove.c Fri Dec 10 15:51:29 20043 @@ -266,7 +266,18 @@4 push_leftover(&leftover,namenode);5 continue;6 }7 - if (errno != ENOTDIR) ohshite(_("cannot remove `%.250s'"),fnvb.buf);8 + if (errno != ENOTDIR) {9 + /* XXX Hack:10 + * dpkg includes /. in the packing list.11 + * rmdir("/.") will return EINVAL. dpkg will12 + * only attempt to remove /. when uninstalling13 + * the last package on the system, which is why14 + * Debian has never run into this issue. */15 + if (errno == EINVAL && strcmp(fnvb.buf, "/.") == 0)16 + continue;17 + else18 + ohshite(_("cannot remove `%.250s'"),fnvb.buf);19 + }20 debug(dbg_eachfiledetail, "removal_bulk unlinking `%s'", fnvb.buf);21 {22 /*23 @@ -383,7 +394,18 @@24 push_leftover(&leftover,namenode);25 continue;26 }27 - if (errno != ENOTDIR) ohshite(_("cannot remove `%.250s'"),fnvb.buf);28 + if (errno != ENOTDIR) {29 + /* XXX Hack:30 + * dpkg includes /. in the packing list.31 + * rmdir("/.") will return EINVAL. dpkg will32 + * only attempt to remove /. when uninstalling33 + * the last package on the system, which is why34 + * Debian has never run into this issue. */35 + if (errno == EINVAL && strcmp(fnvb.buf, "/.") == 0)36 + continue;37 + else38 + ohshite(_("cannot remove `%.250s'"),fnvb.buf);39 + }40 41 push_leftover(&leftover,namenode);42 continue; -
deleted file files/patch-scripts-Makefile
diff --git a/files/patch-scripts-Makefile b/files/patch-scripts-Makefile deleted file mode 100644 index 823c12a..0000000
+ - 1 --- scripts/Makefile.am.orig 2010-03-08 21:27:35.000000000 +01002 +++ scripts/Makefile.am 2011-01-03 10:15:37.000000000 +01003 @@ -123,7 +123,7 @@ nobase_dist_perllib_DATA = \4 Dpkg/Source/Patch.pm \5 Dpkg.pm6 7 -do_perl_subst = sed -e "s:^\#![:space:]*/usr/bin/perl:\#!$(PERL):" \8 +do_perl_subst = sed -e "s:^\#![[:space:]]*/usr/bin/perl:\#!$(PERL):" \9 -e "s:\$$dpkglibdir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$dpkglibdir=\"$(pkglibdir)\":" \10 -e "s:\$$pkgdatadir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$pkgdatadir=\"$(pkgdatadir)\":" \11 -e "s:\$$admindir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$admindir=\"$(admindir)\":" \12 --- scripts/Makefile.in.orig 2010-03-08 21:32:20.000000000 +010013 +++ scripts/Makefile.in 2011-01-03 10:15:50.000000000 +010014 @@ -330,7 +330,7 @@ nobase_dist_perllib_DATA = \15 Dpkg/Source/Patch.pm \16 Dpkg.pm17 18 -do_perl_subst = sed -e "s:^\#![:space:]*/usr/bin/perl:\#!$(PERL):" \19 +do_perl_subst = sed -e "s:^\#![[:space:]]*/usr/bin/perl:\#!$(PERL):" \20 -e "s:\$$dpkglibdir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$dpkglibdir=\"$(pkglibdir)\":" \21 -e "s:\$$pkgdatadir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$pkgdatadir=\"$(pkgdatadir)\":" \22 -e "s:\$$admindir[[:space:]]*=[[:space:]]*['\"][^'\"]*['\"]:\$$admindir=\"$(admindir)\":" \ -
new file files/patch-scripts_Dpkg_Source_Archive.pm.diff
diff --git a/files/patch-scripts_Dpkg_Source_Archive.pm.diff b/files/patch-scripts_Dpkg_Source_Archive.pm.diff new file mode 100644 index 0000000..a844816
- + 1 --- scripts/Dpkg/Source/Archive.pm.orig 2015-04-09 14:40:47.000000000 -0700 2 +++ scripts/Dpkg/Source/Archive.pm 2015-04-30 03:12:46.000000000 -0700 3 @@ -48,7 +48,7 @@ 4 $spawn_opts{from_pipe} = \*$self->{tar_input}; 5 # Call tar creation process 6 $spawn_opts{delete_env} = [ 'TAR_OPTIONS' ]; 7 - $spawn_opts{exec} = [ 'tar', '--null', '-T', '-', '--numeric-owner', 8 + $spawn_opts{exec} = [ 'gnutar', '--null', '-T', '-', '--numeric-owner', 9 '--owner', '0', '--group', '0', '--format=gnu', 10 @{$opts{options}}, '-cf', '-' ]; 11 *$self->{pid} = spawn(%spawn_opts); 12 @@ -125,7 +125,7 @@ 13 14 # Call tar extraction process 15 $spawn_opts{delete_env} = [ 'TAR_OPTIONS' ]; 16 - $spawn_opts{exec} = [ 'tar', '--no-same-owner', '--no-same-permissions', 17 + $spawn_opts{exec} = [ 'gnutar', '--no-same-owner', '--no-same-permissions', 18 @{$opts{options}}, '-xf', '-' ]; 19 spawn(%spawn_opts); 20 $self->close(); -
new file files/patch-src_archives.c.diff
diff --git a/files/patch-src_archives.c.diff b/files/patch-src_archives.c.diff new file mode 100644 index 0000000..49527f9
- + 1 --- src/archives.c.orig 2015-04-09 14:40:47.000000000 -0700 2 +++ src/archives.c 2015-04-30 03:04:24.000000000 -0700 3 @@ -772,6 +772,7 @@ 4 { 5 static struct varbuf conffderefn, symlinkfn; 6 const char *usename; 7 + char *s = NULL; 8 struct filenamenode *usenode; 9 10 struct conffile *conff; 11 @@ -834,6 +835,14 @@ 12 13 usenode = namenodetouse(nifd->namenode, tc->pkg, &tc->pkg->available); 14 usename = usenode->name; 15 + if (*usename == '.' && *usename + 1 == '/') { 16 + usename += 1; /* Skip the leading `.' */ 17 + } else if (*usename != '/') { 18 + s = malloc(strlen(usename) + 2); /* 1 for NULL, one for `/' we're going to add */ 19 + strcpy(s + 1, usename); 20 + *s = '/'; 21 + usename = s; 22 + } 23 24 trig_file_activate(usenode, tc->pkg); 25 26 @@ -847,6 +856,10 @@ 27 28 setupfnamevbs(usename); 29 30 + if (s != NULL) { 31 + free(s); 32 + } 33 + 34 statr= lstat(fnamevb.buf,&stab); 35 if (statr) { 36 /* The lstat failed. */ -
new file files/patch-src_remove.c.diff
diff --git a/files/patch-src_remove.c.diff b/files/patch-src_remove.c.diff new file mode 100644 index 0000000..c4534bc
- + 1 --- src/remove.c.orig 2015-04-09 14:40:47.000000000 -0700 2 +++ src/remove.c 2015-04-30 02:54:24.000000000 -0700 3 @@ -344,7 +344,18 @@ 4 push_leftover(&leftover,namenode); 5 continue; 6 } 7 - if (errno != ENOTDIR) ohshite(_("cannot remove `%.250s'"),fnvb.buf); 8 + if (errno != ENOTDIR) { 9 + /* XXX Hack: 10 + * dpkg includes /. in the packing list. 11 + * rmdir("/.") will return EINVAL. dpkg will 12 + * only attempt to remove /. when uninstalling 13 + * the last package on the system, which is why 14 + * Debian has never run into this issue. */ 15 + if (errno == EINVAL && strcmp(fnvb.buf, "/.") == 0) 16 + continue; 17 + else 18 + ohshite(_("cannot remove `%.250s'"),fnvb.buf); 19 + } 20 debug(dbg_eachfiledetail, "removal_bulk unlinking '%s'", fnvb.buf); 21 if (secure_unlink(fnvb.buf)) 22 ohshite(_("unable to securely remove '%.250s'"), fnvb.buf); 23 @@ -437,7 +448,18 @@ 24 push_leftover(&leftover,namenode); 25 continue; 26 } 27 - if (errno != ENOTDIR) ohshite(_("cannot remove `%.250s'"),fnvb.buf); 28 + if (errno != ENOTDIR) { 29 + /* XXX Hack: 30 + * dpkg includes /. in the packing list. 31 + * rmdir("/.") will return EINVAL. dpkg will 32 + * only attempt to remove /. when uninstalling 33 + * the last package on the system, which is why 34 + * Debian has never run into this issue. */ 35 + if (errno == EINVAL && strcmp(fnvb.buf, "/.") == 0) 36 + continue; 37 + else 38 + ohshite(_("cannot remove `%.250s'"),fnvb.buf); 39 + } 40 41 if (lstat(fnvb.buf, &stab) == 0 && S_ISLNK(stab.st_mode)) { 42 debug(dbg_eachfiledetail, "removal_bulk is a symlink to a directory"); -
deleted file files/patch-utils_start-stop-daemon.c
diff --git a/files/patch-utils_start-stop-daemon.c b/files/patch-utils_start-stop-daemon.c deleted file mode 100644 index 608cb53..0000000
+ - 1 --- utils/start-stop-daemon.c.orig Thu Nov 11 12:10:04 20042 +++ utils/start-stop-daemon.c Mon Dec 13 16:02:18 20043 @@ -38,6 +38,8 @@4 # define OSFreeBSD5 #elif defined(__NetBSD__)6 # define OSNetBSD7 +#elif defined(__APPLE__)8 +# define OSDarwin9 #else10 # error Unknown architecture - cannot build start-stop-daemon11 #endif12 @@ -49,7 +51,8 @@13 #include <ps.h>14 #endif15 16 -#if defined(OSOpenBSD) || defined(OSFreeBSD) || defined(OSNetBSD)17 +#if defined(OSOpenBSD) || defined(OSFreeBSD) || defined(OSNetBSD) || defined(OSDarwin)18 +#include <sys/time.h>19 #include <sys/param.h>20 #include <sys/proc.h>21 #include <sys/stat.h>22 @@ -804,7 +807,7 @@23 #if defined(OSLinux) || defined(OShpux)24 if (execname && !pid_is_exec(pid, &exec_stat))25 return;26 -#elif defined(OSHURD) || defined(OSFreeBSD) || defined(OSNetBSD)27 +#elif defined(OSHURD) || defined(OSFreeBSD) || defined(OSNetBSD) || defined(OSDarwin)28 /* Let's try this to see if it works */29 if (execname && !pid_is_cmd(pid, execname))30 return;31 @@ -882,6 +882,7 @@32 }33 #endif /* OSHURD */34 35 +#if defined(OSOpenBSD) || defined(OSFreeBSD) || defined(OSNetBSD)36 #ifdef HAVE_KVM_H37 static int38 pid_is_cmd(pid_t pid, const char *name)39 @@ -974,6 +975,7 @@40 {41 /* Nothing to do */42 }43 +#endif44 #endif /* OSOpenBSD */45 46 #if defined(OShpux)47 @@ -975,6 +954,80 @@48 /* Nothing to do */49 }50 #endif /* OSOpenBSD */51 +52 +#if defined(OSDarwin)53 +#include <sys/sysctl.h>54 +int55 +pid_is_user(pid_t pid, uid_t uid)56 +{57 + int mib[4];58 + size_t size;59 + struct kinfo_proc ki;60 +61 + size = sizeof(ki);62 + mib[0] = CTL_KERN;63 + mib[1] = KERN_PROC;64 + mib[2] = KERN_PROC_PID;65 + mib[3] = pid;66 + if (sysctl(mib, 4, &ki, &size, NULL, 0) < 0)67 + errx(1, "%s", "Failure calling sysctl");68 + return (uid == ki.kp_eproc.e_pcred.p_ruid);69 +}70 +71 +static int72 +pid_is_cmd(pid_t pid, const char *name)73 +{74 + int mib[4];75 + size_t size;76 + struct kinfo_proc ki;77 +78 + size = sizeof(ki);79 + mib[0] = CTL_KERN;80 + mib[1] = KERN_PROC;81 + mib[2] = KERN_PROC_PID;82 + mib[3] = pid;83 + if (sysctl(mib, 4, &ki, &size, NULL, 0) < 0)84 + errx(1, "%s", "Failure calling sysctl");85 + return (!strncmp(name, ki.kp_proc.p_comm, MAXCOMLEN));86 +}87 +88 +static void89 +do_procinit(void)90 +{91 + int mib[3];92 + size_t size;93 + int nprocs, ret, i;94 + struct kinfo_proc *procs = NULL, *newprocs;95 +96 + mib[0] = CTL_KERN;97 + mib[1] = KERN_PROC;98 + mib[2] = KERN_PROC_ALL;99 + ret = sysctl(mib, 3, NULL, &size, NULL, 0);100 + /* Allocate enough memory for entire process table */101 + do {102 + size += size / 10;103 + newprocs = realloc(procs, size);104 + if (newprocs == NULL) {105 + if (procs)106 + free(procs);107 + errx(1, "%s", "Could not reallocate memory");108 + }109 + procs = newprocs;110 + ret = sysctl(mib, 3, procs, &size, NULL, 0);111 + } while (ret >= 0 && errno == ENOMEM);112 +113 + if (ret < 0)114 + errx(1, "%s", "Failure calling sysctl");115 +116 + /* Verify size of proc structure */117 + if (size % sizeof(struct kinfo_proc) != 0)118 + errx(1, "%s", "proc size mismatch, userland out of sync with kernel");119 + nprocs = size / sizeof(struct kinfo_proc);120 + for (i = 0; i < nprocs; i++) {121 + check(procs[i].kp_proc.p_pid);122 + }123 +}124 +#endif /* OSDarwin */125 126 #if defined(OShpux)127 static int -
new file files/patch-utils_start-stop-daemon.c.diff
diff --git a/files/patch-utils_start-stop-daemon.c.diff b/files/patch-utils_start-stop-daemon.c.diff new file mode 100644 index 0000000..9dd4eb5
- + 1 --- utils/start-stop-daemon.c.orig 2015-04-09 14:43:33.000000000 -0700 2 +++ utils/start-stop-daemon.c 2015-04-30 03:09:48.000000000 -0700 3 @@ -41,6 +41,8 @@ 4 # define OSNetBSD 5 #elif defined(__DragonFly__) 6 # define OSDragonFlyBSD 7 +#elif defined(__APPLE__) 8 +# define OSDarwin 9 #else 10 # error Unknown architecture - cannot build start-stop-daemon 11 #endif 12 @@ -1947,6 +1949,78 @@ 13 fatal("unable to start %s", startas); 14 } 15 16 +int 17 +pid_is_user(pid_t pid, uid_t uid) 18 +{ 19 + int mib[4]; 20 + size_t size; 21 + struct kinfo_proc ki; 22 + 23 + size = sizeof(ki); 24 + mib[0] = CTL_KERN; 25 + mib[1] = KERN_PROC; 26 + mib[2] = KERN_PROC_PID; 27 + mib[3] = pid; 28 + if (sysctl(mib, 4, &ki, &size, NULL, 0) < 0) 29 + errx(1, "%s", "Failure calling sysctl"); 30 + return (uid == ki.kp_eproc.e_pcred.p_ruid); 31 +} 32 + 33 +static int 34 +pid_is_cmd(pid_t pid, const char *name) 35 +{ 36 + int mib[4]; 37 + size_t size; 38 + struct kinfo_proc ki; 39 + 40 + size = sizeof(ki); 41 + mib[0] = CTL_KERN; 42 + mib[1] = KERN_PROC; 43 + mib[2] = KERN_PROC_PID; 44 + mib[3] = pid; 45 + if (sysctl(mib, 4, &ki, &size, NULL, 0) < 0) 46 + errx(1, "%s", "Failure calling sysctl"); 47 + return (!strncmp(name, ki.kp_proc.p_comm, MAXCOMLEN)); 48 +} 49 + 50 +static void 51 +do_procinit(void) 52 +{ 53 + int mib[3]; 54 + size_t size; 55 + int nprocs, ret, i; 56 + struct kinfo_proc *procs = NULL, *newprocs; 57 + 58 + mib[0] = CTL_KERN; 59 + mib[1] = KERN_PROC; 60 + mib[2] = KERN_PROC_ALL; 61 + ret = sysctl(mib, 3, NULL, &size, NULL, 0); 62 + /* Allocate enough memory for entire process table */ 63 + do { 64 + size += size / 10; 65 + newprocs = realloc(procs, size); 66 + if (newprocs == NULL) { 67 + if (procs) 68 + free(procs); 69 + errx(1, "%s", "Could not reallocate memory"); 70 + } 71 + procs = newprocs; 72 + ret = sysctl(mib, 3, procs, &size, NULL, 0); 73 + } while (ret >= 0 && errno == ENOMEM); 74 + 75 + if (ret < 0) 76 + errx(1, "%s", "Failure calling sysctl"); 77 + 78 + /* Verify size of proc structure */ 79 + if (size % sizeof(struct kinfo_proc) != 0) 80 + errx(1, "%s", "proc size mismatch, userland out of sync with kernel"); 81 + nprocs = size / sizeof(struct kinfo_proc); 82 + for (i = 0; i < nprocs; i++) { 83 + check(procs[i].kp_proc.p_pid); 84 + } 85 +} 86 +#endif /* OSDarwin */ 87 + 88 static void 89 do_stop(int sig_num, int *n_killed, int *n_notkilled) 90 {