Skip to content

Conversation

@wanstarge
Copy link

Although Even though a solution was mentioned many years ago , if users configure outDir as %WS1%/build, the BibTeX parameters must then be configured as %OUTDIR%/%DOCFILE%. At this point, the parameters expand to %WS1%/build/%DOCFILE%, and %WS1% is, in turn, expanded into an absolute path.

Calling the BibTeX recipe at this stage will result in an error. This is because BibTeX, under the default security settings of TeXLive and MacTex (openout_any = p), is not allowed to write files (such as .blg/.bbl) to an absolute path outside the working directory. Many users will, sooner or later, encounter this openout_any = p problem. #3045 #3023 #2303 #2042 #1932 #384

To address this, I am attempting to solve the issue with a minimal change, which is to add the variable `env['openout_any']='a'
Thanks for your review again.

"latex-workshop.latex.outDir": "%DIR%/build",
"latex-workshop.latex.tools": [
  {
    "name": "bibtex",
    "command": "bibtex",
    "args": ["%OUTDIR%/%DOCFILE%"]
  }
]
img

@James-Yu
Copy link
Owner

James-Yu commented Nov 7, 2025

I agree with @jlelong and am against merging this PR. Changing file permissions without user consent is way too risky for the extension. Really sorry to let you down.

I would say, an alternative way is to raise a warning on such cases and let the user to change the permission by themselves.

@James-Yu James-Yu closed this Nov 7, 2025
@wanstarge
Copy link
Author

Have you see the latest change, I have change the way to solve this question, they can only access the file in it's workspace

@jlelong
Copy link
Collaborator

jlelong commented Nov 7, 2025

The new approach looks better, although the function normalizeArgForCwd seems a bit complicated. I think the file argument must be the last entry of step.args. This should simplify the function quite a bit.

I am reopening this PR in the hope that we can come up a little intrusive solution.

@jlelong jlelong reopened this Nov 7, 2025
@wanstarge wanstarge closed this Nov 8, 2025
@wanstarge wanstarge reopened this Nov 8, 2025
@wanstarge
Copy link
Author

The new approach looks better, although the function normalizeArgForCwd seems a bit complicated. I think the file argument must be the last entry of step.args. This should simplify the function quite a bit.

I am reopening this PR in the hope that we can come up a little intrusive solution.

OK, I have tested this can work, please review it again, you can make any change to it as I remain some log to help user ti find out the question

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.

3 participants