Perforce Public Knowledge Base - Case Sensitivity
× PRODUCTS SOLUTIONS CUSTOMERS LEARN SUPPORT
Downloads Company Partners Careers Contact Free Trials
Menu Search
Perforce
Reset Search
 

 

Article

Case Sensitivity

« Go Back

Information

 
Problem

This article summarizes how Perforce handles case sensitivity. Suggestions are offered on how to avoid case problems, and how to fix them if they occur.

Solution

Background

When a file is added to the Perforce depot using p4 add, an archive file is written underneath the Perforce Server root (for example, "$P4ROOT/depot/main/file1,v"). A corresponding meta-data entry for that file version is written to the Perforce database files (for example, $P4ROOT/db.rev). New archive files (and meta-data entries) can also be added to the Perforce depot using the p4 integrate command. When using Perforce across platforms with different case handling conventions, differences in case might arise between the Perforce meta-data and the Perforce archive files.

Case Sensitive Behavior

The Perforce Server on UNIX supports case-sensitive names. The Perforce server on Windows ignores case differences. The Perforce server on Darwin is case-insensitive. Case is always ignored in job keyword searches. To summarize:

String Type

Case Sensitive on
UNIX server?

Case Sensitive on
Windows server?

Pathnames and filenamesYesNo
Database entities (clients, labels, etc.)YesNo
job search keywordsNoNo

To determine your Perforce Server platform, run p4 info.

Server and Client Interaction Summary

The following section describes case handling behavior on the various combinations of Perforce clients and servers:

 

  • UNIX server + UNIX clients

    No problem -- Case of the Perforce meta-data and archive files are always consistent.

  • Windows server + Windows clients

    No problem -- Case differences can exist between meta-data and archives files, however, these differences are ignored.

  • UNIX server + Windows clients

    Potential problem -- The Perforce Server on UNIX (and the UNIX file system) can store case-variant files; the Windows file system cannot store case-variant files.

  • Windows server + UNIX clients

    Potential problem -- The Perforce Server on Windows can maintain case-variant meta-data. As a result, files that exist in one directory on a Windows-based Perforce Server might appear as two or more case-variant directories in a UNIX-based Perforce client workspace.

Server and Client Interaction Details

  • UNIX server + Windows clients

    If your Perforce Server is on UNIX, and you have users on both UNIX and Windows, your UNIX users must be careful not to submit files whose names differ only by case. Although the UNIX server can support these files, when Windows users sync such files to their client workspaces, the case variant files and directories will overwrite each other.

    For example, a file that exists in two case variant directories on a UNIX-based Perforce Server: "main/file1" and "MAIN/file1". The following commands, when issued from a UNIX-based Perforce client will, as expected, sync two different files to two different case-variant directories:

    p4 sync MAIN/file1
    
    
    p4 sync main/file1

    However, when these same commands are issued from a Perforce client on Windows, the two different files will be synced to the same client workspace directory and the last p4 sync operation overwrites the first.

    In addition to file storage, case affects Perforce client entities. The UNIX Perforce Server always respects case in user, workspace, branch, and label names. Windows users connecting to a UNIX server must note that lowercased workstation names are used as the default names for new client workspaces. For example, if a new user creates a workspace specification on a workstation named "ROCKET", their client workspace will be named "rocket" by default. If they later set P4CLIENT to "ROCKET" or "Rocket", Perforce will tell them their client is undefined. They must set P4CLIENT to "rocket" to use the client workspace he defined.

  • Windows server + UNIX clients revisited

    If your Perforce Server is on Windows, your UNIX users must note that their Perforce Server stores case-variant files in the same archive name space. For example, if you issue the following commands from a UNIX client workspace:

    p4 add dev/file1
    
    
    p4 add DEV/file2

    Both files are stored in the same depot directory on the Windows server, with the entire path normalised to lower case. In this example, the depot path name stored on the file system is "dev". However, the Perforce meta-data retains the case of path and file names as entered at the command line. Because the Perforce Server tracks the file locations based on meta-data entries, UNIX-based clients see these files in different local workspace directories, based on the case-variance in the meta-data.

    Windows users must be careful to use case consistently in file and path names when they add new files. Files added as "//depot/main/foo.c" and "//depot/MAIN/bar.c" will appear in two different directories in a UNIX user's workspace. Although the file is stored in only one case in the Perforce server archive on Windows, the Perforce meta-data retains the case of files and paths as originally added. The actual case of directory paths might vary based on how those path names were input at the command line or how the paths were picked up by the OS if you use drag-and-drop operations.

One way to enforce the input of consistent path names is with a pre-submit trigger. To learn more about triggers, and to see examples please refer to the: Perforce Admin Guide: Chapter 6 and the Debugging Triggers KB article

Migrating from Windows to UNIX

Migrating from Windows to UNIX requires special care due to the difference in case conventions between these platforms. See Cross-Platform Perforce Server Migration for more information on cross-platform server migration.

Case Handling in P4V for Windows

When using P4V for Windows, it is possible that the username in different cases prevents a user from performing certain operations, such as deleting a client. Users should log into P4V using their exact username (including cases).

For example, if your P4 username is "Ray", and you login as "ray" while starting P4V, you cannot delete your clients because the "Delete workspace" menu item is greyed out. Unless you login as "Ray" you cannot make the menu item available.

History

Early (97.2 and earlier) releases of the Perforce Server treated all file names, path names, and database entity names with case significance, whether the server was running on UNIX or Windows. For example:

//depot/main/foo.c

and

//depot/MAIN/foo.c

...were treated as two completely different files. This approach caused problems at sites where users on UNIX were connecting to a Perforce Server on Windows, because the file system underlying the server could not store files with case-variant names submitted by UNIX users. If you are running a pre-97.2 server on Windows, please contact support@perforce.com to discuss upgrading your server and database.

As of Release 97.3, only the UNIX server supports case-sensitive names. However, as outlined above, there are still some case-sensitivity problems users might run into when sharing development projects across UNIX and Windows.

As of Release 2000.1, all archive files are lowercased on Windows-based Perforce Servers. This change was made to assist in migration to UNIX servers, if the need arises. Migration from Windows to UNIX exposes case differences. Here, running p4 verify after the cross platform move is an essential step for detecting case problems.

See Moving a Perforce Server for more information on migrating your Perforce Server.

Custom File System Configurations

It is possible to use a file system with non-native (case insensitive) case handling behaviour on Linux, for example the ciopfs file system, but this behavior is not recommend when using Perforce Clients. These non-native environments are untested with Perforce, and subsequently might return unexpected results.

For any questions or concerns about case-handling please contact Perforce Technical Support at support@perforce.com

Related Links

Feedback

 

Was this article helpful?


   

Feedback

Please tell us how we can make this article more useful.

Characters Remaining: 255