NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.79k stars 13.9k forks source link

texlive's context program hangs on scanning of `/nix/store` dir #14463

Closed jraygauthier closed 8 years ago

jraygauthier commented 8 years ago

Issue description

Seem to never finish its search. It seems wrong that this tool should search such global location. It is as tough a recursive search from child to parent dir is ongoing. Maybe an environment variable is not set properly? Maybe I should add other packages in my texlive.combine function?

As you can see, everything in context's wrapper seem in order:

#! /nix/store/pnc8xc1dh3cy4migfipfmzy3ad7snz99-bash-4.3-p42/bin/bash -e
export PATH=/nix/store/4kxg8pscnpcikkb8g77injdpwnbivp92-texlive-combined-2015/bin:/nix/store/s5hmy8kv1w151a1z4wy57csla3c11jr9-perl-5.20.3/bin${PATH:+:}$PATH
export TEXMFCNF=/nix/store/4kxg8pscnpcikkb8g77injdpwnbivp92-texlive-combined-2015/share/texmf/web2c
export TEXMFDIST=/nix/store/4kxg8pscnpcikkb8g77injdpwnbivp92-texlive-combined-2015/share/texmf
export TEXMFSYSCONFIG=/nix/store/4kxg8pscnpcikkb8g77injdpwnbivp92-texlive-combined-2015/share/texmf-config
export TEXMFSYSVAR=/nix/store/4kxg8pscnpcikkb8g77injdpwnbivp92-texlive-combined-2015/share/texmf-var
export PERL5LIB=/nix/store/4kxg8pscnpcikkb8g77injdpwnbivp92-texlive-combined-2015/share/texmf/scripts/texlive${PERL5LIB:+:}$PERL5LIB
exec /nix/store/pnc8xc1dh3cy4migfipfmzy3ad7snz99-bash-4.3-p42/bin/sh  /nix/store/ijr41d88sj8bqhd6bbqldwrh83b482qk-texlive-context-2015/scripts/context/stubs/unix/context "${extraFlagsArray[@]}" "$@"

Could reproduce on both stable (02/02/2016, e83aed4c10b05339329f4ca13414c59036563d0e) and unstable (27/03/2016, d88ae1045d37f8cd1b3428617670f7358eb45a29).

Steps to reproduce

The data:

git clone https://github.com/mszep/pandoc_resume
cd pandoc_resume

The env:

nix-shell --pure -E 'with import <nixpkgs> { }; stdenv.mkDerivation {name = "otf"; buildInputs = [pandoc (texlive.combine { inherit (texlive) scheme-small context cm-super; })];}'

First thing out of order:

$ context --version

mtx-context     | ConTeXt Process Management 0.60
mtx-context     |
mtx-context     | main context file: unknown, 'context.mkiv' not found

And now the hanging scan issue:

pandoc --standalone --template style_chmduquesne.tex \
--from markdown --to context \
-V papersize=A4 \
-o resume.tex resume.md; \
context resume.tex

mtx-context     | warning: no format found, forcing remake (commandline driven)
resolvers       | resolving | configuration files already identified
resolvers       | resolving | loading configuration file '/nix/store/snzma9hi59yas7srynwiw8vsw9s8y7ac-texlive-combined-2015/share/texmf/web2c/texmfcnf.lua'
resolvers       | resolving |
resolvers       | resolving | locating list of 'home:.texlive2014/texmf-config' (runtime) (tree:///home:.texlive2014/texmf-config)
resolvers       | methods | resolving, method 'locators', how 'uri', handler 'tree', argument 'tree:///home:.texlive2014/texmf-config'
resolvers       | trees | locator 'home:.texlive2014/texmf-config' not found
resolvers       | resolving | locating list of 'home:texmf' (runtime) (tree:///home:texmf)
resolvers       | methods | resolving, method 'locators', how 'uri', handler 'tree', argument 'tree:///home:texmf'
resolvers       | trees | locator 'home:texmf' not found
resolvers       | resolving | locating list of '/nix/store/snzma9hi59yas7srynwiw8vsw9s8y7ac-texlive-combined-2015/share/texmf-config' (cached)
resolvers       | methods | resolving, method 'locators', how 'uri', handler 'file', argument '/nix/store/snzma9hi59yas7srynwiw8vsw9s8y7ac-texlive-combined-2015/share/texmf-config'
resolvers       | files | file locator '/nix/store/snzma9hi59yas7srynwiw8vsw9s8y7ac-texlive-combined-2015/share/texmf-config' not found
resolvers       | resolving | locating list of '/nix/store/snzma9hi59yas7srynwiw8vsw9s8y7ac-texlive-combined-2015/share/texmf-var' (cached)
resolvers       | methods | resolving, method 'locators', how 'uri', handler 'file', argument '/nix/store/snzma9hi59yas7srynwiw8vsw9s8y7ac-texlive-combined-2015/share/texmf-var'
resolvers       | files | file locator '/nix/store/snzma9hi59yas7srynwiw8vsw9s8y7ac-texlive-combined-2015/share/texmf-var' found as '/nix/store/snzma9hi59yas7srynwiw8vsw9s8y7ac-texlive-combined-2015/share/texmf-var'
resolvers       | resolving | locating list of 'selfautoparent:texmf-project' (cached)
resolvers       | methods | resolving, method 'locators', how 'uri', handler 'file', argument 'selfautoparent:texmf-project'
resolvers       | files | file locator 'selfautoparent:texmf-project' not found
resolvers       | resolving | locating list of 'selfautoparent:texmf-fonts' (cached)
resolvers       | methods | resolving, method 'locators', how 'uri', handler 'file', argument 'selfautoparent:texmf-fonts'
resolvers       | files | file locator 'selfautoparent:texmf-fonts' not found
resolvers       | resolving | locating list of '/nix/store' (cached)
resolvers       | methods | resolving, method 'locators', how 'uri', handler 'file', argument '/nix/store'
resolvers       | files | file locator '/nix/store' found as '/nix/store'
resolvers       | resolving | locating list of '/nix/store/snzma9hi59yas7srynwiw8vsw9s8y7ac-texlive-combined-2015/share/texmf' (cached)
resolvers       | methods | resolving, method 'locators', how 'uri', handler 'file', argument '/nix/store/snzma9hi59yas7srynwiw8vsw9s8y7ac-texlive-combined-2015/share/texmf'
resolvers       | files | file locator '/nix/store/snzma9hi59yas7srynwiw8vsw9s8y7ac-texlive-combined-2015/share/texmf' found as '/nix/store/snzma9hi59yas7srynwiw8vsw9s8y7ac-texlive-combined-2015/share/texmf'
resolvers       | resolving |
resolvers       | methods | resolving, method 'generators', how 'uri', handler 'file', argument '/nix/store/snzma9hi59yas7srynwiw8vsw9s8y7ac-texlive-combined-2015/share/texmf-var'
resolvers       | expansions | scanning path '/nix/store/snzma9hi59yas7srynwiw8vsw9s8y7ac-texlive-combined-2015/share/texmf-var', branch '/nix/store/snzma9hi59yas7srynwiw8vsw9s8y7ac-texlive-combined-2015/share/texmf-var'
resolvers       | expansions | 35 files found on 6 directories with 1 uppercase remappings
resolvers       | methods | resolving, method 'generators', how 'uri', handler 'file', argument '/nix/store'
resolvers       | expansions | scanning path '/nix/store', branch '/nix/store'

Also noticed to following error during the environement build which does not seem to have stopped it:

fmtutil: fmtutil is using the following fmtutil.cnf files (in precedence order):
fmtutil:   /nix/store/wj0wjsm8qywdkb53n1dlwnnng1ayhz01-texlive-combined-2015/share/texmf/web2c/fmtutil.cnf
fmtutil: fmtutil is using the following fmtutil.cnf file for writing changes:
fmtutil:   /nix/store/wj0wjsm8qywdkb53n1dlwnnng1ayhz01-texlive-combined-2015/share/texmf-config/web2c/fmtutil.cnf
fmtutil: running `xetex -ini  -jobname=xetex -progname=xetex -etex xetex.ini' ...
fmtutil [INFO]: /nix/store/wj0wjsm8qywdkb53n1dlwnnng1ayhz01-texlive-combined-2015/share/texmf-var/web2c/xetex/xetex.fmt installed.
fmtutil: running `pdftex -ini  -jobname=pdftex -progname=pdftex -translate-file=cp227.tcx *pdfetex.ini' ...
fmtutil [INFO]: /nix/store/wj0wjsm8qywdkb53n1dlwnnng1ayhz01-texlive-combined-2015/share/texmf-var/web2c/pdftex/pdftex.fmt installed.
fmtutil: running `aleph -ini  -jobname=aleph -progname=aleph *aleph.ini' ...
fmtutil [INFO]: /nix/store/wj0wjsm8qywdkb53n1dlwnnng1ayhz01-texlive-combined-2015/share/texmf-var/web2c/aleph/aleph.fmt installed.
fmtutil: running `tex -ini  -jobname=tex -progname=tex tex.ini' ...
fmtutil [INFO]: /nix/store/wj0wjsm8qywdkb53n1dlwnnng1ayhz01-texlive-combined-2015/share/texmf-var/web2c/tex/tex.fmt installed.
fmtutil: running `luatex -ini  -jobname=luatex -progname=luatex luatex.ini' ...
fmtutil [INFO]: /nix/store/wj0wjsm8qywdkb53n1dlwnnng1ayhz01-texlive-combined-2015/share/texmf-var/web2c/luatex/luatex.fmt installed.
fmtutil: running `pdftex -ini  -jobname=pdfetex -progname=pdfetex -translate-file=cp227.tcx *pdfetex.ini' ...
fmtutil [INFO]: /nix/store/wj0wjsm8qywdkb53n1dlwnnng1ayhz01-texlive-combined-2015/share/texmf-var/web2c/pdftex/pdfetex.fmt installed.
fmtutil: running `pdftex -ini  -jobname=mptopdf -progname=context -translate-file=cp227.tcx mptopdf.tex' ...
fmtutil [INFO]: /nix/store/wj0wjsm8qywdkb53n1dlwnnng1ayhz01-texlive-combined-2015/share/texmf-var/web2c/pdftex/mptopdf.fmt installed.
fmtutil: running `xetex -ini  -jobname=cont-en -progname=context -8bit *cont-en.mkii' ...
fmtutil [INFO]: /nix/store/wj0wjsm8qywdkb53n1dlwnnng1ayhz01-texlive-combined-2015/share/texmf-var/web2c/xetex/cont-en.fmt installed.
fmtutil: running `pdftex -ini  -jobname=cont-en -progname=context -8bit *cont-en.mkii' ...
fmtutil [INFO]: /nix/store/wj0wjsm8qywdkb53n1dlwnnng1ayhz01-texlive-combined-2015/share/texmf-var/web2c/pdftex/cont-en.fmt installed.
fmtutil: running `pdftex -ini  -jobname=etex -progname=etex -translate-file=cp227.tcx *etex.ini' ...
fmtutil [INFO]: /nix/store/wj0wjsm8qywdkb53n1dlwnnng1ayhz01-texlive-combined-2015/share/texmf-var/web2c/pdftex/etex.fmt installed.
fmtutil: running `pdftex -ini  -jobname=mllatex -progname=mllatex -translate-file=cp227.tcx -mltex *mllatex.ini' ...
fmtutil [INFO]: /nix/store/wj0wjsm8qywdkb53n1dlwnnng1ayhz01-texlive-combined-2015/share/texmf-var/web2c/pdftex/mllatex.fmt installed.
fmtutil: running `xetex -ini  -jobname=xelatex -progname=xelatex -etex xelatex.ini' ...
fmtutil [INFO]: /nix/store/wj0wjsm8qywdkb53n1dlwnnng1ayhz01-texlive-combined-2015/share/texmf-var/web2c/xetex/xelatex.fmt installed.
fmtutil: running `luatex -ini  -jobname=lualatex -progname=lualatex lualatex.ini' ...
fmtutil [INFO]: /nix/store/wj0wjsm8qywdkb53n1dlwnnng1ayhz01-texlive-combined-2015/share/texmf-var/web2c/luatex/lualatex.fmt installed.
fmtutil: running `pdftex -ini  -jobname=latex -progname=latex -translate-file=cp227.tcx *latex.ini' ...
fmtutil [INFO]: /nix/store/wj0wjsm8qywdkb53n1dlwnnng1ayhz01-texlive-combined-2015/share/texmf-var/web2c/pdftex/latex.fmt installed.
fmtutil: running `pdftex -ini  -jobname=pdflatex -progname=pdflatex -translate-file=cp227.tcx *pdflatex.ini' ...
fmtutil [INFO]: /nix/store/wj0wjsm8qywdkb53n1dlwnnng1ayhz01-texlive-combined-2015/share/texmf-var/web2c/pdftex/pdflatex.fmt installed.
fmtutil: running `luatex -ini  -jobname=dviluatex -progname=dviluatex dviluatex.ini' ...
fmtutil [INFO]: /nix/store/wj0wjsm8qywdkb53n1dlwnnng1ayhz01-texlive-combined-2015/share/texmf-var/web2c/luatex/dviluatex.fmt installed.
fmtutil: running `luatex -ini  -jobname=dvilualatex -progname=dvilualatex dvifmtutil [WARNING]: inifile euptex.ini for euptex/euptex not found.
fmtutil [WARNING]: inifile eptex.ini for eptex/eptex not found.
fmtutil [WARNING]: inifile ptex.ini for ptex/ptex not found.
fmtutil [WARNING]: inifile uptex.ini for uptex/uptex not found.
fmtutil [ERROR]: not building luajittex due to missing engine luajittex.
fmtutil [WARNING]: inifile cslatex.ini for cslatex/pdftex not found.
fmtutil [WARNING]: inifile utf8mex.ini for utf8mex/pdftex not found.
fmtutil [WARNING]: inifile xmltex.ini for xmltex/pdftex not found.
fmtutil [WARNING]: inifile csplain-utf8.ini for csplain/pdftex not found.
fmtutil [WARNING]: inifile texsis.ini for texsis/pdftex not found.
fmtutil [WARNING]: inifile amstex.ini for amstex/pdftex not found.
fmtutil [WARNING]: inifile mltex.ini for mltex/pdftex not found.
fmtutil [WARNING]: inifile platex.ini for platex/eptex not found.
fmtutil [WARNING]: inifile pdfxmltex.ini for pdfxmltex/pdftex not found.
fmtutil [WARNING]: inifile lambda.ini for lamed/aleph not found.
fmtutil [WARNING]: inifile mf.ini for mf/mf-nowin not found.
fmtutil [WARNING]: inifile cslatex.ini for pdfcslatex/pdftex not found.
fmtutil [WARNING]: inifile csplain.ini for pdfcsplain/luatex not found.
fmtutil [WARNING]: inifile csplain.ini for pdfcsplain/xetex not found.
fmtutil [WARNING]: inifile csplain-utf8.ini for pdfcsplain/pdftex not found.
fmtutil [WARNING]: inifile jadetex.ini for jadetex/pdftex not found.
fmtutil [WARNING]: inifile lollipop.ini for lollipop/pdftex not found.
fmtutil [WARNING]: inifile xelollipop.ini for xelollipop/xetex not found.
fmtutil [WARNING]: inifile pdfjadetex.ini for pdfjadetex/pdftex not found.
fmtutil [WARNING]: inifile mex.ini for mex/pdftex not found.
fmtutil [WARNING]: inifile pdfmex.ini for pdfmex/pdftex not found.
fmtutil [WARNING]: inifile uplatex.ini for uplatex/euptex not found.
fmtutil [WARNING]: inifile eplain.ini for eplain/pdftex not found.
fmtutil [WARNING]: inifile lualollipop.ini for lualollipop/luatex not found.
lualatex.ini' ...
fmtutil [INFO]: /nix/store/wj0wjsm8qywdkb53n1dlwnnng1ayhz01-texlive-combined-2015/share/texmf-var/web2c/luatex/dvilualatex.fmt installed.
fmtutil [INFO]: Disabled formats: 10
fmtutil [INFO]: Successfully rebuild formats: 17

Technical details

jraygauthier commented 8 years ago

A solution to the problem

Looking at both nixpkgs/pkgs/tools/typesetting/tex/texlive-new/combine's wrapping of tex executables:

export PATH="$out/bin:$out/share/texmf/scripts/texlive:${perl}/bin:$PATH"
export TEXMFCNF="$out/share/texmf/web2c"
export TEXMFDIST="$out/share/texmf"
export TEXMFSYSCONFIG="$out/share/texmf-config"
export TEXMFSYSVAR="$out/share/texmf-var"
export PERL5LIB="$out/share/texmf/scripts/texlive"

and at my $out/share (/nix/store/wj0wjsm8qywdkb53n1dlwnnng1ayhz01-texlive-combined-2015/share in my case), for which:

$ ls -la
total 24
dr-xr-xr-x  6 root nixbld 4096 Dec 31  1969 .
dr-xr-xr-x  4 root nixbld 4096 Dec 31  1969 ..
dr-xr-xr-x  2 root nixbld 4096 Dec 31  1969 info
dr-xr-xr-x  2 root nixbld 4096 Dec 31  1969 man
dr-xr-xr-x 13 root nixbld 4096 Dec 31  1969 texmf
dr-xr-xr-x  3 root nixbld 4096 Dec 31  1969 texmf-var

and also at $out/share/texmf/web2c/texmf.cnf's environement variable order of assignment:

TEXMF = {$TEXMFCONFIG,$TEXMFVAR,$TEXMFHOME,!!$TEXMFSYSCONFIG,!!$TEXMFSYSVAR,!!$TEXMFLOCAL,!!$TEXMFDIST}

reveal that the TEXMFCONFIG env var is that one that is taken as the location of the tex distro. Looking back at both the wrapper assigned value for this variable (export TEXMFSYSCONFIG="$out/share/texmf-config") and ls result also reveal that it point to a location that doesn't exists.

So I decided to proceed to a small experiment:

mkdir bin
cp -rp -t ./bin /nix/store/wj0wjsm8qywdkb53n1dlwnnng1ayhz01-texlive-combined-2015/bin/*
chmod a+rw ./bin/*
for f in ./bin/*; do sed -i -e "s#/nix/store/wj0wjsm8qywdkb53n1dlwnnng1ayhz01-texlive-combined-2015/bin#$HOME/dev/cv/pandoc_resume/bin#" -e 's#texmf-config#texmf#' "$f"; done
export PATH=$PWD/bin:$PATH

# Run the previously failing program.
make pdf

which finally fixed the problem. Now, previously hanging make pdf completes its task.

I can see two different solutions to the problem:

  1. Fix TEXMFCONFIG's wrapper value assignment expression to export TEXMFSYSCONFIG="$out/share/texmf" as done in the small experiment.

    This risk breaking other tex environments that rely on $out/share/texmf-config containing something different than $out/share/texmf.

  2. When $out/share/texmf-config does not exist, create it as a symbolic link that points to $out/share/texmf.

I shall work on a pull request that fixes the problem using one of these solutions. Meanwhile, it would be appreciate to get feedback that can steer my choice toward one of the other.

abbradar commented 8 years ago

I think https://github.com/NixOS/nixpkgs/pull/12768 would fix this problem, but it was reverted because it introduces build failures that we haven't yet looked at.

jraygauthier commented 8 years ago

Hi @abbradar, thanks for the ref. I cherry picked your latest d0ac2b62c218feab530bba319770cc0e8b291392 and now I get a different error:

$ context --help
mtxrun          | unknown script 'context.lua' or 'mtx-context.lua' 

I assume that is a consequence of what was meant by TODO: perhaps do lua actions?.

Could it be that ./share/texmf/web2c/texmfcnf.lua need to be patched in the same way that ./share/texmf/web2c/texmf.cnf was?

jraygauthier commented 8 years ago

Patching the *.lua script with

      local cnfLuaOrig="$(realpath ./texmfcnf.lua)"
      rm ./texmfcnf.lua
      sed \
        -e 's,texmf-dist,texmf,g' \
        -e 's,texmf-local,texmf,g' \
        -e "s,\$SELFAUTOLOC,$out,g" \
        -e "s,selfautodir:/,$out/share/,g" \
        -e "s,selfautodir:,$out/share/,g" \
        -e "s,selfautoparent:/,$out/share/,g" \
        -e "s,selfautoparent:,$out/share/,g" \
        "$cnfLuaOrig" > ./texmfcnf.lua

brought me further. However, now back to something like the original error:

$ context --version

mtx-context     | ConTeXt Process Management 0.60
mtx-context     |
mtx-context     | main context file: unknown, 'context.mkiv' not found
$ make pdf 
pandoc --standalone --template style_chmduquesne.tex \
--from markdown --to context \
-V papersize=letter \
-o resume.tex resume.md; \
context resume.tex

mtx-context     | warning: no format found, forcing remake (commandline driven)
resolvers       | resolving | configuration files already identified
resolvers       | resolving | loading configuration file 'selfautodir:/share/texmf/web2c/texmfcnf.lua'
resolvers       | resolving |
resolvers       | resolving | locating list of 'home:.texlive2014/texmf-config' (runtime) (tree:///home:.texlive2014/texmf-config)
resolvers       | methods | resolving, method 'locators', how 'uri', handler 'tree', argument 'tree:///home:.texlive2014/texmf-config'
resolvers       | trees | locator 'home:.texlive2014/texmf-config' not found
resolvers       | resolving | locating list of 'home:texmf' (runtime) (tree:///home:texmf)
resolvers       | methods | resolving, method 'locators', how 'uri', handler 'tree', argument 'tree:///home:texmf'
resolvers       | trees | locator 'home:texmf' not found
resolvers       | resolving | locating list of '/nix/store/myzyjbvwwpmsm8c17wmdgpxnpfl0k60v-texlive-combined-2015/share/texmf-config' (cached)
resolvers       | methods | resolving, method 'locators', how 'uri', handler 'file', argument '/nix/store/myzyjbvwwpmsm8c17wmdgpxnpfl0k60v-texlive-combined-2015/share/texmf-config'
resolvers       | files | file locator '/nix/store/myzyjbvwwpmsm8c17wmdgpxnpfl0k60v-texlive-combined-2015/share/texmf-config' not found
resolvers       | resolving | locating list of '/nix/store/myzyjbvwwpmsm8c17wmdgpxnpfl0k60v-texlive-combined-2015/share/texmf-var' (cached)
resolvers       | methods | resolving, method 'locators', how 'uri', handler 'file', argument '/nix/store/myzyjbvwwpmsm8c17wmdgpxnpfl0k60v-texlive-combined-2015/share/texmf-var'
resolvers       | files | file locator '/nix/store/myzyjbvwwpmsm8c17wmdgpxnpfl0k60v-texlive-combined-2015/share/texmf-var' not found
resolvers       | resolving | locating list of '/nix/store/myzyjbvwwpmsm8c17wmdgpxnpfl0k60v-texlive-combined-2015/share/texmf-project' (cached)
resolvers       | methods | resolving, method 'locators', how 'uri', handler 'file', argument '/nix/store/myzyjbvwwpmsm8c17wmdgpxnpfl0k60v-texlive-combined-2015/share/texmf-project'
resolvers       | files | file locator '/nix/store/myzyjbvwwpmsm8c17wmdgpxnpfl0k60v-texlive-combined-2015/share/texmf-project' not found
resolvers       | resolving | locating list of '/nix/store/myzyjbvwwpmsm8c17wmdgpxnpfl0k60v-texlive-combined-2015/share/texmf-fonts' (cached)
resolvers       | methods | resolving, method 'locators', how 'uri', handler 'file', argument '/nix/store/myzyjbvwwpmsm8c17wmdgpxnpfl0k60v-texlive-combined-2015/share/texmf-fonts'
resolvers       | files | file locator '/nix/store/myzyjbvwwpmsm8c17wmdgpxnpfl0k60v-texlive-combined-2015/share/texmf-fonts' not found
resolvers       | resolving | locating list of '/nix/store' (cached)
resolvers       | methods | resolving, method 'locators', how 'uri', handler 'file', argument '/nix/store'
resolvers       | files | file locator '/nix/store' found as '/nix/store'
resolvers       | resolving | locating list of '/nix/store/myzyjbvwwpmsm8c17wmdgpxnpfl0k60v-texlive-combined-2015/share/texmf' (cached)
resolvers       | methods | resolving, method 'locators', how 'uri', handler 'file', argument '/nix/store/myzyjbvwwpmsm8c17wmdgpxnpfl0k60v-texlive-combined-2015/share/texmf'
resolvers       | files | file locator '/nix/store/myzyjbvwwpmsm8c17wmdgpxnpfl0k60v-texlive-combined-2015/share/texmf' found as '/nix/store/myzyjbvwwpmsm8c17wmdgpxnpfl0k60v-texlive-combined-2015/share/texmf'
resolvers       | resolving |
resolvers       | methods | resolving, method 'generators', how 'uri', handler 'file', argument '/nix/store'
resolvers       | expansions | scanning path '/nix/store', branch '/nix/store'

with the strange difference that now, as the output complains ./share/texmf-var no longer exists:

$ ls -la $(dirname $(dirname `which context`))/share
total 20
dr-xr-xr-x  5 root nixbld 4096 Dec 31  1969 .
dr-xr-xr-x  4 root nixbld 4096 Dec 31  1969 ..
dr-xr-xr-x  2 root nixbld 4096 Dec 31  1969 info
dr-xr-xr-x  2 root nixbld 4096 Dec 31  1969 man
dr-xr-xr-x 12 root nixbld 4096 Dec 31  1969 texmf
jraygauthier commented 8 years ago

Not that reverting back to straight , I can see that ./share/texmf-var was not present either which exclude the patching of texmfcnf.lua as the cause of this disappearance.

$ ls -la $(dirname $(dirname `which context`))/share
total 20
dr-xr-xr-x  5 root nixbld 4096 Dec 31  1969 .
dr-xr-xr-x  4 root nixbld 4096 Dec 31  1969 ..
dr-xr-xr-x  2 root nixbld 4096 Dec 31  1969 info
dr-xr-xr-x  2 root nixbld 4096 Dec 31  1969 man
dr-xr-xr-x 12 root nixbld 4096 Dec 31  1969 texmf
jraygauthier commented 8 years ago

Restoring the following removed build environment variables bring back the missing texmf-var directory:

    export TEXMFCNF="$out/share/texmf/web2c"
    export TEXMFDIST="$out/share/texmf"
    export TEXMFSYSCONFIG="$out/share/texmf-config"
    export TEXMFSYSVAR="$out/share/texmf-var"

But now, I'm back with this hanging at

resolvers | expansions | scanning path '/nix/store', branch '/nix/store'^CMakefile:5: recipe for target 'resume.pdf' failed make: *** [resume.pdf] Interrupt

most likely resulting from:

resolvers | files | file locator '/nix/store/i2k1jyb5iq8515i737hdq9wfb922asgg-texlive-combined-2015/share/texmf-config' not found

Here are the steps of my failed attempt at fixing the problem:

https://github.com/jraygauthier/nixpkgs/compare/jrg/master_user_20160122...jraygauthier:jrg/attempt_at_fixing_context_by_patching_luascript_as_well

There should be a way to stop this parent dir search at some point so that this process does not attempt to search the content of /nix/store.

jraygauthier commented 8 years ago

Finally found the solution as exposed by pull/14681.

Reverted to state of simple texmfcnf.lua patching but added the following stream transform expression:

        -e "s,\(TEXMFLOCAL[ ]*=[ ]*\)[^\,]*,\1\"$out/share/texmf\",g" \

replacing the seemingly innocent expression:

TEXMFLOCAL      = texmflocal

by

TEXMFLOCAL      = "$out/share/texmf"

This texmflocal expression was initialized in the following way:

local texmflocal = resolvers.prefixes.selfautoparent();
texmflocal = string.gsub(texmflocal, "20%d%d$", "texmf-local");

which it would seems, performed the recursive upward search that ended searching the /nix/store directory.

jraygauthier commented 8 years ago

Found this debian patch of patch that does in essence the same thing:

[SCM] Debian packaging of texlive-nonbin) branch, master, updated. debian/all-2012.20121125-1-10-g7e21ebf