From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: Writing recipe for Crypto++, and getting build errors Date: Mon, 26 Sep 2016 18:30:11 +0900 Message-ID: <87h993nh3w.fsf@gnu.org> References: <1474471440.5872.41.camel@adfeno-VPCEG17FB> <4a5b1e1e-9889-0859-8d4d-7524212f10ec@uq.edu.au> <1474555752.3435.6.camel@adfeno-VPCEG17FB> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50436) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boYAW-00039T-Ik for guix-devel@gnu.org; Mon, 26 Sep 2016 11:50:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1boYAU-0004nW-GU for guix-devel@gnu.org; Mon, 26 Sep 2016 11:50:11 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:3726) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1boYAU-0004ba-8U for guix-devel@gnu.org; Mon, 26 Sep 2016 11:50:10 -0400 In-Reply-To: <1474555752.3435.6.camel@adfeno-VPCEG17FB> (Adonay Felipe Nogueira's message of "Thu, 22 Sep 2016 11:49:12 -0300") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Adonay Felipe Nogueira Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello! Adonay Felipe Nogueira skribis: > Archive: /gnu/store/52v106n4y88myk2c8nykymfidq6080ws-cryptopp-5.6.4.zip > inflating: 3way.cpp=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 > inflating: 3way.h=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 [...] > ?: 0 [chdir "3way.cpp"] > > ERROR: In procedure chdir: > ERROR: In procedure chdir: Not a directory The problem here is that this .zip file is a =E2=80=9Ctar bomb=E2=80=9D, me= aning that it unpacks everything in the current directory, which the apply-snippet logic isn=E2=80=99t prepared to deal with. The way we=E2=80=99ve addressed it in the past is by using the =E2=80=98url-fetch/tarbomb=E2=80=99 procedure defined in (guix download). = That method is currently limited to tarballs, so we=E2=80=99d need a variant that deals= with zip files (see patch below). If =E2=80=98url-fetch/zipbomb=E2=80=99 from the patch below works for you, = I=E2=80=99ll apply it. Thanks! Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/guix/download.scm b/guix/download.scm index 649e96b..7f82ff2 100644 --- a/guix/download.scm +++ b/guix/download.scm @@ -35,6 +35,7 @@ #:export (%mirrors url-fetch url-fetch/tarbomb + url-fetch/zipbomb download-to-store)) ;;; Commentary: @@ -427,6 +428,28 @@ own. This helper makes it easier to deal with \"tar bombs\"." "xf" #$drv))) #:local-build? #t))) +(define* (url-fetch/zipbomb url hash-algo hash + #:optional name + #:key (system (%current-system)) + (guile (default-guile))) + "Similar to 'url-fetch' but unpack the zip file at URL in a directory of its +own. This helper makes it easier to deal with \"zip bombs\"." + (define unzip + (module-ref (resolve-interface '(gnu packages zip)) 'unzip)) + + (mlet %store-monad ((drv (url-fetch url hash-algo hash + (string-append "tarbomb-" name) + #:system system + #:guile guile))) + ;; Take the zip bomb, and simply unpack it as a directory. + (gexp->derivation name + #~(begin + (mkdir #$output) + (chdir #$output) + (zero? (system* (string-append #$unzip "/bin/unzip") + #$drv))) + #:local-build? #t))) + (define* (download-to-store store url #:optional (name (basename url)) #:key (log (current-error-port)) recursive?) "Download from URL to STORE, either under NAME or URL's basename if --=-=-=--