From 4e97804fc1b8b47667ec1d8b8f3c473d31c8bb29 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Thu, 28 Mar 2019 23:39:53 -0300 Subject: tar: do not attempt to create directory more than once --- src/luarocks/tools/tar.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/luarocks/tools/tar.lua b/src/luarocks/tools/tar.lua index 7828c517..a6a95252 100644 --- a/src/luarocks/tools/tar.lua +++ b/src/luarocks/tools/tar.lua @@ -4,7 +4,7 @@ local tar = {} local fs = require("luarocks.fs") local dir = require("luarocks.dir") -local util = require("luarocks.util") +local fun = require("luarocks.fun") local blocksize = 512 @@ -96,6 +96,7 @@ function tar.untar(filename, destdir) local long_name, long_link_name local ok, err + local make_dir = fun.memoize(fs.make_dir) while true do local block repeat @@ -132,14 +133,14 @@ function tar.untar(filename, destdir) local pathname = dir.path(destdir, header.name) pathname = fs.absolute_name(pathname) if header.typeflag == "directory" then - ok, err = fs.make_dir(pathname) + ok, err = make_dir(pathname) if not ok then break end elseif header.typeflag == "file" then local dirname = dir.dir_name(pathname) if dirname ~= "" then - ok, err = fs.make_dir(dirname) + ok, err = make_dir(dirname) if not ok then break end -- cgit v1.2.3-55-g6feb