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

oci_native_moodle_package.sql must never have windows line endings

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2.4, 3.3.1, 3.4
    • Fix Version/s: 3.3.4, 3.4.1
    • Component/s: Libraries
    • Labels:
    • Environment:
      Moodle on Windows, git with auto crlf set to on.

      Oracle database
    • Database:
      Oracle
    • Testing Instructions:
      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
    • Workaround:
      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
    • Affected Branches:
      MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE, MOODLE_34_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      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

              Assignee:
              nmagill Neill Magill
              Reporter:
              nmagill Neill Magill
              Peer reviewer:
              Mark Nelson
              Integrator:
              Damyon Wiese
              Tester:
              Jun Pataleta
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                15/Jan/18