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

Allow spaces in path to gs in PDF assignment plugin

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.6
    • Fix Version/s: 2.6.1
    • Component/s: Assignment
    • Labels:
    • Testing Instructions:
      Hide
      1. Install moodle on windows (sorry)
      2. Install ghostscript on windows (in a folder with spaces in the name) (sorry)
      3. Set the ghostscript path for the Annotate PDF assignment feedback plugin
      4. Check the test ghostscript image displays.
      5. Retest on a sane OS
      Show
      Install moodle on windows (sorry) Install ghostscript on windows (in a folder with spaces in the name) (sorry) Set the ghostscript path for the Annotate PDF assignment feedback plugin Check the test ghostscript image displays. Retest on a sane OS
    • Affected Branches:
      MOODLE_26_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-43074-master

      Description

      I have seen comment about not allowing spaces in path to gs in new PDF annotate feedback plugin (which is normal on Windows, making Moodle less cross-platform). This can easily be avoided adding a string

      $gsexec = escapeshellarg($gsexec);

      before adding $gsexec to the $command.

      We have similar problems running dot utility. You may see our code in https://code.google.com/p/oasychev-moodle-plugins/source/browse/question/type/preg/preg_regex_handler.php#497 and it stable works for both Linux and Windows with spaces in path or without them.

      P.S. Our code used proc_open() instead of system to avoid file system at all, generating files on the fly and sending it to the user right away, you may wish to adopt this part of solution.

      P.P.S. In https://moodle.org/mod/forum/discuss.php?d=244439 Davo Smith wrote "The only slight query I have is that I thought escapeshellarg was meant to be for arguments, not the path to the executable" - it is well known fact that Operating System traditionally treats executable name as command line argument with zero index.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                13/Jan/14