Paste number 152043: Dealing with tar bombs

Paste number 152043: Dealing with tar bombs
Pasted by: civodul
When:4 years, 10 months ago
Share:Tweet this! | http://paste.lisp.org/+39BF
Channel:None
Paste contents:
Raw Source | XML | Display As
(use-modules (guix download)
             (guix monads)
             (guix gexp))

(define* (broken-tarball-fetch url hash-algo hash
                               #:optional name
                               #:key (system (%current-system))
                               (guile (default-guile)))
  (mlet %store-monad ((drv (url-fetch url hash-algo hash
                                      (string-append "tarbomb-" name)
                                      #:system system
                                      #:guile guile)))
    ;; Take the tar bomb, and simply unpack it as a directory.
    (gexp->derivation name
                      #~(begin
                          (mkdir #$output)
                          (setenv "PATH"
                                  (string-append #$gzip "/bin"))
                          (chdir #$output)
                          (zero? (system* (string-append #$tar "/bin/tar")
                                          "xf" #$drv))))))

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.