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

oci_native_moodle_package.sql must never have windows line endings

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.2.4, 3.3.1, 3.4
    • 3.3.4, 3.4.1
    • Libraries
    • Moodle on Windows, git with auto crlf set to on.

      Oracle database
    • Oracle
    • MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE
    • MOODLE_33_STABLE, MOODLE_34_STABLE
      1. Configure git to not automatically change line endings
      2. Copy a version of lib/dml/oci_native_moodle_package.sql from a release zip file before the initial installation on Oracle
    • Hide

      Requirements:

      • Windows OS
      • Git set to auto change line endings (core.autocrlf needs to be set to true)

      Test:

      1. Check out Moodle
      2. Use the Moodle docker image to create an Oracle based environment (https://github.com/moodlehq/moodle-docker)
      3. Now ensure that a Moodle test environment installs: 

        bin/moodle-docker-compose exec webserver php admin/tool/behat/cli/init.php

      1. If the database installs then this change has worked.

      Staring the docker environment:

      If using Docker toolbox (rather than native docker) you will need to run the commands provided by:

      docker-machine env

      You will need to run:

      SET MOODLE_DOCKER_DB=oracle
      SET MOODLE_DOCKER_WWWROOT=path/to/moodle
      bin\moodle-docker-compose up -d

      Show
      Requirements: Windows OS Git set to auto change line endings (core.autocrlf needs to be set to true) Test: Check out Moodle Use the Moodle docker image to create an Oracle based environment ( https://github.com/moodlehq/moodle-docker ) Now ensure that a Moodle test environment installs:  bin/moodle-docker-compose exec webserver php admin/tool/behat/cli/init.php If the database installs then this change has worked. Staring the docker environment: If using Docker toolbox (rather than native docker) you will need to run the commands provided by: docker-machine env You will need to run: SET MOODLE_DOCKER_DB=oracle SET MOODLE_DOCKER_WWWROOT=path/to/moodle bin\moodle-docker-compose up -d

    Description

      Git can be configured to auto convert line endings of files in Moodle.

      This is useful on Windows as:

      • many editors default to using crlf, rather than just lf
      • it ensures that the code put into repositories when submitting patches only contain Unix line endings

      however with this configured to be on the lib/dml/oci_native_moodle_package.sql file also has it's line endings changed.

      When there are Windows line endings in the file Moodle will not split it into it's separate queries correctly, which results in Moodle not creating the MOODLELIB package correctly on Oracle when it first connects.

      It is possible to force the file to always have Unix line endings via the .gitattributes file file using:

      lib/dml/oci_native_moodle_package.sql text eol=lf

      This will ensure that the file will always function correctly no matter a user's git settings.

      For reference see: https://help.github.com/articles/dealing-with-line-endings/

      Attachments

        Issue Links

          Activity

            People

              nmagill Neill Magill
              nmagill Neill Magill
              Mark Nelson Mark Nelson
              Damyon Wiese Damyon Wiese
              Jun Pataleta Jun Pataleta
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                15/Jan/18