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

fix read-only gifs and math directories #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LiberalArtist
Copy link
Contributor

An installed copy of stex might have all write permission bits removed, even for the owner of the installed files: this is the case with Guix package of stex, for example. If such an installation is used to initialize the gifs or math directories (e.g. for an out-of-source build), tar likewise creates them without write permissions, preventing subdirectories from being created later. Set the user write bit explicitly to avoid this problem.

There are some flags to tar and cp that might seem useful, but none of them seem to be portable, even just considering GNU and FreeBSD (as used in Mac OS): thus, chmod. In particular, removing -p from tar -xpf - was not enough to avoid the problem.

Related to racket/racket#4203 (comment)

An installed copy of stex might have all write permission bits removed,
even for the owner of the installed files: this is the case with Guix
package of stex, for example. If such an installation is used to
initialize the gifs or math directories (e.g. for an out-of-source
build), tar likewise creates them without write permissions, preventing
subdirectories from being created later. Set the user write bit
explicitly to avoid this problem.
  Mf-stex

Related to racket/racket#4203
mbakke pushed a commit to guix-mirror/guix that referenced this pull request Sep 4, 2022
Excplicitly set the user write bit when initializing the gifs or math
directories from the skeletons installed in the store. See also upstream
discussion at <dybvig/stex#6>. This problem
would be exposed by the upcoming changes to Racket's build system.

* gnu/packages/patches/stex-copy-from-immutable-store.patch: New patch.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/chez.scm (stex-bootstrap)[patches]: Use it.

Signed-off-by: Ludovic Courtès <[email protected]>
LiberalArtist added a commit to LiberalArtist/stex that referenced this pull request Nov 18, 2023
 This is a combination of 33 commits.
 This is the 1st commit message:

[DRAFT] use <!DOCTYPE html>

 This is the commit message dybvig#2:

[WIP] katex

 This is the commit message dybvig#3:

[FIXUP] katex/fonts

 This is the commit message dybvig#4:

fixup

 This is the commit message dybvig#5:

tar --dereference

Otherwise, it would archive katex/fonts as a symlink,
and chmod would fail.

The long option `--dereference` is portable to at least GNU tar and
FreeBSD tar, but the short versions of the option are incompatible:
GNU says `-h`, FreeBSD says `-L`.

 This is the commit message dybvig#6:

fixup tar --dereference

 This is the commit message dybvig#7:

link katexmacros; try explicit `make KATEX=$(KATEX)`

 This is the commit message #8:

no $

touch csug.hthirdrun
echo -n gifs= > math/csug/mathfiles
(cd math/csug; echo *.tex | sed -e "s/\.tex/.gif/g") >> math/csug/mathfiles
echo -n htmls= >> math/csug/mathfiles
(cd math/csug; echo *.katex | sed -e "s/\.katex/.html/g") >> math/csug/mathfiles
make[2]: Entering directory '/home/philip/code/racket/Chez-stex-tmp/csug/math/csug'
/gnu/store/kn10fd3x3fxw714f5p2zfq3ch8qnhm74-profile/bin/katex -i 0.katex -o 0.html --macro-file katexmacros
/gnu/store/xa79qcdvp7xan4iwc8023082x1j22ypk-katex-0.16.9/lib/node_modules/katex/guix-node-cjs/katex.js:13212
        throw error;
        ^

ParseError: KaTeX parse error: Can't use function '$' in math mode at position 1: $̲\Rightarrow$
    at new ParseError (/gnu/store/xa79qcdvp7xan4iwc8023082x1j22ypk-katex-0.16.9/lib/node_modules/katex/guix-node-cjs/katex.js:153:22)
    at _Parser.parseFunction (/gnu/store/xa79qcdvp7xan4iwc8023082x1j22ypk-katex-0.16.9/lib/node_modules/katex/guix-node-cjs/katex.js:12776:17)
    at _Parser.parseGroup (/gnu/store/xa79qcdvp7xan4iwc8023082x1j22ypk-katex-0.16.9/lib/node_modules/katex/guix-node-cjs/katex.js:13013:25)
    at _Parser.parseAtom (/gnu/store/xa79qcdvp7xan4iwc8023082x1j22ypk-katex-0.16.9/lib/node_modules/katex/guix-node-cjs/katex.js:12679:27)
    at _Parser.parseExpression (/gnu/store/xa79qcdvp7xan4iwc8023082x1j22ypk-katex-0.16.9/lib/node_modules/katex/guix-node-cjs/katex.js:12598:29)
    at _Parser.parse (/gnu/store/xa79qcdvp7xan4iwc8023082x1j22ypk-katex-0.16.9/lib/node_modules/katex/guix-node-cjs/katex.js:12562:30)
    at parseTree (/gnu/store/xa79qcdvp7xan4iwc8023082x1j22ypk-katex-0.16.9/lib/node_modules/katex/guix-node-cjs/katex.js:13172:25)
    at renderToDomTree (/gnu/store/xa79qcdvp7xan4iwc8023082x1j22ypk-katex-0.16.9/lib/node_modules/katex/guix-node-cjs/katex.js:13222:22)
    at Object.renderToString (/gnu/store/xa79qcdvp7xan4iwc8023082x1j22ypk-katex-0.16.9/lib/node_modules/katex/guix-node-cjs/katex.js:13203:22)
    at writeOutput (/gnu/store/xa79qcdvp7xan4iwc8023082x1j22ypk-katex-0.16.9/lib/node_modules/katex/cli.js:94:26) {
  position: 0,
  length: 1,
  rawMessage: "Can't use function '$' in math mode"
}

Node.js v18.18.2

 This is the commit message #9:

katexmacros for csug

 This is the commit message #10:

fixup punt-to-latex

 This is the commit message #11:

fixup --katex-finished

 This is the commit message #12:

fixup

 This is the commit message #13:

really fixup

 This is the commit message #14:

mostly documentation things (don't check in doc/katex for now)

 This is the commit message #15:

stex.stex build nicely; handled schemeghostRightarrow

 This is the commit message #16:

fixup KATEX_CSS default

 This is the commit message #17:

fixup for eof from get-string-all

 This is the commit message #18:

KATEX_FLAGS

 This is the commit message #19:

make variable propagation works

 This is the commit message #20:

tweak

 This is the commit message #21:

[TMP] seek smathdisplay

 This is the commit message #22:

export KATEX KATEX_FLAGS

 This is the commit message #23:

Revert "[TMP] seek smathdisplay"

This reverts commit ff169c9.

 This is the commit message #24:

note lack of epsfbox; add comment about display mode

 This is the commit message #25:

tweaks

 This is the commit message #26:

should have been in previous commit

 This is the commit message #27:

revert some probably unnecessary html updates

 This is the commit message #28:

[TMP] revert td nowrap

 This is the commit message #29:

[TMP] revert mdash ndash

 This is the commit message #30:

revert self-closing img for non-katex mode

 This is the commit message #31:

use old doctype unless katex

 This is the commit message #32:

revert gratuitous change to self-closing for (style-sheet)

 This is the commit message #33:

increment version to 1.3
LiberalArtist added a commit to LiberalArtist/stex that referenced this pull request Nov 18, 2023
An installed copy of stex might have all write permission bits removed,
even for the owner of the installed files: this is the case with Guix
package of stex, for example. If such an installation is used to
initialize the gifs or math directories (e.g. for an out-of-source
build), tar likewise creates them without write permissions, preventing
subdirectories from being created later. Set the user write bit
explicitly to avoid this problem.
Furthermore, tar by default would copy symbolic links in the installed
copy as links, causing chmod to fail or, if permitted, writes to
affect in an improper location. Avoid this using the --dereference
option, which is portable to at least GNU and FreeBSD tar (but only in
long form: GNU has -h, but FreeBSD has -L).
  Mf-stex

Related to racket/racket#4203
Closes dybvig#6
LiberalArtist added a commit to LiberalArtist/stex that referenced this pull request Nov 18, 2023
An installed copy of stex might have all write permission bits removed,
even for the owner of the installed files: this is the case with the
Guix package of stex, for example. If such an installation is used to
initialize the gifs or math directories (e.g. for an out-of-source
build), tar likewise creates them without write permissions, preventing
subdirectories from being created later. Set the user write bit
explicitly to avoid this problem.
Furthermore, tar by default would copy symbolic links in the installed
copy as links, causing chmod to fail or, if permitted, writes to an
improper location. Avoid this using the --dereference option, which is
portable to at least GNU and FreeBSD tar (but only in long form: GNU
has -h, but FreeBSD has -L).
  Mf-stex

Related to racket/racket#4203
Closes dybvig#6
@LiberalArtist
Copy link
Contributor Author

#7 includes an improved version of this patch: merging it should automatically close this PR.

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

Successfully merging this pull request may close these issues.

1 participant