7.6 Configuring Text Modes for Views

UNIX and Windows observe different conventions for terminating lines in text files. UNIX systems normally terminate lines with a single <LF> (line feed, or new line) character and Windows systems terminate lines with a two-character <CR><LF> (carriage return, line feed) character sequence. Some Windows applications can read and display files in either format, some Windows applications always write files using <CR><LF> format, and some Windows applications can be configured to determine which format to use.

As a result of these differing conventions, line-termination problems are a typical result of the use of text editors on files that must be edited on both UNIX and Windows platforms. For example, a file that contains:

abc
def
ghi

would look like this if it were created by a typical Windows editor and read by a typical UNIX editor (for example, vi):

abc^M
def^M
ghi^M

The UNIX text editor renders the <CR> character as ^M. The same file would look like this if it were created by a typical UNIX editor and read by a typical Windows editor (for example, Notepad):

abcdefghi

To better support parallel development in mixed operating system environments, ClearCase provides a text mode setting for views that controls how line terminators are handled when text files are presented to applications.

Text Modes

Each view has a text mode setting that specifies how it handles line terminator sequences. This setting only applies to file elements whose element type is text_file or a subtype of type text_file. You determine a view's text mode when you create the view. You cannot change the text mode of a view after the view has been created.

A site configuration parameter in the ClearCase registry determines the default text mode for view creation. For details, see the reference page for the setsite command.

You can create a view in any of three text modes:

In a snapshot view created in either insert_cr or strip_cr text mode, ClearCase adds or removes the <CR> characters whenever it updates the view. In a dynamic view, ClearCase adds or removes the <CR> characters as you open and read files. For both snapshot views and dynamic views, ClearCase reverses the <CR> manipulation (adding or removing <CR> characters as appropriate) during the checkin process.

NOTE: you cannot create a view in strip_cr mode from any GUI.

Determining a View's Text Modecontents@cc_inter.hlp">

If you do not know a view's text mode, you can find out in one of the following ways:

With these methods, transparent text mode is displayed as unix, strip_cr text mode is displayed as strip_cr, and insert_cr text mode is displayed as msdos.

Choosing a Text Mode for a View

ClearCase does not enforce any policy governing access to VOBs based on a view's text mode, and a user editing a file in a view that has the "wrong" text mode configuration can cause problems for other users who need to edit that file. Most sites with both Windows and UNIX development platforms should adopt a policy that allows users of the primary development platform to create views in transparent text mode and that limits the use of strip_cr or insert_cr text modes to the minority of platforms that require different line-termination conventions.

If most of your users are developing software on UNIX:

If most of your users are developing software on Windows:

No matter what policy you adopt, it is important to maintain a consistent combination of client platform, view text mode, and VOB. If a client uses a view in an interop text mode (strip_cr or insert_cr) to access a VOB, then later begins using a view in transparent text mode to access the same VOB, versions created by the views in different text modes will be difficult to compare or merge.

Enabling Interop Text Mode Support in VOBs

VOBs created with ClearCase version 4.1 or later are compatible with views in any text mode. VOBs created with earlier versions of ClearCase are compatible only with views in transparent text mode until you run the msdostext_mode command on the VOB. Previous editions of ClearCase documentation and interfaces refer to VOBs on which msdostext_mode has been run as interop-enabled VOBs. Beginning with version 4.1, we further generalize this by saying the msdostext_mode enables VOBs to support access from views in either transparent or interop text modes.

If you need to enable interop text mode support in a VOB created by an earlier version of ClearCase, use the msdostext_mode command. Note that msdostext_mode does not convert or modify files in any way. It affects only the information recorded for text file versions in the VOB database.

Only the VOB owner the privileged user can run msdostext_mode. The command syntax is

ccase-home-dir/etc/utils/msdostext_mode [ -d ] vob-storage-pname

With no options, msdostext_mode does the following:

With the -d option, msdostext_mode disables support for interop text modes.

Determining Whether a VOB Supports Interop Text Modes

To determine whether a entire VOB supports interop text modes, use the following command on either UNIX or Windows:

cleartool dump vob:vob-tag

If the flags line in the output contains the string pc_line_count, the VOB supports interop text modes.

For example, to determine whether the VOB \pc_src supports interop text modes:

cleartool dump vob:\pc_src

If the output of this command contains a line similar to the following, the VOB supports interop text modes.

flags: predefined, pc_line_count, unrestricted

Special Procedure for MultiSite Users

ClearCase MultiSite does not replicate a VOB's text mode support characteristics. If any replica in a VOB family has been enabled for interop text mode support, all replicas in that VOB family must be individually enabled at their local sites using msdostext_mode as follows:

  1. Synchronize all VOB replicas.

  2. Lock all replicas, using this command:

  3. cleartool lock -nuser root vob:pname-in-vob

  4. Run msdostext_mode on all replica storage directories.

  5. Unlock all replicas.