--- chrpath-0.14.orig/protos.h +++ chrpath-0.14/protos.h @@ -33,15 +33,20 @@ int is_e32(void); int swap_bytes(void); +#define DO_SWAPU16(x) ( !swap_bytes() ? x : (uint16_t)bswap_16(x) ) #define DO_SWAPU32(x) ( !swap_bytes() ? x : (uint32_t)bswap_32(x) ) #define DO_SWAPU64(x) ( !swap_bytes() ? x : (uint64_t)bswap_64(x) ) +#define DO_SWAPS16(x) ( !swap_bytes() ? x : (int16_t)bswap_16(x) ) #define DO_SWAPS32(x) ( !swap_bytes() ? x : (int32_t)bswap_32(x) ) #define DO_SWAPS64(x) ( !swap_bytes() ? x : (int64_t)bswap_64(x) ) -#define EHDRS(x) (is_e32() ? DO_SWAPS32(ehdr.e32.x) : DO_SWAPS64(ehdr.e64.x)) -#define EHDRU(x) (is_e32() ? DO_SWAPU32(ehdr.e32.x) : DO_SWAPU64(ehdr.e64.x)) +#define EHDRWS(x) (is_e32() ? DO_SWAPS32(ehdr.e32.x) : DO_SWAPS64(ehdr.e64.x)) +#define EHDRHS(x) (is_e32() ? DO_SWAPS16(ehdr.e32.x) : DO_SWAPS16(ehdr.e64.x)) +#define EHDRWU(x) (is_e32() ? DO_SWAPU32(ehdr.e32.x) : DO_SWAPU64(ehdr.e64.x)) +#define EHDRHU(x) (is_e32() ? DO_SWAPU16(ehdr.e32.x) : DO_SWAPU16(ehdr.e64.x)) #define PHDR(x) (is_e32() ? DO_SWAPU32(phdr.e32.x) : DO_SWAPU64(phdr.e64.x)) -#define SHDR(x) (is_e32() ? DO_SWAPU32(shdr.e32.x) : DO_SWAPU64(shdr.e64.x)) +#define SHDR_W(x) (is_e32() ? DO_SWAPU32(shdr.e32.x) : DO_SWAPU32(shdr.e64.x)) +#define SHDR_O(x) (is_e32() ? DO_SWAPU32(shdr.e32.x) : DO_SWAPU64(shdr.e64.x)) #define DYNSU(i,x) (is_e32() ? DO_SWAPU32(((Elf32_Dyn *)dyns)[i].x) \ : DO_SWAPU64(((Elf64_Dyn *)dyns)[i].x)) #define DYNSS(i,x) (is_e32() ? DO_SWAPS32(((Elf32_Dyn *)dyns)[i].x) \ --- chrpath-0.14.orig/chrpath.c +++ chrpath-0.14/chrpath.c @@ -124,14 +124,14 @@ return 2; } - if (lseek(fd, EHDRU(e_shoff), SEEK_SET) == -1) + if (lseek(fd, EHDRWU(e_shoff), SEEK_SET) == -1) { perror ("positioning for sections"); free(dyns); return 1; } - for (i = 0; i < EHDRS(e_shnum); i++) + for (i = 0; i < EHDRHU(e_shnum); i++) { const size_t sz_shdr = is_e32() ? sizeof(Elf32_Shdr) : sizeof(Elf64_Shdr); if (read(fd, &shdr, sz_shdr) != (ssize_t)sz_shdr) @@ -140,32 +140,32 @@ free(dyns); return 1; } - if (SHDR(sh_type) == SHT_STRTAB) + if (SHDR_W(sh_type) == SHT_STRTAB) break; } - if (i == EHDRS(e_shnum)) + if (i == EHDRHU(e_shnum)) { fprintf (stderr, "No string table found.\n"); free(dyns); return 2; } - strtab = (char *)malloc(SHDR(sh_size)); + strtab = (char *)malloc(SHDR_O(sh_size)); if (strtab == NULL) { perror ("allocating memory for string table"); free(dyns); return 1; } - memset(strtab, 0, SHDR(sh_size)); + memset(strtab, 0, SHDR_O(sh_size)); - if (lseek(fd, SHDR(sh_offset), SEEK_SET) == -1) + if (lseek(fd, SHDR_O(sh_offset), SEEK_SET) == -1) { perror ("positioning for string table"); free(strtab); free(dyns); return 1; } - if (read(fd, strtab, SHDR(sh_size)) != (int)SHDR(sh_size)) + if (read(fd, strtab, SHDR_O(sh_size)) != (int)SHDR_O(sh_size)) { perror ("reading string table"); free(strtab); @@ -173,7 +173,7 @@ return 1; } - if ((int)SHDR(sh_size) < rpathoff) + if ((int)SHDR_O(sh_size) < rpathoff) { fprintf(stderr, "%s string offset not contained in string table", elf_tagname(DYNSS(rpath_dyns_index, d_tag))); @@ -218,7 +218,7 @@ * Calculate the maximum rpath length (will be equal to rpathlen unless * we have previously truncated it). */ - for ( i = rpathoff + rpathlen ; (i < (int)SHDR(sh_size) + for ( i = rpathoff + rpathlen ; (i < (int)SHDR_O(sh_size) && strtab[i] == '\0') ; i++ ) ; i--; @@ -238,7 +238,7 @@ memset(rpath, 0, rpathlen); strcpy(rpath, newpath); - if (lseek(fd, SHDR(sh_offset)+rpathoff, SEEK_SET) == -1) + if (lseek(fd, SHDR_O(sh_offset)+rpathoff, SEEK_SET) == -1) { perror ("positioning for RPATH"); free(dyns); --- chrpath-0.14.orig/elf.c +++ chrpath-0.14/elf.c @@ -16,10 +16,13 @@ #include #include "protos.h" -#define EHDR_PS(x) (is_e32() ? DO_SWAPS32(ehdr->e32.x) : DO_SWAPS64(ehdr->e64.x)) -#define PHDR_PS(x) (is_e32() ? DO_SWAPS32(phdr->e32.x) : DO_SWAPS64(phdr->e64.x)) -#define EHDR_PU(x) (is_e32() ? DO_SWAPU32(ehdr->e32.x) : DO_SWAPU64(ehdr->e64.x)) -#define PHDR_PU(x) (is_e32() ? DO_SWAPU32(phdr->e32.x) : DO_SWAPU64(phdr->e64.x)) +#define EHDR_PWS(x) (is_e32() ? DO_SWAPS32(ehdr->e32.x) : DO_SWAPS64(ehdr->e64.x)) +#define EHDR_PHS(x) (is_e32() ? DO_SWAPS16(ehdr->e32.x) : DO_SWAPS16(ehdr->e64.x)) +#define PHDR_PWS(x) (is_e32() ? DO_SWAPS32(phdr->e32.x) : DO_SWAPS64(phdr->e64.x)) +#define EHDR_PWU(x) (is_e32() ? DO_SWAPU32(ehdr->e32.x) : DO_SWAPU64(ehdr->e64.x)) +#define EHDR_PHU(x) (is_e32() ? DO_SWAPU16(ehdr->e32.x) : DO_SWAPU16(ehdr->e64.x)) +#define PHDR_PWU(x) (is_e32() ? DO_SWAPU32(phdr->e32.x) : DO_SWAPU32(phdr->e64.x)) +#define PHDR_POU(x) (is_e32() ? DO_SWAPU32(phdr->e32.x) : DO_SWAPU64(phdr->e64.x)) static int is_e32_flag; static int swap_bytes_flag; @@ -83,10 +86,10 @@ } sz_phdr = is_e32() ? sizeof(Elf32_Phdr) : sizeof(Elf64_Phdr); - if (EHDR_PS(e_phentsize) != sz_phdr) + if (EHDR_PHS(e_phentsize) != sz_phdr) { fprintf(stderr, "section size was read as %d, not %d!\n", - (int)EHDR_PS(e_phentsize), (int)sz_phdr); + (int)EHDR_PHS(e_phentsize), (int)sz_phdr); close(fd); return -1; } @@ -97,13 +100,13 @@ elf_find_dynamic_section(int fd, Elf_Ehdr *ehdr, Elf_Phdr *phdr) { int i; - if (lseek(fd, EHDR_PU(e_phoff), SEEK_SET) == -1) + if (lseek(fd, EHDR_PWU(e_phoff), SEEK_SET) == -1) { perror ("positioning for sections"); return 1; } - for (i = 0; i < EHDR_PS(e_phnum); i++) + for (i = 0; i < EHDR_PHS(e_phnum); i++) { const size_t sz_phdr = is_e32() ? sizeof(Elf32_Phdr) : sizeof(Elf64_Phdr); if (read(fd, phdr, sz_phdr) != (ssize_t)sz_phdr) @@ -111,16 +114,16 @@ perror ("reading section header"); return 1; } - if (PHDR_PU(p_type) == PT_DYNAMIC) + if (PHDR_PWU(p_type) == PT_DYNAMIC) break; } - if (i == EHDR_PS(e_phnum)) + if (i == EHDR_PHS(e_phnum)) { fprintf (stderr, "No dynamic section found.\n"); return 2; } - if (0 == PHDR_PU(p_filesz)) + if (0 == PHDR_POU(p_filesz)) { fprintf (stderr, "Length of dynamic section is zero.\n"); return 3; --- chrpath-0.14.orig/debian/changelog +++ chrpath-0.14/debian/changelog @@ -0,0 +1,134 @@ +chrpath (0.14-3ubuntu1) trusty; urgency=low + + * Add byteswap fix (Jeremy Kerr). + + -- Matthias Klose Mon, 18 Nov 2013 11:10:24 +0100 + +chrpath (0.14-3) unstable; urgency=low + + * Fix syntax error (Close → Closes) in 0.14-1 changelog entry. + * Add --with autotools_dev to dh call. Thanks to Colin Watson for the + patch. Closes: #700117 + * Update Standards-Version. No changes needed. + + -- Tollef Fog Heen Mon, 28 Oct 2013 10:52:04 +0100 + +chrpath (0.14-2) unstable; urgency=low + + * Upload to unstable. + + -- Tollef Fog Heen Thu, 11 Jul 2013 14:37:09 +0200 + +chrpath (0.14-1) experimental; urgency=low + + * Upload targeted at experimental, since wheezy is frozen. + * New upstream release. Closes: #578502 + * Drop ChangeLog.usermap from docs. + * Update to dh packaging and update compat level to 9. + * Mark the package as Multi-Arch: foreign + * Add watch file, thanks to Wookey for patch. + * Update upstream URL in copyright file. + * Update to current Standards-Version. + * Fix up copyright file somewhat. + * Add ${misc:Depends} to Depends line. + * Drop docs file and remove doubly-installed changelog. + * Drop INSTALL file. + + -- Tollef Fog Heen Thu, 15 Nov 2012 18:39:00 +0100 + +chrpath (0.13-2) unstable; urgency=low + + * Update config.{guess,sub}. (closes: #342383) + + -- Tollef Fog Heen Mon, 12 Jun 2006 13:36:38 +0200 + +chrpath (0.13-1) unstable; urgency=low + + * New upstream release + * Rerun aclocal, automake, autoconf since upstream seemingly used broken + versions. + + -- Tollef Fog Heen Tue, 21 Sep 2004 09:37:14 +0200 + +chrpath (0.12-3) unstable; urgency=low + + * Add AM_MAINTAINER_MODE support to configure.ac (closes: #259492) + + -- Tollef Fog Heen Thu, 15 Jul 2004 09:25:52 +0200 + +chrpath (0.12-2) unstable; urgency=low + + * Fix Hurd and k*BSD support (closes: #248084) + * Remove call to dh_undocumented. + + -- Tollef Fog Heen Thu, 10 Jun 2004 02:47:34 +0200 + +chrpath (0.12-1) unstable; urgency=low + + * New upstream release (closes: #211094) + + -- Tollef Fog Heen Tue, 23 Dec 2003 12:38:50 +0100 + +chrpath (0.10-2) unstable; urgency=low + + * Fix description (closes: #179923). + * Make chrpath work well on 64 bit arches. (closes: #197210) + * Make build also run make check + + -- Tollef Fog Heen Tue, 17 Jun 2003 00:18:37 +0200 + +chrpath (0.10-1) unstable; urgency=low + + * New upstream release (closes: #171256) + + -- Tollef Fog Heen Sat, 4 Jan 2003 00:26:41 +0100 + +chrpath (0.9-2) unstable; urgency=low + + * Remove ugliness due to patch applying twice. + * Fix loop introduced i 0.7-2. Thanks to liiwi for noticing this. + + -- Tollef Fog Heen Sat, 23 Nov 2002 21:39:28 +0100 + +chrpath (0.9-1) unstable; urgency=low + + * New upstream release + - Adds support for platforms not having DT_RUNPATH (like NetBSD) + (closes: #167169) + + -- Tollef Fog Heen Sat, 23 Nov 2002 21:25:05 +0100 + +chrpath (0.7-2) unstable; urgency=low + + * Fix segfault when converting rpath to runpath. (closes: #168670) + * Fix --delete weirdness where it wouldn't process the first argument + (closes: #163843) + + -- Tollef Fog Heen Tue, 12 Nov 2002 03:18:07 +0100 + +chrpath (0.7-1) unstable; urgency=low + + * New upstream release + - Adds runpath support (closes: #154611) + - Fixes typo in man page (closes: #154360) + + -- Tollef Fog Heen Fri, 13 Sep 2002 04:38:48 +0200 + +chrpath (0.6-1) unstable; urgency=low + + * New upstream release (with my contributed man page) + + -- Tollef Fog Heen Sun, 5 May 2002 17:35:20 +0200 + +chrpath (0.5-2) unstable; urgency=low + + * add man page. (closes: #137405) + * make non-native package. + + -- Tollef Fog Heen Sat, 4 May 2002 21:22:51 +0200 + +chrpath (0.5-1) unstable; urgency=low + + * Initial Release. + + -- Tollef Fog Heen Thu, 14 Feb 2002 04:03:22 +0100 --- chrpath-0.14.orig/debian/compat +++ chrpath-0.14/debian/compat @@ -0,0 +1 @@ +9 --- chrpath-0.14.orig/debian/copyright +++ chrpath-0.14/debian/copyright @@ -0,0 +1,9 @@ +This package was debianized by Tollef Fog Heen on +Thu, 14 Feb 2002 04:03:22 +0100. + +It was downloaded from https://alioth.debian.org/projects/chrpath/ + +Upstream Author: Petter Reinholdtsen + +chrpath is under the GNU Public License, which can normally +be found in /usr/share/common-licenses/GPL on Debian systems. --- chrpath-0.14.orig/debian/rules +++ chrpath-0.14/debian/rules @@ -0,0 +1,10 @@ +#! /usr/bin/make -f + +%: + dh $@ --with autotools_dev + +override_dh_auto_install: + dh_auto_install -- docdir="/usr/share/doc/chrpath" + rm debian/chrpath/usr/share/doc/chrpath/COPYING + rm debian/chrpath/usr/share/doc/chrpath/ChangeLog + rm debian/chrpath/usr/share/doc/chrpath/INSTALL --- chrpath-0.14.orig/debian/control +++ chrpath-0.14/debian/control @@ -0,0 +1,15 @@ +Source: chrpath +Section: utils +Priority: optional +Maintainer: Tollef Fog Heen +Build-Depends: debhelper (>= 9), autotools-dev +Standards-Version: 3.9.4 + +Package: chrpath +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Multi-Arch: foreign +Description: Tool to edit the rpath in ELF binaries + chrpath allows you to change the rpath (where the application looks + for libraries) in an application. It does not (yet) allow you to + add an rpath if there isn't one already. --- chrpath-0.14.orig/debian/dirs +++ chrpath-0.14/debian/dirs @@ -0,0 +1,2 @@ +usr/bin +usr/share/doc --- chrpath-0.14.orig/debian/watch +++ chrpath-0.14/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://alioth.debian.org/frs/?group_id=31052 .*/chrpath-(.*)\.tar\.gz debian uupdate