From a5f7c3744eb87cbf860ad24683429d5e0a4254ac Mon Sep 17 00:00:00 2001 From: Timothy Gu Date: Mon, 27 Jul 2015 00:17:57 -0400 Subject: file: update and fix downloading Fixes #773. --- src/file-1-fixes.patch | 74 ++++++++++++++++++++++++++++++++++++++++++++++---- src/file.mk | 11 ++++---- 2 files changed, 75 insertions(+), 10 deletions(-) diff --git a/src/file-1-fixes.patch b/src/file-1-fixes.patch index f4f9f97..4f5a137 100644 --- a/src/file-1-fixes.patch +++ b/src/file-1-fixes.patch @@ -1,14 +1,30 @@ This file is part of MXE. See index.html for further information. -Contains ad hoc patches for cross building. +From https://github.com/file/file/commit/d5f2c28536f1645e3da25fa3f8da5a0a45404dc4. -From afe77055b3e244d82cf4dedc82af15524b34d908 Mon Sep 17 00:00:00 2001 -From: MXE -Date: Thu, 18 Jun 2015 22:19:17 -0400 -Subject: [PATCH] {gm,local}time_r: Fix function signature +From 4e654ecfd1ca6535540b7d33dcd66051b9b62def Mon Sep 17 00:00:00 2001 +From: Christos Zoulas +Date: Mon, 27 Jul 2015 00:14:29 -0400 +Subject: [PATCH] PR/466: Windows fixes. +diff --git a/src/file.h b/src/file.h +index 1b4ef6f..00d2abe 100644 +--- a/src/file.h ++++ b/src/file.h +@@ -44,9 +44,11 @@ + #define SIZE_T_FORMAT "" + #endif + #define INT64_T_FORMAT "I64" ++ #define INTMAX_T_FORMAT "I64" + #else + #define SIZE_T_FORMAT "z" + #define INT64_T_FORMAT "ll" ++ #define INTMAX_T_FORMAT "j" + #endif + + #include /* Include that here, to make sure __P gets defined */ diff --git a/src/gmtime_r.c b/src/gmtime_r.c index 963dfee..7e27ed6 100644 --- a/src/gmtime_r.c @@ -35,6 +51,54 @@ index 69d78d9..35c3b40 100644 { struct tm *tmp = localtime(t); if (tmp == NULL) +diff --git a/src/magic.c b/src/magic.c +index bc8c344..59b7e45 100644 +--- a/src/magic.c ++++ b/src/magic.c +@@ -137,6 +137,14 @@ _w32_get_magic_relative_to(char **hmagicpath, HINSTANCE module) + + PathRemoveFileSpecA(dllpath); + ++ if (module) { ++ char exepath[MAX_PATH]; ++ GetModuleFileNameA(NULL, exepath, MAX_PATH); ++ PathRemoveFileSpecA(exepath); ++ if (stricmp(exepath, dllpath) == 0) ++ goto out; ++ } ++ + sp = strlen(dllpath); + if (sp > 3 && stricmp(&dllpath[sp - 3], "bin") == 0) { + _w32_append_path(hmagicpath, +diff --git a/src/readelf.c b/src/readelf.c +index bc6e7f6..ab36d26 100644 +--- a/src/readelf.c ++++ b/src/readelf.c +@@ -1054,9 +1054,11 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, + case SHT_NOTE: + if (xsh_size + xsh_offset > (uintmax_t)fsize) { + if (file_printf(ms, +- ", note offset/size 0x%jx+0x%jx exceeds" +- " file size 0x%jx", (uintmax_t)xsh_offset, +- (uintmax_t)xsh_size, (uintmax_t)fsize) == -1) ++ ", note offset/size 0x%" INTMAX_T_FORMAT ++ "x+0x%" INTMAX_T_FORMAT "x exceeds" ++ " file size 0x%" INTMAX_T_FORMAT "x", ++ (uintmax_t)xsh_offset, (uintmax_t)xsh_size, ++ (uintmax_t)fsize) == -1) + return -1; + return 0; + } +@@ -1065,7 +1067,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, + " for note"); + return -1; + } +- if (pread(fd, nbuf, xsh_size, xsh_offset) < (ssize_t)xsh_size) { ++ if (pread(fd, nbuf, xsh_size, xsh_offset) < ++ (ssize_t)xsh_size) { + file_badread(ms); + free(nbuf); + return -1; -- 1.9.1 diff --git a/src/file.mk b/src/file.mk index 3e2e11e..b53d789 100644 --- a/src/file.mk +++ b/src/file.mk @@ -3,16 +3,17 @@ PKG := file $(PKG)_IGNORE := -$(PKG)_VERSION := 5.23 -$(PKG)_CHECKSUM := c817fb4c27f01934993ece3b013adbdc4deab67e +$(PKG)_VERSION := 5.24 +$(PKG)_CHECKSUM := 152daac79ccb4560dc65d5aaf754196ec1536f1d $(PKG)_SUBDIR := file-$($(PKG)_VERSION) $(PKG)_FILE := file-$($(PKG)_VERSION).tar.gz -$(PKG)_URL := http://ftp.cross-lfs.org/pub/clfs/conglomeration/file/$($(PKG)_FILE) -$(PKG)_URL_2 := ftp://ftp.astron.com/pub/file/$($(PKG)_FILE) +$(PKG)_URL := https://distfiles.macports.org/file/$($(PKG)_FILE) +# astron.com is down +# $(PKG)_URL_2 := ftp://ftp.astron.com/pub/file/$($(PKG)_FILE) $(PKG)_DEPS := gcc libgnurx define $(PKG)_UPDATE - $(WGET) -q -O- 'ftp://ftp.astron.com/pub/file/' | \ + $(WGET) -q -O- 'https://distfiles.macports.org/file/' | \ grep 'file-' | \ $(SED) -n 's,.*file-\([0-9][^>]*\)\.tar.*,\1,p' | \ tail -1 -- cgit v0.12