From f34b30fde9c2a7bfc782b45abd0b832f75c3340e Mon Sep 17 00:00:00 2001 From: Taco Hoekwater Date: Tue, 21 Jun 2011 08:49:17 +0000 Subject: fix runtime TEXMFHOME usage for context mkiv git-svn-id: svn://tug.org/texlive/trunk@23079 c570f23f-e606-0410-a88d-b1316a301751 --- Master/bin/amd64-freebsd/mtxrun | 51 ++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 16 deletions(-) (limited to 'Master/bin/amd64-freebsd') diff --git a/Master/bin/amd64-freebsd/mtxrun b/Master/bin/amd64-freebsd/mtxrun index f90dbfbd7d1..40c61ef000c 100755 --- a/Master/bin/amd64-freebsd/mtxrun +++ b/Master/bin/amd64-freebsd/mtxrun @@ -2829,8 +2829,8 @@ local escaped = (plus / " ") + (percent * C(hexdigit * hexdigit) / tochar) -- we assume schemes with more than 1 character (in order to avoid problems with windows disks) -local scheme = Cs((escaped+(1-colon-slash-qmark-hash))^2) * colon + nothing -local authority = slash * slash * Cs((escaped+(1- slash-qmark-hash))^0) + nothing +local scheme = Cs((escaped+(1-colon-slash-qmark-hash))^2) * colon * slash * slash + nothing +local authority = Cs((escaped+(1- slash-qmark-hash))^0) + nothing local path = slash * Cs((escaped+(1- qmark-hash))^0) + nothing local query = qmark * Cs((escaped+(1- hash))^0) + nothing local fragment = hash * Cs((escaped+(1- endofstring))^0) + nothing @@ -10651,7 +10651,11 @@ local function identify() end elseif not writable and caches.force then local cacheparent = file.dirname(cachepath) - if file.is_writable(cacheparent) then + -- TH: added 'or true' for deeply buried non-existent caches. + -- file.is_writable() is not really important here, since this + -- branch is only checked for as-yet non-existent paths, and + -- it guards against mkdirs() failing, anyway. + if file.is_writable(cacheparent) or true then if not caches.ask or io.ask(format("\nShould I create the cache path %s?",cachepath), "no", { "yes", "no" }) == "yes" then mkdirs(cachepath) if isdir(cachepath) and file.is_writable(cachepath) then @@ -11491,10 +11495,15 @@ local function locate_file_databases() local runtime = stripped == path path = resolvers.cleanpath(path) local spec = resolvers.splitmethod(stripped) - if spec.scheme == "cache" or spec.scheme == "file" then - stripped = spec.path - elseif runtime and (spec.noscheme or spec.scheme == "file") then + -- TH Original did this the other way around (elseif and if tests + -- reversed) but then the else branch was never reached, as 'runtime' + -- would effectively be ignored. In turn, that meant that the wrong + -- locator method was used, such that tree: and file: were treated + -- identically (cached and no runtime search). + if runtime and (spec.noscheme or spec.scheme == "file") then stripped = "tree:///" .. stripped + elseif spec.scheme == "cache" or spec.scheme == "file" then + stripped = spec.path end if trace_locating then if runtime then @@ -12127,22 +12136,31 @@ local function collect_instance_files(filename,askedformat,allresults) -- todo : end if not done and doscan then -- check if on disk / unchecked / does not work at all / also zips + -- TH perhaps it did not work because of missing resolvers.resolve() + -- and resolvers.scanfiles() calls ... + pathname = resolvers.resolve(pathname) local scheme = url.hasscheme(pathname) if not scheme or scheme == "file" then local pname = gsub(pathname,"%.%*$",'') if not find(pname,"%*") then local ppname = gsub(pname,"/+$","") if can_be_dir(ppname) then - for k=1,#wantedfiles do - local w = wantedfiles[k] - local fname = filejoin(ppname,w) - if isreadable(fname) then - if trace_detail then - report_resolving("found '%s' by scanning",fname) + local files = resolvers.scanfiles(ppname) + if files then + for k=1,#wantedfiles do + local w = wantedfiles[k] + local subpath = files[w] + if subpath then + local fname = filejoin(ppname,subpath,w) + if isreadable(fname) then + if trace_detail then + report_resolving("found '%s' by scanning",fname) + end + result[#result+1] = fname + done = true + if not allresults then break end + end end - result[#result+1] = fname - done = true - if not allresults then break end end end else @@ -13400,7 +13418,8 @@ function resolvers.finders.tree(specification) end function resolvers.locators.tree(specification) - local name = specification.filename + -- TH: resolvers.resolve() call was missing here + local name = resolvers.resolve(specification.filename) if name ~= '' and lfs.isdir(name) then if trace_locating then report_trees("locator '%s' found",name) -- cgit v1.2.3