Skip to content

Conversation

@compor
Copy link
Contributor

@compor compor commented Nov 28, 2024

Let's revert #57

Stacked on #61

@compor compor requested a review from math-fehr November 28, 2024 10:19
@compor compor self-assigned this Nov 28, 2024
@compor
Copy link
Contributor Author

compor commented Nov 28, 2024

./paper.tex:669: Package minted Error: 
 => ./paper:574: Missing ".latexminted_config"; custom lexers are disabled.

Something for later then!

@compor
Copy link
Contributor Author

compor commented Jan 31, 2025

After some investigation, this is a Minted v3+ feature to avoid arbitrary code execution via the custom lexers feature.
I have managed to build this locally, although not completely trouble-free:

  1. Add a .latexminted_config file with the following contents in your home dir or TEXMFHOME dir:
{
    "security": {
        "enable_cwd_config": true
    }
}
  1. Clone this branch locally
  2. Add a local .latexminted_config file with the following contents using the sha256sum for each custom lexer file:
{
    "custom_lexers": {
        "MLIRLexer.py": "59f433d2cb99995d23742874af4041d3632215578159f66fc3be15bd586865ea",
        "Lean4Lexer.py": "b605e06a957316a2de8607f43322dd2744ecbc53a6d29002ad0c42b0f9f71d6f"
    }
}
  1. Pull latex texlive docker image with sudo docker pull ghcr.io/xu-cheng/texlive-full:20250101
  2. Load Docker and mount the paper-template dir on it (assuming it is your CWD) with docker run -it --rm -v "$(pwd)":/workspace -w /workspace ghcr.io/xu-cheng/texlive-full:20250101 bash
  3. Execute make

The current problems are:

  • The if guard for older and newer versions of minted for using the right version of the newminted does not seem to work
  • Lexers invoked with unique names do not seem to work, but the default CustomLexer for the Python class seems to work. We will need to split those, if it is a minted issue.

This allows us to use \inputminted{path to lexer file}{foo.mlir} for now, but not inlining code fragments.
I need to check mintinline as well.

For the CI, we will need a layer to add the .latexminted_config to enable custom lexer execution.

I'll investigate more soon.

@compor
Copy link
Contributor Author

compor commented Jan 31, 2025

Issue filed with the docker image repo: xu-cheng/latex-docker#22

@compor compor mentioned this pull request Feb 3, 2025
@compor compor force-pushed the christos/update-texlive-docker branch from c6bbb9f to 9bfab52 Compare February 3, 2025 12:30
@compor compor changed the base branch from main to christos/generate-lexers-json February 3, 2025 12:30
@compor
Copy link
Contributor Author

compor commented Feb 3, 2025

Stacked at #61

@compor compor requested a review from alexarice February 3, 2025 12:34
Base automatically changed from christos/generate-lexers-json to main February 3, 2025 13:02
@compor compor force-pushed the christos/update-texlive-docker branch from 9bfab52 to 9323bc2 Compare February 3, 2025 13:04
Copy link
Contributor

@alexarice alexarice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI seems to work 👍 Do we want to pin the docker image or just leave it unpinned?

@alexarice
Copy link
Contributor

Ideally we could check the hashes for lexers in CI but this could be done in a separate PR or done manually for now.

@compor
Copy link
Contributor Author

compor commented Feb 3, 2025

It used to be unpinned and I prefer it this way as the Docker image is updated at the start of every month.
The most recent version was baked 2 days ago (tagged latest): https://github.com/xu-cheng/latex-docker/pkgs/container/texlive-full

@compor
Copy link
Contributor Author

compor commented Feb 3, 2025

Ideally we could check the hashes for lexers in CI but this could be done in a separate PR or done manually for now.

I also thought of that, but something for another day.

@compor compor added the bug Something isn't working label Feb 3, 2025
@compor compor merged commit e5b2f50 into main Feb 3, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants