Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kpsewhich: Tilde after delimiter is not expanded #3

Closed
e-kwsm opened this issue Oct 12, 2018 · 15 comments
Closed

kpsewhich: Tilde after delimiter is not expanded #3

e-kwsm opened this issue Oct 12, 2018 · 15 comments

Comments

@e-kwsm
Copy link

e-kwsm commented Oct 12, 2018

I tried to overwrite TEXMFCACHE = $TEXMFSYSVAR;$TEXMFVAR with TEXMFCACHE = $TEXMFSYSVAR;~/.cache/texlive/2018 in $TEXMFROOT/texmf.cnf, but the tilde is not expanded: kpsewhich -var-value=TEXMFCACHE returns /usr/local/texlive/2018/texmf-var:~/.cache/texlive/2018.

5.3.3 Tilde expansion
---------------------
A leading '~' in a path element is replaced by the value of the
environment variable 'HOME', or '.' if 'HOME' is not set. On Windows,
the environment variable 'USERPROFILE' is checked instead of 'HOME'.

Does this mean only the very leading tilde is expanded and any others are not expanded even if they appear immediately after a delimiter (:, ;, or ,)?

A user needs to expand ~ beforehand to append a path under ~:

% workaround
XDG_CACHE_HOME = ~/.cache % if not set
TEXMFCACHE     = $TEXMFSYSVAR:$XDG_CACHE_HOME/texlive/2018

Environment

  • OS: Debian 9.5
  • TeX Live: 2018
    • kpathsea: version 6.3.0
    • My $TEXMFDIST/web2c/texmf.cnf is same as texk/kpathsea/texmf.cnf (287946d)
@norbusan
Copy link
Member

@kberry Any comment?

@kberry
Copy link
Collaborator

kberry commented Oct 15, 2018

well, in most cases, ~ is expanded at the beginning of any path element, not just the first. (i don't think it's supposed to be expanded after commas, as such.) i agree there is some deficiency here, but exactly where is not immediately clear to me.

kpsewhich -var-value is not the same thing as having values in config files. it is not supposed to do brace expansions, for one thing.

For example, env FOO='/:~' kpsewhich -expand-braces='$FOO outputs /:/u/karl for me, so it's not matter of ~ never being expanded.

i am getting unexpected results from other tests right now, so i'll have to look further into it later. thanks for the report.

@kberry
Copy link
Collaborator

kberry commented Dec 13, 2018

I've committed changes to kpathsea such that kpsewhich --var-value=VAR and --expand-braces='$VAR' now expand tildes at the beginning of any path element. r49400.

Norbert, can you please merge this into Debian and we'll see what happens?

The problem seems to have been a clash between the use of ; as the path separator in texmf.cnf vs. the code looking for : as the separator when the current system is Unix-ish.

I hope this will be more in the nature of a bug fix than an incompatible interface change (at either the kpsewhich or API level), but I guess we'll find out.

Thanks again for the report.

P.S. Some of the tests I tried, as Makefile targets. $(wk) is my variable for the kpathsea build directory.

abc:
        A='$$B;$$C;$$D'; export A; \
        B='/texmf/sysvar'; export B; \
        C='~/.cache/sysvar'; export C; \
        D='~root'; export D; \
        cd $(wk) && ./kpsewhich -var-value=A

vv:
        TIL='~qemu/:~karl;~root/x'; export TIL; \
        cd $(wk) && ./kpsewhich -var-value=TIL
xb:
        FOO='/;~'; export FOO; cd $(wk) && ./kpsewhich --expand-braces='$$FOO'

norbusan pushed a commit that referenced this issue Dec 13, 2018
… or : regardless of the current system when parsing elements from a path (#3)

git-svn-id: svn://tug.org/texlive/trunk/Build/source@49400 c570f23f-e606-0410-a88d-b1316a301751
tbodt pushed a commit to tex-mirror/tex-live that referenced this issue Dec 13, 2018
… or : regardless of the current system when parsing elements from a path (TeX-Live/texlive-source#3)

git-svn-id: svn://tug.org/texlive/trunk/Build/source@49400 c570f23f-e606-0410-a88d-b1316a301751
@kberry
Copy link
Collaborator

kberry commented Dec 13, 2018

unfortunately the change breaks on windows. back to the drawing board.

@kberry
Copy link
Collaborator

kberry commented Dec 13, 2018

hopeful fix (for Windows) committed in r49410.

@norbusan
Copy link
Member

@kberry is this in a state that I can try it in Debian now?

@kberry
Copy link
Collaborator

kberry commented Dec 14, 2018

afaik yes. no more stoppers came in yesterday, so we won't know what other horrible mistakes are lurking until it gets more testing ... thanks.

@norbusan
Copy link
Member

Ok, build a new set and testing them locally. If there are not hickups I will upload them today.

t-tk pushed a commit to texjporg/tex-jp-build that referenced this issue Dec 15, 2018
… or : regardless of the current system when parsing elements from a path (TeX-Live/texlive-source#3)

git-svn-id: svn://tug.org/texlive/trunk/Build@49400 c570f23f-e606-0410-a88d-b1316a301751
@jbglaw
Copy link

jbglaw commented Dec 17, 2018

I just updated my TeX Live installation and found out that since then, brace expansion is done für the --var-value case.

This breaks my usage case, where I fetched a variable BUILD_FOR_PAPER='paper=a5paper,twoside,top=2cm,bottom=2cm,left=2.5cm,right=2cm', which is no longer passed through verbatim, but commas are changed to colons:

`jbglaw@charon:~$ BUILD_FOR_PAPER='paper=a5paper,twoside,top=2cm' kpsewhich --var-value BUILD_FOR_PAPER

paper=a5paper:twoside:top=2cm:bottom=2cm:left=2.5cm:right=2cm`

This obviously breaks my build. I would strongly appreciate if --var-value would be kept as-is, and a new option (ie. --var-value-expanded) added instead, breaking former semantics.

@kberry
Copy link
Collaborator

kberry commented Dec 17, 2018

thanks for the report. i was afraid of that, but had no way to know without trying. i think it should be feasible to do the brace expansion only if there actually are braces present, which should solve your case, and, i hope/expect, any practical case. we'll see.

@kberry
Copy link
Collaborator

kberry commented Dec 18, 2018

I added a new option -var-brace-value and restored -var-value to its original behavior (I believe). r49446. Sorry Norbert.

@norbusan
Copy link
Member

Haha, the previous one is already in Debian. I will reupload a new version to make sure we are consistent with what is in TL. Thanks for the heads up

@jbglaw
Copy link

jbglaw commented Dec 18, 2018

Thanks a lot, that was a very quick response!

I actually appreciate quite a lot that the turnaround time for changes into the Debian package system is so small. Even when "bugs" sneak in, but also for cases like this where something is fixed. Thanks for the great work!

@norbusan
Copy link
Member

@jbglaw Thanks for your remark. Unfortunately things might change wrt Debian in the future due to my reduced involvement.

@e-kwsm
Copy link
Author

e-kwsm commented Jan 5, 2019

Sorry for late reply.
I confirmed kpsewhich -var-brace-value works as expected on Debian 9.5.
Thanks.

@e-kwsm e-kwsm closed this as completed Jan 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants