Jacob Ritchie
Jacob Ritchie

Reputation: 1401

Why can Perforce not set environment variables on Linux?

I was trying to follow the steps in this post on the Perforce website to set up a P4IGNORE file.

On Linux, running

p4 set P4IGNORE=.ignore

resulted in the following error message:

Perforce client warning:
    Can't set registry on UNIX.

Reading the help entry for p4 set, it seems that it can only be used to set Perforce variables on Windows and Mac OS X. On Linux, I had to use native shell commands, i.e.

export P4IGNORE=.ignore

My question is - why does the p4 set command not work on Linux, when it is implemented for both Windows and OS X (which is also Unix-based)?

Upvotes: 2

Views: 7509

Answers (2)

Samwise
Samwise

Reputation: 71562

Upgrade to the latest version of the p4 CLI (or at least version 2014.2):

Major new functionality in 2014.2

    Other platforms, such as Linux, will now set an environment
    file.  The environment file is available on all platforms
    if a P4ENVIRO environment variable is set to a file path.
    P4ENVIRO will default to a file '.p4enviro' in the user's
    home directory for systems which do not have system provided
    facilities.  The p4 enviro file can be shared across platforms.
    The 'p4 set' command can be used to manipulate or inspect
    this new environment facility.  Note that these special
    'P4_<p4port>_CHARSET' values will only appear in 'p4 set'
    output for the specified or current P4PORT value.
    For instance 'p4 -p perforce:4666 set' will report on
    'P4_perforce:4666_CHARSET' if it is set.

http://www.perforce.com/perforce/doc.current/user/relnotes.txt

Upvotes: 3

Barmar
Barmar

Reputation: 782498

On Windows, p4 set updates the Registry. On OS X, p4 set updates a User Preferences file.

There is no registry or preferences on Linux, so environment variables are used there for defaults. It's not possible for p4 set to update a parent shell's environment variables, let alone make them permanent. You need to edit one of your shell startup files to set the environment variables.

Upvotes: 3

Related Questions