Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vscode-perforce fails when using a "personal (local) server" #169

Open
jdputsch opened this issue Aug 26, 2019 · 3 comments
Open

vscode-perforce fails when using a "personal (local) server" #169

jdputsch opened this issue Aug 26, 2019 · 3 comments

Comments

@jdputsch
Copy link

When using a "personal (local) server", vscode-perforce generates incorrect "p4" command lines.

To reproduce:
Personal servers may be created via one of these methods:

  • p4 init
  • p4 clone
  • Using p4v and creating a Personal Sever

In workspace using a personal server, the .p4config file contains a P4PORT entry that looks like these:
Windows: P4PORT=rsh:p4d.exe -i -J off -r "$configdir\.p4root"
Linux: P4PORT=rsh:/bin/sh -c "umask 077 && exec p4d -i -J off -r '$configdir/.p4root'"
OSX: P4PORT=rsh:/bin/sh -c "umask 077 && exec p4d -i -J off -r '$configdir/.p4root'"

Actual Results
This leads the Perforce integrate to run P4 commands that look like this:

"p4" -u jeff.putsch -c jeff.putsch-dvcs-1566707823 -p rsh:/bin/sh -c "umask 077 && exec p4d -i -J off -r '$configdir/.p4root'" -d /home/putsch/src/Maxim/mdx/mipi/ edit "/home/putsch/src/Maxim/mdx/mipi/README.rst"

Which does not provide a valid P4 command:

  1. The quoting of the P4PORT is wrong.
  2. The value of $configdir is not expanded.

Expected Results:

A valid P4 command that works in this environment.

One idea would be to add "P4CONFIG" to the environment, then not use the "-p " option if P4PORT starts with "rsh:".

Jeff.

@ulfwin
Copy link

ulfwin commented Jan 23, 2020

I'm also suffering from this issue on my windows computer. My current workaround is changing the .p4config file by expanding the $configdir to the actual directory, and placing quotes around the p4d command, like this:
P4PORT=rsh:"p4d.exe -i -J off -r h:\perforce\ulf_personal_server\.p4root"

The problem (except having to manually fiddle) is that the p4 command does not compute this, so any manual commands i'd like to run will not work.

@mjcrouch
Copy link

mjcrouch commented Feb 29, 2020

Hi @ulfwin @jdputsch
I've just pushed an update to my fork that partially resolves this.

Specifically, I've changed how it runs commands so everything should be correctly escaped, so your .p4config file doesn't need random quotes in it (I haven't tested on windows so my command is slightly different, but it should be cross platform)

It does not fix the variable expansion, so you still need to change the default generated .p4config file to replace $configdir with the real path.*

I tested it by changing the P4PORT as described, and ensuring perforce.port vscode config setting was not defined, and it works for me

* ultimately I would like to change the activation so it doesn't explicitly read the p4 config file, but uses perforce's own logic to get the correct client details, which would expand the variables automatically, but it's quite a big task

@ulfwin
Copy link

ulfwin commented Mar 6, 2020

Tired and working on Windows! Thanks a lot @mjcrouch !

Indeed expanding the variables would be nice, but the biggest problem of having to change back and fourth is taken care of with this work around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants