IBM Support

Evaluating multiple magic files

Question & Answer


Question

How does IBM Rational ClearCase look for a magic file and what happens if there are multiple copies on a host?

Answer


Only ONE magic file can be used per host.
The first magic file discovered by ClearCase is the one that will be used.
So what happens when there are multiple magic files on the host?
How does ClearCase choose which one to use?
  1. ClearCase searches for magic files in specific locations in a specific order

  2. ClearCase selects the magic file based on its filename.

SEARCH ORDER

  1. Magic files are first searched for in the location specified by the environment variable MAGIC_PATH. This variable overrides the search path described below.

  2. If the MAGIC_PATH variable is not set, ClearCase next searches for a magic file in your HOME directory, (as defined by the environment variable HOME) for a .magic file.

  3. If there is no magic file in your HOME directory, ClearCase next searches in the ClearCase install directory (often defined by the environment variable CLEARCASEHOME). There is a config directory and a magic directory. The default magic file (default.magic) is located here; however, any other file ending in .magic will be examined by ClearCase as well.

    Example:

    Microsoft Windows:  C:\Program Files\Rational\ClearCase\config\magic

    In ClearCase version 7.1 and later on Windows the default path is C:\Program Files\IBM\RationalSDLC\ClearCase\config\magic


    UNIX and Linux:  /opt/rational/clearcase/config/magic


MAGIC FILE EVALUATION

Within a given directory, all files with a .magic suffix are read in ASCII alphabetical order. This means for example capital Z comes after capital W, but before lower-case a.

So when more than one magic file exists in the defined or default Magic Path location, the various magic files are evaluated first by filename.

Example:

If the following 3 magic files are found by ClearCase, only one will be evaluated for use. Which one?

c.magic
b.magic
a.magic


Answer: a.magic will be evaluated first. This is because the filename a.magic is alphabetically first in the ClearCase search order. If a match is not found in a.magic, the search will continue and b.magic will be evaluated next.


Scenario:

The default magic file name on Windows, UNIX and Linux is default.magic.

If this magic file was to be modified, good practice dictates that a back-up copy of the file be created before proceeding. If you name the backup copy of the magic file to copy.default.magic (for example) and you keep it stored in the same location as the default.magic file, the changes in the default.magic file would not be evaluated. Why?

Answer: The changes made to the default.magic file would not be evaluated as ClearCase will first evaluate the filename copy.default.magic (as C comes before D).

The following solution will help to avoid conflict or confusion with respect to multiple magic files:

  1. Store only one copy of the "active" magic file in one of the designated magic paths (identified above).
  2. Make sure the naming convention used for your magic files is such that the "active" copy you need to use has its name evaluated first (alphabetically).

[{"Product":{"code":"SSSH27","label":"Rational ClearCase"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Magic File","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF015","label":"IRIX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"2003.06.00;2003.06.16;7.0;7.0.0.1;7.0.0.2;7.0.0.3;7.0.0.4;7.0.0.5;7.0.0.6;7.0.0.7;7.0.0.8;7.0.1;7.0.1.1;7.0.1.2;7.0.1.3;7.0.1.4;7.0.1.5;7.0.1.6;7.0.1.7;7.1;7.1.0.1;7.1.0.2;7.1.1","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SSSH27","label":"Rational ClearCase"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Magic File","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
16 June 2018

UID

swg21219216