bugGNU Octave - Bugs: bug #62779, latex_renderer fails with Miktex...

 
 

bug #62779: latex_renderer fails with Miktex due to 8.3 filenames

Submitter:  None
Submitted:  Mon 18 Jul 2022 03:37:07 AM UTC
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Patch Submitted Assigned to:  None
Originator Name:  Mark Harrison Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * 7.1.0
Operating System:  * Microsoft Windows
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

( Jump to the original submission )

Thu 21 Jul 2022 03:33:57 PM UTC, comment #7: 

Would it make sense to check that only once per Octave session? E.g., with a file static variable or something equivalent?
Or do we need to be able to react on environment changes for this?

Markus Mützel <mmuetzel>
Project Member
Thu 21 Jul 2022 03:29:11 PM UTC, comment #6: 

Looks good to me.
It probably doesn't make a big difference. But `find` might perform a bit better than `find_first_of` if you search a single char (i.e., `m_tmp_dir.find ('~')`.

Markus Mützel <mmuetzel>
Project Member
Thu 21 Jul 2022 03:18:10 PM UTC, comment #5: 

Actually this code is ran once for each graphics object that has a latex interpreter (any text or axes object for which we set the interpreter to "latex") so it can be quite expensive indeed. I added a guard and checked that there was a tilde in the directory name to avoid calling canonicalize_file_name on windows when it is obviously not necessary.

(file #53462)

Pantxo Diribarne <pantxo>
Project Member
Thu 21 Jul 2022 02:52:18 PM UTC, comment #4: 

This is probably safe to go on stable.

`canonicalize_file_name` is an expensive operation (especially on slow file systems). IIUC, this part of the code is run only once per Octave session. So, it is not super-critical. But maybe it might still make sense to guard this with `#if defined (OCTAVE_USE_WINDOWS_API)` (if this fixes an issue that is specific to Windows).
What do you think?

Markus Mützel <mmuetzel>
Project Member
Thu 21 Jul 2022 11:55:09 AM UTC, comment #3: 

Oups, you are right. The attached patch does things in the right order I think.

Should this go to stable?

(file #53459)

Pantxo Diribarne <pantxo>
Project Member
Thu 21 Jul 2022 11:14:50 AM UTC, comment #2: 

Yes, `canonicalize_file_name` should return the long name. However, it returns an empty string if the file or folder doesn't exist.

Are we sure that the folder exists at that point in time? (There is a `sys::mkdir` a little lower in the code that is shown in your patch...)

Markus Mützel <mmuetzel>
Project Member
Thu 21 Jul 2022 11:05:48 AM UTC, comment #1: 

CCing Markus who probably knows how to fix this.

@Markus: does canonicalize_file_name expand short 8.3 path? If so the attached patch should fix the issue.

(file #53458)

Pantxo Diribarne <pantxo>
Project Member
Mon 18 Jul 2022 03:37:07 AM UTC, original submission:  

When using Miktex version 2.9.7440 (2020-05-17) or later, rendering latex fails due to Octave using the shortened 8.3-style name of the temporary directory to the latex file. Miktex no longer supports this style of file name[1]. The following code produces incorrect output (see attached buggy_figure.png) and the error message:

setenv("OCTAVE_LATEX_DEBUG_FLAG", "1")
figure;
title('$\sqrt\beta$', 'interpreter', 'latex')

The error message:

warning: latex_renderer: latex failed for string "?"
* Command:
        "latex -interaction=nonstopmode -output-directory="C:\Users\MHARRI~1\AppData\Local\Temp\latex1v8O1z" "C:\Users\MHARRI~1\AppData\Local\Temp\latex
1v8O1z\default.tex""

* Error:


* Stdout:
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (MiKTeX 22.3) (preloaded format=latex.fmt)
 restricted \write18 enabled.
entering extended mode
! I can't find file `C:/Users/MHARRI'.
<to be read again>
                   \protect
<*> C:/Users/MHARRI~
                    1/AppData/Local/Temp/latex1v8O1z/default.tex
(Press Enter to retry, or Control-C to exit)
Please type another input file name
! Emergency stop.
<to be read again>
                   \protect
<*> C:/Users/MHARRI~
                    1/AppData/Local/Temp/latex1v8O1z/default.tex
No pages of output.
Transcript written on C:\Users\MHARRI~1\AppData\Local\Temp\latex1v8O1z\texput.l
og.

warning: called from
    __axis_label__ at line 36 column 6
    title at line 64 column 8
    bug at line 4 column 1

warning: latex_renderer: a run-time test failed and the 'latex' interpreter has been disabled.
warning: called from
    __axis_label__ at line 36 column 6
    title at line 64 column 8
    bug at line 4 column 1

Creating the directory C:\TEMP and changing the script to

setenv ("TEMP", 'C:\Temp\')
setenv("OCTAVE_LATEX_DEBUG_FLAG", "1")
figure;
title('$\sqrt\beta$', 'interpreter', 'latex')

results in correct output and rendering (see attached good_figure.png).

* Caching ?:11.000000:0:0:0:0
* Caching $\sqrt\beta$:11.000000:1:0:0:0

[1] https://github.com/MiKTeX/miktex/blob/next/CHANGELOG.md#297440---2020-05-17

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #53462:  bug62779_3.patch added by pantxo (1KiB - text/x-patch)
file #53459:  bug62779_2.patch added by pantxo (1KiB - text/x-patch)
file #53458:  bug62779.patch added by pantxo (936B - text/x-patch)
file #53449:  buggy_figure.png added by None (10KiB - image/png - Comparison of figure output with/without changing TEMP directory)
file #53450:  good_figure.png added by None (8KiB - image/png - Comparison of figure output with/without changing TEMP directory)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by pantxo (Updated the item)
  • -email is unavailable- added by pantxo
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only project members can vote.

     

     

     

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-07-21 pantxo Attached File- Added bug62779_3.patch, #53462
    2022-07-21 pantxo Attached File- Added bug62779_2.patch, #53459
        StatusNone Patch Submitted
    2022-07-21 pantxo Attached File- Added bug62779.patch, #53458
        Carbon-Copy- Added mmuetzel
    2022-07-18 None Attached File- Added buggy_figure.png, #53449
        Attached File- Added good_figure.png, #53450

    Back to the top


    Powered by Savane 3.9