Thanatos
Thanatos

Reputation: 44246

Perforce "Locked client" error

I'm new to Perforce, and it is not going well at all. But currently, I am completely stuck, as all I can get it to say is:

$ p4 open a_code_file.cpp
Locked client 'my_hostname' can only be used by owner 'perforce'.

I have absolutely no idea what I did to upset it, and the error message itself is meaningless gibberish to me. "perforce" doesn't own anything - all the files are owned by me. I am in a Perforce repository, ie, there's a .p4rc a few directories up.


Edit: It only seems to be some files. If I:

$ cd some_other_directory_in_the_repo
$ p4 open a_file

... it works. So it's only some things...

Upvotes: 2

Views: 6943

Answers (2)

BareMetalCoder
BareMetalCoder

Reputation: 629

I ran into this when I was distracted and forgot to export my P4CLIENT variable, i.e.:

P4CLIENT=XXXXX

Instead of:

export P4CLIENT=XXXXX

Upvotes: 0

Commodore Jaeger
Commodore Jaeger

Reputation: 33350

The "locked client" error suggests that p4 is trying to use a client workspace, named after your hostname, owned by the user perforce. If Perforce can't find a valid client name, either in the registry (on Windows), environment variables, or in an environment file, it'll default to using a client workspace named after your hostname.

It sounds like Perforce can't find a valid client workspace for your "broken" directory, and finds one for your "working" directory.

Since you have one directory that works, and one directory that doesn't, can you try:

$ p4 set

from both directories, and compare the results? If Perforce can find a valid client, you'll see something like:

P4CLIENT=XXXX (config)

(the "(config)" means Perforce is getting that configuration variable from a configuration file. Consult p4 help set for more information on the various ways you can set variables.)

Look also for a line like:

P4CONFIG=.p4env

which is what Perforce will use to search for your workspace configuration. If you're using a file named .p4rc, that's what P4CONFIG should be set to.

Upvotes: 2

Related Questions