summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaco Hoekwater <taco@elvenkind.com>2011-06-21 08:49:17 +0000
committerTaco Hoekwater <taco@elvenkind.com>2011-06-21 08:49:17 +0000
commitf34b30fde9c2a7bfc782b45abd0b832f75c3340e (patch)
treeb596f407a276f469d9fbf14434d9ea2086c4e275
parent6ddb3f0f328099c18073ba7c1a9567c4dc53e948 (diff)
fix runtime TEXMFHOME usage for context mkiv
git-svn-id: svn://tug.org/texlive/trunk@23079 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xBuild/source/texk/texlive/context/mtxrun51
-rwxr-xr-xMaster/bin/alpha-linux/mtxrun51
-rwxr-xr-xMaster/bin/amd64-freebsd/mtxrun51
-rwxr-xr-xMaster/bin/amd64-kfreebsd/mtxrun51
-rwxr-xr-xMaster/bin/i386-cygwin/mtxrun51
-rwxr-xr-xMaster/bin/i386-freebsd/mtxrun51
-rwxr-xr-xMaster/bin/i386-kfreebsd/mtxrun51
-rwxr-xr-xMaster/bin/i386-linux/mtxrun51
-rwxr-xr-xMaster/bin/i386-netbsd/mtxrun51
-rwxr-xr-xMaster/bin/i386-solaris/mtxrun51
-rwxr-xr-xMaster/bin/mips-irix/mtxrun51
-rwxr-xr-xMaster/bin/powerpc-aix/mtxrun51
-rwxr-xr-xMaster/bin/powerpc-linux/mtxrun51
-rwxr-xr-xMaster/bin/sparc-linux/mtxrun51
-rwxr-xr-xMaster/bin/sparc-solaris/mtxrun51
-rwxr-xr-xMaster/bin/universal-darwin/mtxrun51
-rwxr-xr-xMaster/bin/win32/mtxrun.lua51
-rwxr-xr-xMaster/bin/x86_64-darwin/mtxrun51
-rwxr-xr-xMaster/bin/x86_64-linux/mtxrun51
-rwxr-xr-xMaster/bin/x86_64-solaris/mtxrun51
-rwxr-xr-xMaster/texmf-dist/scripts/context/lua/mtxrun.lua51
-rwxr-xr-xMaster/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua51
-rwxr-xr-xMaster/texmf-dist/scripts/context/stubs/unix/mtxrun51
-rw-r--r--Master/texmf-dist/tex/context/base/data-res.lua38
-rw-r--r--Master/texmf-dist/tex/context/base/data-tmp.lua6
-rw-r--r--Master/texmf-dist/tex/context/base/data-tre.lua3
-rw-r--r--Master/texmf-dist/tex/context/base/l-url.lua4
27 files changed, 840 insertions, 384 deletions
diff --git a/Build/source/texk/texlive/context/mtxrun b/Build/source/texk/texlive/context/mtxrun
index f90dbfbd7d1..40c61ef000c 100755
--- a/Build/source/texk/texlive/context/mtxrun
+++ b/Build/source/texk/texlive/context/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)
diff --git a/Master/bin/alpha-linux/mtxrun b/Master/bin/alpha-linux/mtxrun
index f90dbfbd7d1..40c61ef000c 100755
--- a/Master/bin/alpha-linux/mtxrun
+++ b/Master/bin/alpha-linux/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)
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)
diff --git a/Master/bin/amd64-kfreebsd/mtxrun b/Master/bin/amd64-kfreebsd/mtxrun
index f90dbfbd7d1..40c61ef000c 100755
--- a/Master/bin/amd64-kfreebsd/mtxrun
+++ b/Master/bin/amd64-kfreebsd/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)
diff --git a/Master/bin/i386-cygwin/mtxrun b/Master/bin/i386-cygwin/mtxrun
index f90dbfbd7d1..40c61ef000c 100755
--- a/Master/bin/i386-cygwin/mtxrun
+++ b/Master/bin/i386-cygwin/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)
diff --git a/Master/bin/i386-freebsd/mtxrun b/Master/bin/i386-freebsd/mtxrun
index f90dbfbd7d1..40c61ef000c 100755
--- a/Master/bin/i386-freebsd/mtxrun
+++ b/Master/bin/i386-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)
diff --git a/Master/bin/i386-kfreebsd/mtxrun b/Master/bin/i386-kfreebsd/mtxrun
index f90dbfbd7d1..40c61ef000c 100755
--- a/Master/bin/i386-kfreebsd/mtxrun
+++ b/Master/bin/i386-kfreebsd/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)
diff --git a/Master/bin/i386-linux/mtxrun b/Master/bin/i386-linux/mtxrun
index f90dbfbd7d1..40c61ef000c 100755
--- a/Master/bin/i386-linux/mtxrun
+++ b/Master/bin/i386-linux/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)
diff --git a/Master/bin/i386-netbsd/mtxrun b/Master/bin/i386-netbsd/mtxrun
index f90dbfbd7d1..40c61ef000c 100755
--- a/Master/bin/i386-netbsd/mtxrun
+++ b/Master/bin/i386-netbsd/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)
diff --git a/Master/bin/i386-solaris/mtxrun b/Master/bin/i386-solaris/mtxrun
index f90dbfbd7d1..40c61ef000c 100755
--- a/Master/bin/i386-solaris/mtxrun
+++ b/Master/bin/i386-solaris/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)
diff --git a/Master/bin/mips-irix/mtxrun b/Master/bin/mips-irix/mtxrun
index f90dbfbd7d1..40c61ef000c 100755
--- a/Master/bin/mips-irix/mtxrun
+++ b/Master/bin/mips-irix/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)
diff --git a/Master/bin/powerpc-aix/mtxrun b/Master/bin/powerpc-aix/mtxrun
index f90dbfbd7d1..40c61ef000c 100755
--- a/Master/bin/powerpc-aix/mtxrun
+++ b/Master/bin/powerpc-aix/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)
diff --git a/Master/bin/powerpc-linux/mtxrun b/Master/bin/powerpc-linux/mtxrun
index f90dbfbd7d1..40c61ef000c 100755
--- a/Master/bin/powerpc-linux/mtxrun
+++ b/Master/bin/powerpc-linux/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)
diff --git a/Master/bin/sparc-linux/mtxrun b/Master/bin/sparc-linux/mtxrun
index f90dbfbd7d1..40c61ef000c 100755
--- a/Master/bin/sparc-linux/mtxrun
+++ b/Master/bin/sparc-linux/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)
diff --git a/Master/bin/sparc-solaris/mtxrun b/Master/bin/sparc-solaris/mtxrun
index f90dbfbd7d1..40c61ef000c 100755
--- a/Master/bin/sparc-solaris/mtxrun
+++ b/Master/bin/sparc-solaris/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)
diff --git a/Master/bin/universal-darwin/mtxrun b/Master/bin/universal-darwin/mtxrun
index f90dbfbd7d1..40c61ef000c 100755
--- a/Master/bin/universal-darwin/mtxrun
+++ b/Master/bin/universal-darwin/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)
diff --git a/Master/bin/win32/mtxrun.lua b/Master/bin/win32/mtxrun.lua
index f90dbfbd7d1..40c61ef000c 100755
--- a/Master/bin/win32/mtxrun.lua
+++ b/Master/bin/win32/mtxrun.lua
@@ -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)
diff --git a/Master/bin/x86_64-darwin/mtxrun b/Master/bin/x86_64-darwin/mtxrun
index f90dbfbd7d1..40c61ef000c 100755
--- a/Master/bin/x86_64-darwin/mtxrun
+++ b/Master/bin/x86_64-darwin/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)
diff --git a/Master/bin/x86_64-linux/mtxrun b/Master/bin/x86_64-linux/mtxrun
index f90dbfbd7d1..40c61ef000c 100755
--- a/Master/bin/x86_64-linux/mtxrun
+++ b/Master/bin/x86_64-linux/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)
diff --git a/Master/bin/x86_64-solaris/mtxrun b/Master/bin/x86_64-solaris/mtxrun
index f90dbfbd7d1..40c61ef000c 100755
--- a/Master/bin/x86_64-solaris/mtxrun
+++ b/Master/bin/x86_64-solaris/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)
diff --git a/Master/texmf-dist/scripts/context/lua/mtxrun.lua b/Master/texmf-dist/scripts/context/lua/mtxrun.lua
index f90dbfbd7d1..40c61ef000c 100755
--- a/Master/texmf-dist/scripts/context/lua/mtxrun.lua
+++ b/Master/texmf-dist/scripts/context/lua/mtxrun.lua
@@ -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)
diff --git a/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua b/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua
index f90dbfbd7d1..40c61ef000c 100755
--- a/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua
+++ b/Master/texmf-dist/scripts/context/stubs/mswin/mtxrun.lua
@@ -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)
diff --git a/Master/texmf-dist/scripts/context/stubs/unix/mtxrun b/Master/texmf-dist/scripts/context/stubs/unix/mtxrun
index f90dbfbd7d1..40c61ef000c 100755
--- a/Master/texmf-dist/scripts/context/stubs/unix/mtxrun
+++ b/Master/texmf-dist/scripts/context/stubs/unix/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)
diff --git a/Master/texmf-dist/tex/context/base/data-res.lua b/Master/texmf-dist/tex/context/base/data-res.lua
index c3bb5bd48ab..33b1fe65274 100644
--- a/Master/texmf-dist/tex/context/base/data-res.lua
+++ b/Master/texmf-dist/tex/context/base/data-res.lua
@@ -411,10 +411,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
@@ -1047,22 +1052,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
diff --git a/Master/texmf-dist/tex/context/base/data-tmp.lua b/Master/texmf-dist/tex/context/base/data-tmp.lua
index ec6f91e24da..46c9b306283 100644
--- a/Master/texmf-dist/tex/context/base/data-tmp.lua
+++ b/Master/texmf-dist/tex/context/base/data-tmp.lua
@@ -85,7 +85,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
diff --git a/Master/texmf-dist/tex/context/base/data-tre.lua b/Master/texmf-dist/tex/context/base/data-tre.lua
index 88bf4f11275..8b72f046bfc 100644
--- a/Master/texmf-dist/tex/context/base/data-tre.lua
+++ b/Master/texmf-dist/tex/context/base/data-tre.lua
@@ -47,7 +47,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)
diff --git a/Master/texmf-dist/tex/context/base/l-url.lua b/Master/texmf-dist/tex/context/base/l-url.lua
index d75135a2abe..ffd0ac5b54e 100644
--- a/Master/texmf-dist/tex/context/base/l-url.lua
+++ b/Master/texmf-dist/tex/context/base/l-url.lua
@@ -46,8 +46,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