Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-45044

tex filter: problem with paths of TeX binaries under Windows

    Details

    • Testing Instructions:
      Hide

      This is modification is to fix a bug affecting Windows platforms with PHP > 5.3; however, all platforms may need to be regression tested to verify that the implementation works on currently supported systems. Specific tests should be performed on PHP 5.3 systems ( Moodle 2.6), and PHP 5.4,5.5 (required by Moodle 2.7).

      1. Move or rename TeX binaries latex, dvips, and convert to have spaces in the paths if necessary. Ideally use MikTeX 2.9 on Windows which has spaces in default path.
      2. Verify no php errors occur on install.
      3. Go to admin settings, set paths, save, and verify executables are found.
      4. Try to add quotes around paths and save. Quotes should be removed automatically.
      5. Enable TeX filter, disable MathJaxloader, and view page with TeX code to verify GIF images are generated.
      6. Go to texdebug.php and run generate images with latex, dvips and show commands. Verify executables are found and correct images displayed.
      7. Change setting for converformat to PNG retest and make sure PNGs are displayed.
      8. Try with hard coded values for paths in config.php with quotes around paths and verify that everything still works. Then go to TeX admin settings. Paths should be displayed with quotes, but should be marked as invalid since quotes are present.
      Show
      This is modification is to fix a bug affecting Windows platforms with PHP > 5.3; however, all platforms may need to be regression tested to verify that the implementation works on currently supported systems. Specific tests should be performed on PHP 5.3 systems ( Moodle 2.6), and PHP 5.4,5.5 (required by Moodle 2.7). Move or rename TeX binaries latex, dvips, and convert to have spaces in the paths if necessary. Ideally use MikTeX 2.9 on Windows which has spaces in default path. Verify no php errors occur on install. Go to admin settings, set paths, save, and verify executables are found. Try to add quotes around paths and save. Quotes should be removed automatically. Enable TeX filter, disable MathJaxloader, and view page with TeX code to verify GIF images are generated. Go to texdebug.php and run generate images with latex, dvips and show commands. Verify executables are found and correct images displayed. Change setting for converformat to PNG retest and make sure PNGs are displayed. Try with hard coded values for paths in config.php with quotes around paths and verify that everything still works. Then go to TeX admin settings. Paths should be displayed with quotes, but should be marked as invalid since quotes are present.
    • Workaround:
      Hide

      \

      Show
      \
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE
    • Pull from Repository:
    • Pull 2.7 Branch:
      MDL-45044-m27-master
    • Pull Master Branch:
      MDL-45044-master

      Description

      See this discussion https://moodle.org/mod/forum/discuss.php?d=258109

      The problem is that

      • path enclosed in double quotes will be reported as wrong (this is also true for default paths like "c:\texmf\miktex\bin\latex.exe" , ...) so you will get crosses on the settings page and more important you can't set convert output format to PNG because filter_tex_updatedcallback function will revert it back to GIF but inaries will be called correctly and the image will be generated by latex, dvips and convert
      • path without double quotes will be reported as correct on the settings page and you can set convert output format to PNG, but commands will only work if they don't contain any space. This is not a good thing as all recent MikTeX versions are installed by default in c:\program files (x86)\miktex 2.9

      I think this is a bug and should be fixed but I am not sure of the right way to fix it.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            dthies Daniel Thies added a comment -

            I think this is a small fix affecting 2.6 and older running PHP 5.4. I responded already in the forum. I believe that 2.7 has already been fixed.

            Show
            dthies Daniel Thies added a comment - I think this is a small fix affecting 2.6 and older running PHP 5.4. I responded already in the forum. I believe that 2.7 has already been fixed.
            Hide
            jmvedrine Jean-Michel Vedrine added a comment -

            I also tried 2.7dev with PHP 5.4.12 (Windows 8.1) and I don't see it fixed.

            Show
            jmvedrine Jean-Michel Vedrine added a comment - I also tried 2.7dev with PHP 5.4.12 (Windows 8.1) and I don't see it fixed.
            Hide
            dthies Daniel Thies added a comment -

            I do see a difference with Ubuntu 13.10 which is running php 5.5.3. It may be that the escape that is used does not work with windows or it maybe fixed in PHP 5.5. Is it possible for you to upgrade?

            Show
            dthies Daniel Thies added a comment - I do see a difference with Ubuntu 13.10 which is running php 5.5.3. It may be that the escape that is used does not work with windows or it maybe fixed in PHP 5.5. Is it possible for you to upgrade?
            Hide
            dthies Daniel Thies added a comment -

            I am sorry Jean-Michel you are right I forgot that I had fixed a couple in lines in my 2.7dev when I was working on it. 2.7dev has the bug as well. The change I made was to wrap the git_config() in an escapeshellarg() making the following patch which seems to be the right thing. User input should not be used unescaped in an exec. It may not be a real threat since only admins can do it. I will place a patch above if you want to try it.

            Show
            dthies Daniel Thies added a comment - I am sorry Jean-Michel you are right I forgot that I had fixed a couple in lines in my 2.7dev when I was working on it. 2.7dev has the bug as well. The change I made was to wrap the git_config() in an escapeshellarg() making the following patch which seems to be the right thing. User input should not be used unescaped in an exec. It may not be a real threat since only admins can do it. I will place a patch above if you want to try it.
            Hide
            dthies Daniel Thies added a comment -

            Code someone check this on Windows and I will work on the code for 2.5 and 2.6

            Show
            dthies Daniel Thies added a comment - Code someone check this on Windows and I will work on the code for 2.5 and 2.6
            Hide
            salvetore Michael de Raadt added a comment -

            Thanks for working on this. Feel free to push for peer review.

            Show
            salvetore Michael de Raadt added a comment - Thanks for working on this. Feel free to push for peer review.
            Hide
            jmvedrine Jean-Michel Vedrine added a comment -

            Hello Daniel,
            I tested your changes under Windows 8.1, PHP 5.4.12 on the master branch and they work quite well if your paths aren't enclosed in double quotes.
            Unfortunately if you have paths enclosed in quotes they fail because for instance "C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\latex.exe" is changed by escapeshellarg into " C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\latex.exe ".
            So I think there are 2 other changes to do for this patch to be good:

            • The default paths (lines 53-55 of filter/tex/settings.php) should be changed to not include any quotes because as they are they are giving a false information to administrators on Windows
            • For the same reason I think it is necessary to include a new upgrade step into filter/tex/db/upgrade.php that will remove any existing quotes around saved paths. For this step to be executed during upgrade it will also be necessary to change version number in version.php.

            The fact that no quotes should be put around paths will also need to be written in the docs

            Show
            jmvedrine Jean-Michel Vedrine added a comment - Hello Daniel, I tested your changes under Windows 8.1, PHP 5.4.12 on the master branch and they work quite well if your paths aren't enclosed in double quotes. Unfortunately if you have paths enclosed in quotes they fail because for instance "C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\latex.exe" is changed by escapeshellarg into " C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\latex.exe ". So I think there are 2 other changes to do for this patch to be good: The default paths (lines 53-55 of filter/tex/settings.php) should be changed to not include any quotes because as they are they are giving a false information to administrators on Windows For the same reason I think it is necessary to include a new upgrade step into filter/tex/db/upgrade.php that will remove any existing quotes around saved paths. For this step to be executed during upgrade it will also be necessary to change version number in version.php. The fact that no quotes should be put around paths will also need to be written in the docs
            Hide
            dthies Daniel Thies added a comment -

            Thank you Jean-Michel, I just tried this out on an older system. It seems that one has had to type in the quotes in the past, but that should not have been the case. I will modify it for backward compatibility, and then push it for testing. Thanks.

            Show
            dthies Daniel Thies added a comment - Thank you Jean-Michel, I just tried this out on an older system. It seems that one has had to type in the quotes in the past, but that should not have been the case. I will modify it for backward compatibility, and then push it for testing. Thanks.
            Hide
            dthies Daniel Thies added a comment -

            I made the settings check for quotes in the paths setting and strip them so it should be self correcting. Admins should not even notice they have disappeared. Thank you for the reminder to change the defaults.

            Show
            dthies Daniel Thies added a comment - I made the settings check for quotes in the paths setting and strip them so it should be self correcting. Admins should not even notice they have disappeared. Thank you for the reminder to change the defaults.
            Hide
            cibot CiBoT added a comment -

            Results for MDL-45044

            Show
            cibot CiBoT added a comment - Results for MDL-45044 Remote repository: https://github.com/dthies/moodle Remote branch m25- MDL-45044 -master to be integrated into upstream MOODLE_25_STABLE Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/2939 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/2939/artifact/work/smurf.html Remote branch m26- MDL-45044 -master to be integrated into upstream MOODLE_26_STABLE Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/2940 Error: The m26- MDL-45044 -master branch at https://github.com/dthies/moodle does not apply clean to MOODLE_26_STABLE Remote branch MDL-45044 -master to be integrated into upstream master Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/2941 Error: The MDL-45044 -master branch at https://github.com/dthies/moodle does not apply clean to master
            Show
            cibot CiBoT added a comment - Results for MDL-45044 Remote repository: https://github.com/dthies/moodle Remote branch m25- MDL-45044 -master to be integrated into upstream MOODLE_25_STABLE Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/2943 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/2943/artifact/work/smurf.html Remote branch m26- MDL-45044 -master to be integrated into upstream MOODLE_26_STABLE Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/2944 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/2944/artifact/work/smurf.html Remote branch MDL-45044 -master to be integrated into upstream master Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/2945 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/2945/artifact/work/smurf.html
            Hide
            skodak Petr Skoda added a comment -

            hi, why not simply trim() the doublequotes? Also the testing instructions need regression testing on all platforms.

            Show
            skodak Petr Skoda added a comment - hi, why not simply trim() the doublequotes? Also the testing instructions need regression testing on all platforms.
            Hide
            skodak Petr Skoda added a comment -

            also the git commit messages must start with MDL - see http://docs.moodle.org/dev/Commit_cheat_sheet

            Show
            skodak Petr Skoda added a comment - also the git commit messages must start with MDL - see http://docs.moodle.org/dev/Commit_cheat_sheet
            Hide
            dthies Daniel Thies added a comment -

            I will replace the str_replace with trim($path, ' "'). I was testing with strpos to avoid unnecessary database writes. Is it better to simplify the could and do the writes?

            Show
            dthies Daniel Thies added a comment - I will replace the str_replace with trim($path, ' "'). I was testing with strpos to avoid unnecessary database writes. Is it better to simplify the could and do the writes?
            Hide
            dthies Daniel Thies added a comment -

            Release it would be better to put this in db/update. In lib.php admin to action. If it is in upgrade, the quotes should removed without admin action and code only runs once.

            Show
            dthies Daniel Thies added a comment - Release it would be better to put this in db/update. In lib.php admin to action. If it is in upgrade, the quotes should removed without admin action and code only runs once.
            Hide
            dthies Daniel Thies added a comment -

            Fixed commit statements, use trim instead of replace to prevent quotes from being entered and added update code to remove quotes without admin action for old installations.

            Show
            dthies Daniel Thies added a comment - Fixed commit statements, use trim instead of replace to prevent quotes from being entered and added update code to remove quotes without admin action for old installations.
            Show
            cibot CiBoT added a comment - Results for MDL-45044 Remote repository: https://github.com/dthies/moodle Remote branch MDL-45044 -m25-master to be integrated into upstream MOODLE_25_STABLE Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/2952 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/2952/artifact/work/smurf.html Remote branch MDL-45044 -m26-master to be integrated into upstream MOODLE_26_STABLE Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/2953 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/2953/artifact/work/smurf.html Remote branch MDL-45044 -master to be integrated into upstream master Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/2954 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/2954/artifact/work/smurf.html
            Show
            cibot CiBoT added a comment - Results for MDL-45044 Remote repository: https://github.com/dthies/moodle Remote branch MDL-45044 -m25-master to be integrated into upstream MOODLE_25_STABLE Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/2967 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/2967/artifact/work/smurf.html Remote branch MDL-45044 -m26-master to be integrated into upstream MOODLE_26_STABLE Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/2968 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/2968/artifact/work/smurf.html Remote branch MDL-45044 -master to be integrated into upstream master Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/2969 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/2969/artifact/work/smurf.html
            Hide
            skodak Petr Skoda added a comment -

            Hello, I am not sure, but it might be easier to trim the command paths before use instead of after change of settings. The current code would probably fail if you hardcoded the paths in config.php (not ok for stable branches in my opinion). The performance cost should be negligible because the execution of external commands is probably significantly slower.

            Show
            skodak Petr Skoda added a comment - Hello, I am not sure, but it might be easier to trim the command paths before use instead of after change of settings. The current code would probably fail if you hardcoded the paths in config.php (not ok for stable branches in my opinion). The performance cost should be negligible because the execution of external commands is probably significantly slower.
            Hide
            dthies Daniel Thies added a comment -

            Yes, I have looked at that, but the problem is really with the admin_setting_configexecutable class from adminlib.php. I can use trim to remove the quotes from the stored paths, lib.php, latex.php, and texdebug.php. This should allow the old settings to function, but paths containing quotes will be marked as invalid unless changes are made to admin_setting_configexecutable. I search the code and and this is used for clam AV antispam executable, and for ghostscript when used to used for grading pdfs. I don't know whether changing admin_setting_configexecutable would affect them adversely or whether they also might have the same problems with PHP 5.4.

            My preference would be to stay with my current implementation because not have quotes in the paths seems the better practice, and it is good programming practice to escape user input (even if from the admins).

            Show
            dthies Daniel Thies added a comment - Yes, I have looked at that, but the problem is really with the admin_setting_configexecutable class from adminlib.php. I can use trim to remove the quotes from the stored paths, lib.php, latex.php, and texdebug.php. This should allow the old settings to function, but paths containing quotes will be marked as invalid unless changes are made to admin_setting_configexecutable. I search the code and and this is used for clam AV antispam executable, and for ghostscript when used to used for grading pdfs. I don't know whether changing admin_setting_configexecutable would affect them adversely or whether they also might have the same problems with PHP 5.4. My preference would be to stay with my current implementation because not have quotes in the paths seems the better practice, and it is good programming practice to escape user input (even if from the admins).
            Hide
            dthies Daniel Thies added a comment -

            I have submitted a different fix as you suggested. The lib.php does not modify the settings but does trim path before checking them. latex.php and tex.php also will trim the the paths, check them, and the escape the paths. lib/adminlib.php is modified to trim the paths before checking them in admin_setting_configexecutable.
            With this method paths are accepted in either form with or without quotes. It is backward compatible, but also does allow more standard syntax going forward.

            Show
            dthies Daniel Thies added a comment - I have submitted a different fix as you suggested. The lib.php does not modify the settings but does trim path before checking them. latex.php and tex.php also will trim the the paths, check them, and the escape the paths. lib/adminlib.php is modified to trim the paths before checking them in admin_setting_configexecutable. With this method paths are accepted in either form with or without quotes. It is backward compatible, but also does allow more standard syntax going forward.
            Show
            cibot CiBoT added a comment - Results for MDL-45044 Remote repository: https://github.com/dthies/moodle Remote branch MDL-45044 -m25-alt-master to be integrated into upstream MOODLE_25_STABLE Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/3009 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/3009/artifact/work/smurf.html Remote branch MDL-45044 -m26-alt-master to be integrated into upstream MOODLE_26_STABLE Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/3010 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/3010/artifact/work/smurf.html Remote branch MDL-45044 -alt-master to be integrated into upstream master Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/3011 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/3011/artifact/work/smurf.html
            Hide
            dthies Daniel Thies added a comment -

            I cleaned up one commit statement and have all necessary files executing a trim after getting paths to emulate the magic quotes of PHP 5.3. I would recommend removing any mention of quotes from docs and that we remove quotes in the upgrade code in Moodle 2.8 if we do not want to do it in 2.7. Other modules that have settings for files and directories in the settings should also be checked to see if they need changes as well.

            Show
            dthies Daniel Thies added a comment - I cleaned up one commit statement and have all necessary files executing a trim after getting paths to emulate the magic quotes of PHP 5.3. I would recommend removing any mention of quotes from docs and that we remove quotes in the upgrade code in Moodle 2.8 if we do not want to do it in 2.7. Other modules that have settings for files and directories in the settings should also be checked to see if they need changes as well.
            Show
            cibot CiBoT added a comment - Results for MDL-45044 Remote repository: https://github.com/dthies/moodle Remote branch MDL-45044 -m25-alt-master to be integrated into upstream MOODLE_25_STABLE Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/3031 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/3031/artifact/work/smurf.html Remote branch MDL-45044 -m26-alt-master to be integrated into upstream MOODLE_26_STABLE Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/3032 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/3032/artifact/work/smurf.html Remote branch MDL-45044 -alt-master to be integrated into upstream master Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/3033 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/3033/artifact/work/smurf.html
            Show
            cibot CiBoT added a comment - Results for MDL-45044 Remote repository: https://github.com/dthies/moodle Remote branch MDL-45044 -m25-alt-master to be integrated into upstream MOODLE_25_STABLE Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/3035 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/3035/artifact/work/smurf.html Remote branch MDL-45044 -m26-alt-master to be integrated into upstream MOODLE_26_STABLE Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/3036 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/3036/artifact/work/smurf.html Remote branch MDL-45044 -alt-master to be integrated into upstream master Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/3037 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/3037/artifact/work/smurf.html
            Hide
            dthies Daniel Thies added a comment -

            I now have a solution that is very forgiving so that it will not fail with any previously working config.
            1. Executable paths are trimmed and then escaped in latex.php and texdebug.php so that paths with spaces work with or without quotes.
            2. In settings quotes in the paths are trimmed and paths updated before page display. The paths pass the check without modifying adminlib code this way.
            3. If the paths are hard coded with quotes within config.php then on the settings page the pathcheck will show as failed for the overriden values, but trimming the values in the update check prevents the image type from being changed to GIF. The hardcoded values work normally due to the other modifications.

            Show
            dthies Daniel Thies added a comment - I now have a solution that is very forgiving so that it will not fail with any previously working config. 1. Executable paths are trimmed and then escaped in latex.php and texdebug.php so that paths with spaces work with or without quotes. 2. In settings quotes in the paths are trimmed and paths updated before page display. The paths pass the check without modifying adminlib code this way. 3. If the paths are hard coded with quotes within config.php then on the settings page the pathcheck will show as failed for the overriden values, but trimming the values in the update check prevents the image type from being changed to GIF. The hardcoded values work normally due to the other modifications.
            Hide
            cibot CiBoT added a comment -

            Results for MDL-45044

            Show
            cibot CiBoT added a comment - Results for MDL-45044 Remote repository: https://github.com/dthies/moodle Remote branch MDL-45044 -m25-master to be integrated into upstream MOODLE_25_STABLE Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/3275 Warning: The MDL-45044 -m25-master branch at https://github.com/dthies/moodle has not been rebased recently (>20 days ago). Details: http://integration.moodle.org/job/Precheck%20remote%20branch/3275/artifact/work/smurf.html Remote branch MDL-45044 -m26-master to be integrated into upstream MOODLE_26_STABLE Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/3276 Warning: The MDL-45044 -m26-master branch at https://github.com/dthies/moodle has not been rebased recently (>20 days ago). Details: http://integration.moodle.org/job/Precheck%20remote%20branch/3276/artifact/work/smurf.html Remote branch MDL-45044 -master to be integrated into upstream master Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/3277 Warning: The MDL-45044 -master branch at https://github.com/dthies/moodle has not been rebased recently (>20 days ago). Details: http://integration.moodle.org/job/Precheck%20remote%20branch/3277/artifact/work/smurf.html
            Hide
            damyon Damyon Wiese added a comment -

            This branch looks good to me - pushing for integration.

            The master branch merges cleanly with master and 27 (but a rebase would be nicer).

            Thanks Daniel.

            Show
            damyon Damyon Wiese added a comment - This branch looks good to me - pushing for integration. The master branch merges cleanly with master and 27 (but a rebase would be nicer). Thanks Daniel.
            Hide
            dthies Daniel Thies added a comment -

            I rebased all the branches and separated 2.7 from master. I am assuming that the 2.5 will not be integrated since it is not a security problem.

            Show
            dthies Daniel Thies added a comment - I rebased all the branches and separated 2.7 from master. I am assuming that the 2.5 will not be integrated since it is not a security problem.
            Hide
            dthies Daniel Thies added a comment -

            I don't believe that this has been through a testing cycle if it needs it.

            Show
            dthies Daniel Thies added a comment - I don't believe that this has been through a testing cycle if it needs it.
            Hide
            cibot CiBoT added a comment -

            Moving this issue to current integration cycle, will be reviewed soon. Thanks for the hard work!

            Show
            cibot CiBoT added a comment - Moving this issue to current integration cycle, will be reviewed soon. Thanks for the hard work!
            Hide
            marina Marina Glancy added a comment -

            Thanks Daniel, integrated in 2.6, 2.7 and master

            For tester: 2.6 branch is very different because settings are in different location

            Show
            marina Marina Glancy added a comment - Thanks Daniel, integrated in 2.6, 2.7 and master For tester: 2.6 branch is very different because settings are in different location
            Hide
            salvetore Michael de Raadt added a comment -

            I started testing this with PHP 5.3 on Moodle 2.6. After installing the site, I was shown this error...

            Notice: Undefined property: stdClass::$filter_tex_pathlatex in C:\xampp\htdocs\26_integration_53\filter\tex\settings.php on line 63
            Notice: Undefined property: stdClass::$filter_tex_pathdvips in C:\xampp\htdocs\26_integration_53\filter\tex\settings.php on line 64
            Notice: Undefined property: stdClass::$filter_tex_pathconvert in C:\xampp\htdocs\26_integration_53\filter\tex\settings.php on line 65
            

            I'm downloading Miktex so I can test the rest, but that will need to be fixed.

            Show
            salvetore Michael de Raadt added a comment - I started testing this with PHP 5.3 on Moodle 2.6. After installing the site, I was shown this error... Notice: Undefined property: stdClass::$filter_tex_pathlatex in C:\xampp\htdocs\26_integration_53\filter\tex\settings.php on line 63 Notice: Undefined property: stdClass::$filter_tex_pathdvips in C:\xampp\htdocs\26_integration_53\filter\tex\settings.php on line 64 Notice: Undefined property: stdClass::$filter_tex_pathconvert in C:\xampp\htdocs\26_integration_53\filter\tex\settings.php on line 65 I'm downloading Miktex so I can test the rest, but that will need to be fixed.
            Hide
            salvetore Michael de Raadt added a comment -

            I tested this on 2.6 under PHP 5.3 and Master with PHP 5.5.

            The admin settings were testing the location of the required binaries and stripping quotes.

            However, when I went to use the TeX filter, it did not convert the equation to an image. Here is the output from the debugging page...

            Checking executables
            latex executable (C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\latex.exe) is readable
            dvips executable (C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\dvips.exe) is readable
            convert executable (C:\Program Files\ImageMagick-6.8.9-Q16\convert.exe) is readable
             
            base filename for expression is '9608176195573c30c6beb3cf078fdf66'
             
            Processing TeX expression:
             
            f(x)=\int_{-\infty}^x~e^{-t^2}dt
             
            $ "C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\latex.exe" --interaction=nonstopmode --halt-on-error C:\xampp\data\26_integration_53_PostgreSQL/temp/latex/9608176195573c30c6beb3cf078fdf66.tex
            OUTPUT: This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9)
            entering extended mode
             
            (C:/xampp/data/26_integration_53_PostgreSQL/temp/latex/9608176195573c30c6beb3cf
            078fdf66.tex
            LaTeX2e <2011/06/27>
            Babel  and hyphenation patterns for english, afrikaans, ancientgreek, ar
            abic, armenian, assamese, basque, bengali, bokmal, bulgarian, catalan, coptic,
            croatian, czech, danish, dutch, esperanto, estonian, farsi, finnish, french, ga
            lician, german, german-x-2013-05-26, greek, gujarati, hindi, hungarian, iceland
            ic, indonesian, interlingua, irish, italian, kannada, kurmanji, latin, latvian,
             lithuanian, malayalam, marathi, mongolian, mongolianlmc, monogreek, ngerman, n
            german-x-2013-05-26, nynorsk, oriya, panjabi, pinyin, polish, portuguese, roman
            ian, russian, sanskrit, serbian, slovak, slovenian, spanish, swedish, swissgerm
            an, tamil, telugu, turkish, turkmen, ukenglish, ukrainian, uppersorbian, usengl
            ishmax, welsh, loaded.
            ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\article.cls"
            Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
            ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\size12.clo"))
            ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\inputenc.sty"
            ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\latin1.def"))
            ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsmath\amsmath.sty"
            For additional information on amsmath, use the `?' option.
            ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsmath\amstext.sty"
            ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsmath\amsgen.sty"))
            ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsmath\amsbsy.sty")
            ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsmath\amsopn.sty"))
            ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsfonts\amsfonts.sty")
            ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsfonts\amssymb.sty")
            ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\latexsym.sty")
            (C:\xampp\data\26_integration_53_PostgreSQL\temp\latex\9608176195573c30c6beb3cf
            078fdf66.aux) ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsfonts\umsa.fd")
            ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsfonts\umsb.fd")
            ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\ulasy.fd") [1]
            (C:\xampp\data\26_integration_53_PostgreSQL\temp\latex\9608176195573c30c6beb3cf
            078fdf66.aux) )
            Output written on 9608176195573c30c6beb3cf078fdf66.dvi (1 page, 496 bytes).
            Transcript written on 9608176195573c30c6beb3cf078fdf66.log.
            RETURN CODE: 0
             
            $ "C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\dvips.exe" -E C:\xampp\data\26_integration_53_PostgreSQL/temp/latex/9608176195573c30c6beb3cf078fdf66.dvi -o C:\xampp\data\26_integration_53_PostgreSQL/temp/latex/9608176195573c30c6beb3cf078fdf66.ps
            OUTPUT: 
            RETURN CODE: 0
             
            $ "C:\Program Files\ImageMagick-6.8.9-Q16\convert.exe" -density 240 -trim C:\xampp\data\26_integration_53_PostgreSQL/temp/latex/9608176195573c30c6beb3cf078fdf66.ps C:\xampp\data\26_integration_53_PostgreSQL/temp/latex/9608176195573c30c6beb3cf078fdf66.gif 
            OUTPUT: 
            RETURN CODE: 0
            

            I noted that this was working with the provided MimeTeX binary and with the MathJax filter.

            Show
            salvetore Michael de Raadt added a comment - I tested this on 2.6 under PHP 5.3 and Master with PHP 5.5. The admin settings were testing the location of the required binaries and stripping quotes. However, when I went to use the TeX filter, it did not convert the equation to an image. Here is the output from the debugging page... Checking executables latex executable (C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\latex.exe) is readable dvips executable (C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\dvips.exe) is readable convert executable (C:\Program Files\ImageMagick-6.8.9-Q16\convert.exe) is readable   base filename for expression is '9608176195573c30c6beb3cf078fdf66'   Processing TeX expression:   f(x)=\int_{-\infty}^x~e^{-t^2}dt   $ "C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\latex.exe" --interaction=nonstopmode --halt-on-error C:\xampp\data\26_integration_53_PostgreSQL/temp/latex/9608176195573c30c6beb3cf078fdf66.tex OUTPUT: This is pdfTeX, Version 3.1415926-2.5-1.40.14 (MiKTeX 2.9) entering extended mode   (C:/xampp/data/26_integration_53_PostgreSQL/temp/latex/9608176195573c30c6beb3cf 078fdf66.tex LaTeX2e <2011/06/27> Babel and hyphenation patterns for english, afrikaans, ancientgreek, ar abic, armenian, assamese, basque, bengali, bokmal, bulgarian, catalan, coptic, croatian, czech, danish, dutch, esperanto, estonian, farsi, finnish, french, ga lician, german, german-x-2013-05-26, greek, gujarati, hindi, hungarian, iceland ic, indonesian, interlingua, irish, italian, kannada, kurmanji, latin, latvian, lithuanian, malayalam, marathi, mongolian, mongolianlmc, monogreek, ngerman, n german-x-2013-05-26, nynorsk, oriya, panjabi, pinyin, polish, portuguese, roman ian, russian, sanskrit, serbian, slovak, slovenian, spanish, swedish, swissgerm an, tamil, telugu, turkish, turkmen, ukenglish, ukrainian, uppersorbian, usengl ishmax, welsh, loaded. ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\article.cls" Document Class: article 2007/10/19 v1.4h Standard LaTeX document class ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\size12.clo")) ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\inputenc.sty" ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\latin1.def")) ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsmath\amsmath.sty" For additional information on amsmath, use the `?' option. ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsmath\amstext.sty" ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsmath\amsgen.sty")) ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsmath\amsbsy.sty") ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsmath\amsopn.sty")) ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsfonts\amsfonts.sty") ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsfonts\amssymb.sty") ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\latexsym.sty") (C:\xampp\data\26_integration_53_PostgreSQL\temp\latex\9608176195573c30c6beb3cf 078fdf66.aux) ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsfonts\umsa.fd") ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\amsfonts\umsb.fd") ("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\ulasy.fd") [1] (C:\xampp\data\26_integration_53_PostgreSQL\temp\latex\9608176195573c30c6beb3cf 078fdf66.aux) ) Output written on 9608176195573c30c6beb3cf078fdf66.dvi (1 page, 496 bytes). Transcript written on 9608176195573c30c6beb3cf078fdf66.log. RETURN CODE: 0   $ "C:\Program Files (x86)\MiKTeX 2.9\miktex\bin\dvips.exe" -E C:\xampp\data\26_integration_53_PostgreSQL/temp/latex/9608176195573c30c6beb3cf078fdf66.dvi -o C:\xampp\data\26_integration_53_PostgreSQL/temp/latex/9608176195573c30c6beb3cf078fdf66.ps OUTPUT: RETURN CODE: 0   $ "C:\Program Files\ImageMagick-6.8.9-Q16\convert.exe" -density 240 -trim C:\xampp\data\26_integration_53_PostgreSQL/temp/latex/9608176195573c30c6beb3cf078fdf66.ps C:\xampp\data\26_integration_53_PostgreSQL/temp/latex/9608176195573c30c6beb3cf078fdf66.gif OUTPUT: RETURN CODE: 0 I noted that this was working with the provided MimeTeX binary and with the MathJax filter.
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Hi,

            we are reverting this change and reopening the issue. It would be great if can be tidied to avoid the present warnings and also, get it working/passing the tests.

            Thanks for the effort! Ciao

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Hi, we are reverting this change and reopening the issue. It would be great if can be tidied to avoid the present warnings and also, get it working/passing the tests. Thanks for the effort! Ciao
            Hide
            cibot CiBoT added a comment -

            Moving this reopened issue out from current integration. Please, re-submit it for integration once ready.

            Show
            cibot CiBoT added a comment - Moving this reopened issue out from current integration. Please, re-submit it for integration once ready.
            Hide
            dthies Daniel Thies added a comment -

            Michael, thank you for catching the the error in 2.6 reported from setup.php. The other two branches do not seem to have the same issue because the configuration is different.
            I have not been able to reproduce your result. I am not sure, yet whether this is related to the other problem. I have not reproduced it yet. The texdebug output you include seems to show that all paths valid and commands, are executing and writing an image without errors. So I would conclude that texdebug would also produce and image for you although the filter might not. Did you try both GIF and PNG? GIF output looks a lot like mimetex sometimes. I will be travelling for about a week and have limited access to test platforms, but I will try to see if I can get it resolved soon.

            Show
            dthies Daniel Thies added a comment - Michael, thank you for catching the the error in 2.6 reported from setup.php. The other two branches do not seem to have the same issue because the configuration is different. I have not been able to reproduce your result. I am not sure, yet whether this is related to the other problem. I have not reproduced it yet. The texdebug output you include seems to show that all paths valid and commands, are executing and writing an image without errors. So I would conclude that texdebug would also produce and image for you although the filter might not. Did you try both GIF and PNG? GIF output looks a lot like mimetex sometimes. I will be travelling for about a week and have limited access to test platforms, but I will try to see if I can get it resolved soon.
            Hide
            salvetore Michael de Raadt added a comment -

            Hi, Daniel.

            Yes, it's quite likely that the generation issue was due to my setup, rather than bugs. I tested using the default GIF format and didn't test with PNG. At least I know the equation was valid as it rendered with the MimeTex fallback and MathJax filter. The only thing I could see that was odd about the error report was that the paths contained slashes that went both ways; while PHP usually handles that, perhaps the ImageMagick program could not.

            The result with the Latex and associated applications was a link to the error report instead of an image. I do recall having the Latex solution working once before a while back. If you can think of any setup issues I might try tweaking, let me know.

            Show
            salvetore Michael de Raadt added a comment - Hi, Daniel. Yes, it's quite likely that the generation issue was due to my setup, rather than bugs. I tested using the default GIF format and didn't test with PNG. At least I know the equation was valid as it rendered with the MimeTex fallback and MathJax filter. The only thing I could see that was odd about the error report was that the paths contained slashes that went both ways; while PHP usually handles that, perhaps the ImageMagick program could not. The result with the Latex and associated applications was a link to the error report instead of an image. I do recall having the Latex solution working once before a while back. If you can think of any setup issues I might try tweaking, let me know.
            Hide
            dthies Daniel Thies added a comment -

            Thank you Micahel,
            I found an incosistency in the latex.php file, and made a fix based on your texdebug output above. It appears texdebug was working, but latex.php had a regression. I uploaded a correction if you want to test it. I will rebase it and push it again soon.

            Show
            dthies Daniel Thies added a comment - Thank you Micahel, I found an incosistency in the latex.php file, and made a fix based on your texdebug output above. It appears texdebug was working, but latex.php had a regression. I uploaded a correction if you want to test it. I will rebase it and push it again soon.
            Hide
            dthies Daniel Thies added a comment -

            Patched to fix problems Michael found. First affects 2.6 settings file only. The other is a small change to latex.php (braces removed from command lines). Rebased for current weekly.

            Show
            dthies Daniel Thies added a comment - Patched to fix problems Michael found. First affects 2.6 settings file only. The other is a small change to latex.php (braces removed from command lines). Rebased for current weekly.
            Show
            cibot CiBoT added a comment - Results for MDL-45044 Remote repository: https://github.com/dthies/moodle Remote branch MDL-45044 -m26-master to be integrated into upstream MOODLE_26_STABLE Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/4335 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/4335/artifact/work/smurf.html Remote branch MDL-45044 -m27-master to be integrated into upstream MOODLE_27_STABLE Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/4336 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/4336/artifact/work/smurf.html Remote branch MDL-45044 -master to be integrated into upstream master Executed job http://integration.moodle.org/job/Precheck%20remote%20branch/4337 Details: http://integration.moodle.org/job/Precheck%20remote%20branch/4337/artifact/work/smurf.html
            Hide
            salvetore Michael de Raadt added a comment -

            Hi, Daniel.

            That is working for me now with those changes. LaTeX on Windows is a bitch.

            Damyon Wiese: I'll leave this for you to push to integration again.

            Show
            salvetore Michael de Raadt added a comment - Hi, Daniel. That is working for me now with those changes. LaTeX on Windows is a bitch. Damyon Wiese : I'll leave this for you to push to integration again.
            Hide
            damyon Damyon Wiese added a comment -

            Looks good to me - sending for integration again.

            Thanks!

            Show
            damyon Damyon Wiese added a comment - Looks good to me - sending for integration again. Thanks!
            Hide
            dthies Daniel Thies added a comment -

            Rebased and conflicts due to MDL-44925 are corrected

            Show
            dthies Daniel Thies added a comment - Rebased and conflicts due to MDL-44925 are corrected
            Hide
            cibot CiBoT added a comment -
            Show
            cibot CiBoT added a comment - Fails against automated checks. Checked MDL-45044 using repository: https://github.com/dthies/moodle MOODLE_26_STABLE (branch: MDL-45044-m26-master | CI Job ) Coding style problems found MOODLE_27_STABLE (branch: MDL-45044-m27-master | CI Job ) Coding style problems found master (branch: MDL-45044-master | CI Job ) Coding style problems found More information about this report
            Hide
            cibot CiBoT added a comment -

            Moving this issue to current integration cycle, will be reviewed soon. Thanks for the hard work!

            Show
            cibot CiBoT added a comment - Moving this issue to current integration cycle, will be reviewed soon. Thanks for the hard work!
            Hide
            samhemelryk Sam Hemelryk added a comment -

            Thanks Daniel - this has been integrated now.

            Show
            samhemelryk Sam Hemelryk added a comment - Thanks Daniel - this has been integrated now.
            Hide
            salvetore Michael de Raadt added a comment -

            Test result: Success!

            Tested in master, 2.7 and 2.6. Tested with PHP 5.4 and 5.3 (for 2.6).

            Works nicely. Thanks Daniel.

            Show
            salvetore Michael de Raadt added a comment - Test result: Success! Tested in master, 2.7 and 2.6. Tested with PHP 5.4 and 5.3 (for 2.6). Works nicely. Thanks Daniel.
            Hide
            poltawski Dan Poltawski added a comment -

            Thanks for your contribution - this change is now part of Moodle!

            True knowledge exists in knowing that you know nothing.
            – Socrates

            Show
            poltawski Dan Poltawski added a comment - Thanks for your contribution - this change is now part of Moodle! True knowledge exists in knowing that you know nothing. – Socrates

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  8/Sep/14