-
Notifications
You must be signed in to change notification settings - Fork 45
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
Stderr fix #1606
Stderr fix #1606
Conversation
Some errors for gregorio print to stderr but do not write to glog. This leads to the error being lost when autocompiling, so we add a redirect which will capture the stderr output and put it in glog.
When compiling gabc files, tmp-gre will be created in the cwd and gtex and glog files will be written there. This allows for compilation of gabc files which are outside the current tree and should allow for compilation of tex files from outside outside of the project folder.
Vary filename for scores in scribus render frames
Update python scrips to Python 3.x
Barring objections I'll merge this on Monday. |
I was hoping to test it, but cannot get time for that until Tuesday. The code looks fine though. |
I can wait until Tuesday. Please do review it if you have the time. |
Had a chance to look at this today. Works as expected. |
@@ -798,8 +870,8 @@ local function compile_gabc(gabc_file, gtex_file, glog_file, allow_deprecated) | |||
extra_args = extra_args..' -D' | |||
end | |||
|
|||
local cmd = string.format('%s %s -W -o %s -l %s "%s"', gregorio_exe(), | |||
extra_args, gtex_file, glog_file, gabc_file) | |||
local cmd = string.format('%s %s -W -o %s -l %s "%s" 2> %s', gregorio_exe(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this line might be causing an error for me sometimes. The error looks like this:
(.../tex/latex/latexconfig
/epstopdf-sys.cfg))ignored arguments: 2> tmp-gre/alma-6_0_0.glog
Usage: gregorio [OPTION]... [-s | INPUT_FILE]
Try 'gregorio --help' for more information.
Proceeding anyway...
(.../tmp-gre/alma-6_0_0.gtex
Sometimes it actually causes the run to pause and sometimes it finishes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's supposed to be file redirection to make sure that output to stderr gets recorded in the glog file (makes debugging easier). Not sure why it would be rendering it as "ignored arguments". Do we need to quote the filename of the glog file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found the problem: if --shell-escape
is not given, but gregorio
is listed in shell_escape_commands
in texmf.cnf
, then 2>
gets interpreted as an ordinary argument. Gregorio will output a warning about extra arguments, which is harmless, but the glog file will be empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gregorio
will always be in the listed shell_escape_commands
for TeX Live (and I think MiKTeX too). I'll ask the TeX Live people about this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, which is a good thing, but presumably the restriction on redirects is a security measure. (For example, they certainly wouldn't want to allow os.execute("gregorio | rm -rf *")
.)
Perhaps an alternative is to make gregorio itself write the .glog file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It already can. That's what the -l
option is all about. There are just some errors that the -l
option doesn't capture. See #1541.
The point of the redirection is to try and capture those errors too, as they sometimes are needed to diagnose what's going wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, so ultimately this error message I'm seeing is unintended but mostly harmless. I've verified that if gregorio outputs an error, it does appear in the glog.
I mentioned above that sometimes TeX was stopping, and I am now guessing that it was for some other reason (still don't know what).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So long as it's harmless, then I see no need to change things. If it works as expected with the --shell-escape
option, then the error messages can be captured when needed even if normal operation doesn't capture them because of the security measures.
I'm not sure why we never considered this for a merge. It looks fully ready to me so I'm putting it here for comments.