From owner-freebsd-ports-bugs@FreeBSD.ORG Mon Nov 6 17:20:40 2006 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A2BA716A403 for ; Mon, 6 Nov 2006 17:20:40 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id A0D4A43D6A for ; Mon, 6 Nov 2006 17:20:23 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id kA6HKKWW054118 for ; Mon, 6 Nov 2006 17:20:20 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id kA6HKKBR054117; Mon, 6 Nov 2006 17:20:20 GMT (envelope-from gnats) Resent-Date: Mon, 6 Nov 2006 17:20:20 GMT Resent-Message-Id: <200611061720.kA6HKKBR054117@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Frank W. Josellis" Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 763B316A415 for ; Mon, 6 Nov 2006 17:16:12 +0000 (UTC) (envelope-from frank@dynamical-systems.org) Received: from mout2.freenet.de (mout2.freenet.de [194.97.50.155]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5515C43D90 for ; Mon, 6 Nov 2006 17:15:01 +0000 (GMT) (envelope-from frank@dynamical-systems.org) Received: from [194.97.55.242] (helo=mx9.freenet.de) by mout2.freenet.de with esmtpa (Exim 4.62) (envelope-from ) id 1Gh83k-000523-5O for FreeBSD-gnats-submit@freebsd.org; Mon, 06 Nov 2006 18:14:56 +0100 Received: from p508eaa16.dip0.t-ipconnect.de ([80.142.170.22]:59468 helo=pollux.senax.net) by mx9.freenet.de with esmtpsa (ID jr-relay@freenet.de) (TLSv1:AES256-SHA:256) (port 25) (Exim 4.62 #12) id 1Gh83j-0000a3-LA for FreeBSD-gnats-submit@freebsd.org; Mon, 06 Nov 2006 18:14:56 +0100 Received: from pollux.senax.net (localhost.senax.net [127.0.0.1]) by pollux.senax.net (8.13.6/8.13.6) with ESMTP id kA6H7ORE001978; Mon, 6 Nov 2006 18:07:24 +0100 (CET) (envelope-from frank@dynamical-systems.org) Received: (from josellis@localhost) by pollux.senax.net (8.13.6/8.13.6/Submit) id kA6H79oB001976; Mon, 6 Nov 2006 18:07:09 +0100 (CET) (envelope-from frank@dynamical-systems.org) Message-Id: <200611061707.kA6H79oB001976@pollux.senax.net> Date: Mon, 6 Nov 2006 18:07:09 +0100 (CET) From: "Frank W. Josellis" To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/105214: patch: archivers/unmakeself - extraction fails under certain conditions X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Nov 2006 17:20:40 -0000 >Number: 105214 >Category: ports >Synopsis: patch: archivers/unmakeself - extraction fails under certain conditions >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Nov 06 17:20:19 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Frank W. Josellis >Release: FreeBSD 5.5-STABLE i386 >Organization: >Environment: System: FreeBSD pollux.senax.net 5.5-STABLE FreeBSD 5.5-STABLE #11: Fri Oct 27 20:51:49 CEST 2006 root@pollux.senax.net:/usr/obj/usr/src/sys/POLLUX i386 >Description: It appears that the offset calculation is not always correct. The approach fails in an obvious way if the first line of an archive consists entirely of printable characters. Unfortunately, this can indeed happen, an example is the latest GoogleEarthLinux.bin (version 4.0.2414). Please consider the patch below for a different method to determine the offset. >How-To-Repeat: fetch http://dl.google.com/earth/GE4/GoogleEarthLinux.bin unmakeself GoogleEarthLinux.bin >Fix: --- unmakeself.patch begins here --- diff -Nur unmakeself.orig/files/unmakeself.c unmakeself/files/unmakeself.c --- unmakeself.orig/files/unmakeself.c Sun Jun 12 20:17:05 2005 +++ unmakeself/files/unmakeself.c Mon Nov 6 14:36:53 2006 @@ -43,6 +43,8 @@ #include #include +#define BUFSIZE 4096 + static char *self = NULL; /* program name */ static int extract_flags = ARCHIVE_EXTRACT_TIME; /* bsdtar default */ @@ -70,6 +72,36 @@ printf("Copyright (C) 2005 Jean-Yves Lefort\n"); } +static int +unmakeself_get_offset (const char *filename) +{ + int offset = -1; + int skip = 0; + char buf[BUFSIZE]; + FILE *stream; + + /* Let the script tell us the number of header lines. */ + snprintf(buf, BUFSIZE, + "sh %s --dumpconf | grep OLDSKIP | cut -f2 -d=", filename); + stream = popen(buf, "r"); + skip = atoi(fgets(buf, BUFSIZE, stream)); + pclose(stream); + + /* Scan the header lines to calculate the offset. */ + if (skip) { + int i; + + stream = fopen(filename, "r"); + for (i = 0; i < skip - 1; i++) { + fgets(buf, BUFSIZE, stream); + offset += strlen(buf); + } + fclose(stream); + offset++; + } + return(offset); +} + static void unmakeself_extract (const char *filename, int print_offset) { @@ -93,6 +125,7 @@ * by locating the first non-printable character following a * newline. The archive starts immediately after that newline. */ + /* while (! done && (len = read(fd, buf, sizeof(buf))) > 0) { int i; @@ -109,7 +142,9 @@ break; } } + */ + offset = unmakeself_get_offset(filename); if (offset != -1) /* offset found */ { if (print_offset) /* only print the offset */ --- unmakeself.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: