summaryrefslogtreecommitdiff
path: root/sysutils
diff options
context:
space:
mode:
authorMatthias Andree <mandree@FreeBSD.org>2011-03-17 00:03:47 +0000
committerMatthias Andree <mandree@FreeBSD.org>2011-03-17 00:03:47 +0000
commit7561b8b1e2a217632ebbb1d0bcc597fa5ae95c98 (patch)
tree759ed4ab887d59f1257951cd704c3167d05e154d /sysutils
parentDocument asterisk multiple vulnerabilities. (diff)
First round of amd64 fixes. Compiles and detects BSD partitions, but
may require work for NTFS, NTFS5, or other partitions. There may be more abuse of "long" on the assumption it were 32 bits, and there may be more endian- ness assumptions lingering in the code. Also bump expiration half a year into the future and fix whitespace to make portlint -C happy. Remove MD5 checksum while at it, and mark MAKE_JOBS_SAFE. I do not claim maintainership for lack of interest, but possibly this is a starting point. Also see the FreeBSD-ports discussion this month, and possibly Debian and/or Fedora have more patches that might be useful.
Notes
Notes: svn path=/head/; revision=271060
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/gpart/Makefile13
-rw-r--r--sysutils/gpart/distinfo1
-rw-r--r--sysutils/gpart/files/patch-ae34
-rw-r--r--sysutils/gpart/files/patch-af96
4 files changed, 137 insertions, 7 deletions
diff --git a/sysutils/gpart/Makefile b/sysutils/gpart/Makefile
index feb00dd458d6..16a1ad13d12a 100644
--- a/sysutils/gpart/Makefile
+++ b/sysutils/gpart/Makefile
@@ -7,7 +7,7 @@
PORTNAME= gpart
PORTVERSION= 0.1h
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= sysutils
MASTER_SITES= ${MASTER_SITE_SUNSITE}
MASTER_SITE_SUBDIR= system/filesystems
@@ -15,21 +15,22 @@ MASTER_SITE_SUBDIR= system/filesystems
MAINTAINER= ports@FreeBSD.org
COMMENT= Tries to recover lost partition tables and file systems
-DEPRECATED= Upstream disapear and distfile is no more available
-EXPIRATION_DATE= 2011-05-01
+DEPRECATED= Upstream disappeared
+EXPIRATION_DATE= 2011-09-15
USE_GMAKE= yes
+MAKE_JOBS_SAFE= yes
MAN8= gpart.8
PLIST_FILES= sbin/gpart
.if defined(WANT_STATIC)
-MAKE_ARGS+= LDFLAGS=-static
+MAKE_ARGS+= LDFLAGS=-static
.endif
.include <bsd.port.pre.mk>
-.if ${ARCH} != "i386" && ${ARCH} != "alpha"
-BROKEN= Does not compile on !i386 and !alpha
+.if ${ARCH} != "i386" && ${ARCH} != "alpha" && ${ARCH} != "amd64"
+BROKEN= Only compiles on i386, amd64 and alpha.
.endif
.include <bsd.port.post.mk>
diff --git a/sysutils/gpart/distinfo b/sysutils/gpart/distinfo
index 60068d505091..b8e12710654c 100644
--- a/sysutils/gpart/distinfo
+++ b/sysutils/gpart/distinfo
@@ -1,3 +1,2 @@
-MD5 (gpart-0.1h.tar.gz) = 23a7620394033e478d0d03c392c405bd
SHA256 (gpart-0.1h.tar.gz) = b542bceb1a778c719304dadae5dbc2a8bd7f195c06774933e7255b98cfa46ee3
SIZE (gpart-0.1h.tar.gz) = 52357
diff --git a/sysutils/gpart/files/patch-ae b/sysutils/gpart/files/patch-ae
new file mode 100644
index 000000000000..c4deb1bcf492
--- /dev/null
+++ b/sysutils/gpart/files/patch-ae
@@ -0,0 +1,34 @@
+--- src/gm_ntfs.h~ 2001-01-29 21:33:58.000000000 +0100
++++ src/gm_ntfs.h 2011-03-16 23:25:34.000000000 +0100
+@@ -29,17 +29,16 @@
+ /* 'NTFS' in little endian */
+ #define NTFS_SUPER_MAGIC 0x5346544E
+
+-#if defined(i386) || defined(__i386__) || defined(__alpha__)
++#include <stdint.h>
+
+ /* unsigned integral types */
+ #ifndef NTFS_INTEGRAL_TYPES
+ #define NTFS_INTEGRAL_TYPES
+-typedef unsigned char ntfs_u8;
+-typedef unsigned short ntfs_u16;
+-typedef unsigned int ntfs_u32;
+-typedef s64_t ntfs_u64;
++typedef uint8_t ntfs_u8;
++typedef uint16_t ntfs_u16;
++typedef uint32_t ntfs_u32;
++typedef uint64_t ntfs_u64;
+ #endif /* NTFS_INTEGRAL_TYPES */
+-#endif /* defined(i386) || defined(__i386__) || defined(__alpha__) */
+
+
+ /* Macros reading unsigned integers from a byte pointer */
+@@ -53,8 +52,5 @@
+ /* Macros reading signed integers, returning int */
+ #define NTFS_GETS8(p) ((int)(*(char*)(p)))
+ #define NTFS_GETS16(p) ((int)(*(short*)(p)))
+-#define NTFS_GETS24(p) (NTFS_GETU24(p) < 0x800000 ? (int)NTFS_GETU24(p) :
+-
+-
+
+ #endif /* _GM_NTFS_H */
diff --git a/sysutils/gpart/files/patch-af b/sysutils/gpart/files/patch-af
new file mode 100644
index 000000000000..9a556af18c2b
--- /dev/null
+++ b/sysutils/gpart/files/patch-af
@@ -0,0 +1,96 @@
+--- src/disku.c 2011-03-17 00:53:37.000000000 +0100
++++ src/disku.c 2011-03-17 00:17:34.000000000 +0100
+@@ -75,25 +75,34 @@
+ #else
+ struct disklabel loclab;
+ u_int u;
++ off_t o; /* total disk size */
+
+ if (ioctl(d->d_fd, DIOCGFWSECTORS, &u) == 0)
+- loclab.d_nsectors = u;
++ g.d_s = u;
+ else
+- loclab.d_nsectors = 63;
++ pr(FATAL, EM_IOCTLFAILED, "DIOCGFWSECTORS", strerror(errno));
++ // loclab.d_nsectors = 63;
+ if (ioctl(d->d_fd, DIOCGFWHEADS, &u) == 0)
+- loclab.d_ntracks = u;
++ g.d_h = u;
++ else
++ pr(FATAL, EM_IOCTLFAILED, "DIOCGFWHEADS", strerror(errno));
++#if 0
+ else if (loclab.d_secperunit <= 63*1*1024)
+ loclab.d_ntracks = 1;
+ else if (loclab.d_secperunit <= 63*16*1024)
+ loclab.d_ntracks = 16;
+ else
+ loclab.d_ntracks = 255;
++#endif
++ if (ioctl(d->d_fd, DIOCGSECTORSIZE, &u) == 0)
++ if (u != 512)
++ pr(FATAL, "sector size not a multiple of 512");
++ if (ioctl(d->d_fd, DIOCGMEDIASIZE, &o))
++ pr(FATAL, EM_IOCTLFAILED, "DIOCGMEDIASIZE", strerror(errno));
+ loclab.d_secpercyl = loclab.d_ntracks * loclab.d_nsectors;
+ loclab.d_ncylinders = loclab.d_secperunit / loclab.d_secpercyl;
+
+- g.d_c = loclab.d_ncylinders;
+- g.d_h = loclab.d_ntracks;
+- g.d_s = loclab.d_nsectors;
++ g.d_c = o / u / g.d_h / g.d_s; // loclab.d_ncylinders;
+ #endif
+ #endif
+
+--- src/gm_bsddl.h 2000-12-13 23:54:31.000000000 +0100
++++ src/gm_bsddl.h 2011-03-17 00:38:12.000000000 +0100
+@@ -28,7 +28,7 @@
+
+ #define BBSIZE 8192 /* size of boot area, with label */
+
+-#ifdef __i386__
++#if defined(__i386__) || defined(__amd64__)
+ #define LABELSECTOR 1 /* sector containing label */
+ #define LABELOFFSET 0 /* offset of label in sector */
+ #endif
+--- src/gpart.h 2001-01-31 00:07:29.000000000 +0100
++++ src/gpart.h 2011-03-17 00:35:27.000000000 +0100
+@@ -22,8 +22,9 @@
+
+ #define PROGRAM "gpart"
+
++#include <stdint.h>
+
+-typedef unsigned char byte_t;
++typedef uint8_t byte_t;
+
+
+
+@@ -31,7 +32,7 @@
+ * endianness (incomplete, later)
+ */
+
+-#if defined(__i386__) || defined(__alpha__)
++#if defined(__i386__) || defined(__amd64__) || defined(__alpha__)
+ # define le16(x) (x) /* x as little endian */
+ # define be16(x) ((((x)&0xff00)>>8) | \
+ (((x)&0x00ff)<<8))
+@@ -112,8 +113,8 @@
+ byte_t p_ehd; /* end head */
+ byte_t p_esect; /* end sector */
+ byte_t p_ecyl; /* end cylinder */
+- unsigned long p_start; /* start sector (absolute) */
+- unsigned long p_size; /* # of sectors */
++ uint32_t p_start; /* start sector (absolute) */
++ uint32_t p_size; /* # of sectors */
+ } dos_part_entry;
+
+
+@@ -123,7 +124,7 @@
+ byte_t _align[2];
+ byte_t t_boot[DOSPARTOFF];
+ dos_part_entry t_parts[NDOSPARTS];
+- unsigned short t_magic; /* DOSPTMAGIC */
++ uint16_t t_magic; /* DOSPTMAGIC */
+ } dos_part_table;
+
+