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):
abcdef
ghi
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.
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:
transparent text mode. In a view created in transparent text mode, ClearCase does no line-terminator processing. If no other site default is specified, views are created in transparent text mode by default. To create a view in transparent text mode regardless of the site default, clear the Use interop (insert_cr) text mode check box in the Advanced options of the View Creation Wizard, or use the -tmode transparent option to the mkview command. (Previous editions of ClearCase documentation and interfaces refer to this mode as unix text mode.)
If all developers at your site use the same development platform (Windows or UNIX) or use tools that are compatible with either line-termination convention, all views should be created in transparent text mode.
insert_cr text mode. In a view created in insert_cr text mode, ClearCase inserts a <CR> character before every <LF> character. To create a view in insert_cr text mode, select the Use interop (insert_cr) text mode check box in the Advanced options of the View Creation Wizard or use the -tmode insert_cr option to the mkview command. (Previous editions of ClearCase documentation and interfaces refer to this as interop text mode or msdos text mode.)
strip_cr text mode. In a view created in strip_cr text mode, ClearCase strips the <CR> character from every <CR><LF> sequence. To create a view in strip_cr text mode, use the -tmode strip_cr options to the mkview command. You cannot create a view in strip_cr mode from the View Creation Wizard.
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.
If you do not know a view's text mode, you can find out in one of the following ways:
In Windows Explorer, right-click a drive that represents a view. Then click ClearCase > Properties of View. The view's text mode is displayed on the Access tab.
Use the cleartool lsview command with the -properties -full options.
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
.
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:
UNIX clients should use views created in transparent text mode.
Windows clients should use views created in insert_cr text mode.
If most of your users are developing software on Windows:
Windows clients should use views created in transparent text mode.
UNIX clients should use views created in strip_cr text mode.
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.
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:
For all versions of all file elements whose element type is text_file or a subtype of type text_file, generates and stores in the VOB database the information required to support access to these versions by views created in strip_cr or insert_cr text modes.
Turns on interop text mode support, so that this information can be recorded for newly created versions.
With the -d option, msdostext_mode disables support for 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
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:
Synchronize all VOB replicas.
Lock all replicas, using this command:
cleartool lock -nuser root vob:pname-in-vob
Run msdostext_mode on all replica storage directories.
Unlock all replicas.
Feedback on the documentation in this site? We welcome any comments!
Copyright © 2001 by Rational Software Corporation. All rights reserved. |