Closed sh1ny closed 8 years ago
@sh1ny I think I know the problem, should have a fix today. I haven't run into this in the past because I always login to p4 manually.
Still no luck with that, upgrading to 1.6.2 didn't solve the problem. I am on mac. Here's the console log :
atom-perforce: loading environment vars via command "/bin/bash -c 'source ~/.profile >/dev/null && env'" /Users/nbochev/.atom/packages/atom-perforce/lib/environment.js:69 atom-perforce: loading environment vars via command "/bin/bash -c 'source ~/.bash_profile >/dev/null && env'" /Users/nbochev/.atom/packages/atom-perforce/lib/environment.js:69 atom-perforce: loading environment vars via command "/bin/bash -c 'source ~/.bashrc >/dev/null && env'" /Applications/Atom.app/Contents/Resources/app.asar/src/deserializer-manager.js:42 No deserializer found for Object index.js:46 Window load time: 2004ms /Users/nbochev/.atom/packages/sync-settings/lib/sync-settings.coffee:60 checking latest backup... /Users/nbochev/.atom/packages/sync-settings/lib/sync-settings.coffee:299 Creating GitHubApi client with token = XXXXXXXXXXXX /Users/nbochev/.atom/packages/sync-settings/lib/tracker.coffee:71 tracking Activate /Users/nbochev/.atom/packages/sync-settings/lib/sync-settings.coffee:66 null Object /Users/nbochev/.atom/packages/sync-settings/lib/sync-settings.coffee:81 latest backup version xxxxxxxxxxxxxxxx /Users/nbochev/.atom/packages/atom-perforce/lib/atom-perforce.js:590 Error: Command failed: /bin/sh -c p4 -ztag opened ./... Perforce password (P4PASSWD) invalid or unset.
Perforce password (P4PASSWD) invalid or unset.
at ChildProcess.exithandler (child_process.js:208:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:764:16)
at Socket.
Perforce password (P4PASSWD) invalid or unset.
at ChildProcess.exithandler (child_process.js:208:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:764:16)
at Socket.
Perforce password (P4PASSWD) invalid or unset.
at ChildProcess.exithandler (child_process.js:208:12) at emitTwo (events.js:87:13) at ChildProcess.emit (events.js:172:7) at maybeClose (internal/child_process.js:764:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5) (anonymous function) @ /Users/nbochev/.atom/packages/atom-perforce/lib/atom-perforce.js:446 index.js:13 Unhandled promise rejection Object with error: Error: Command failed: /bin/sh -c p4 diff master.pp Perforce password (P4PASSWD) invalid or unset.
Perforce password (P4PASSWD) invalid or unset.
at ChildProcess.exithandler (child_process.js:208:12) at emitTwo (events.js:87:13) at ChildProcess.emit (events.js:172:7) at maybeClose (internal/child_process.js:764:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5) (anonymous function) @ index.js:13 /Users/nbochev/.atom/packages/atom-perforce/lib/atom-perforce.js:714 Error: Command failed: /bin/sh -c p4 fstat master.pp Perforce password (P4PASSWD) invalid or unset.
Perforce password (P4PASSWD) invalid or unset.
at ChildProcess.exithandler (child_process.js:208:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:764:16)
at Socket.
index.js:13 Unhandled promise rejection Object with error: Error: Command failed: /bin/sh -c p4 fstat master.pp Perforce password (P4PASSWD) invalid or unset.
Perforce password (P4PASSWD) invalid or unset.
at ChildProcess.exithandler (child_process.js:208:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:764:16)
at Socket.
Perforce password (P4PASSWD) invalid or unset.
at ChildProcess.exithandler (child_process.js:208:12) at emitTwo (events.js:87:13) at ChildProcess.emit (events.js:172:7) at maybeClose (internal/child_process.js:764:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5) (anonymous function) @ /Users/nbochev/.atom/packages/atom-perforce/lib/atom-perforce.js:590 /Users/nbochev/.atom/packages/atom-perforce/lib/atom-perforce.js:329 could not p4 sync Error: Command failed: /bin/sh -c p4 sync ./... Perforce password (P4PASSWD) invalid or unset.
Perforce password (P4PASSWD) invalid or unset.
at ChildProcess.exithandler (child_process.js:208:12) at emitTwo (events.js:87:13) at ChildProcess.emit (events.js:172:7) at maybeClose (internal/child_process.js:764:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5) (anonymous function) @ /Users/nbochev/.atom/packages/atom-perforce/lib/atom-perforce.js:329 index.js:13 Unhandled promise rejection Object with error: "Command failed: /bin/sh -c p4 sync ./... Perforce password (P4PASSWD) invalid or unset. "(anonymous function) @ index.js:13 /Users/nbochev/.atom/packages/atom-perforce/lib/atom-perforce.js:714 Error: Command failed: /bin/sh -c p4 fstat .p4config Perforce password (P4PASSWD) invalid or unset.
Perforce password (P4PASSWD) invalid or unset.
at ChildProcess.exithandler (child_process.js:208:12) at emitTwo (events.js:87:13) at ChildProcess.emit (events.js:172:7) at maybeClose (internal/child_process.js:764:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
index.js:13 Unhandled promise rejection Object with error: Error: Command failed: /bin/sh -c p4 fstat .p4config Perforce password (P4PASSWD) invalid or unset.
Perforce password (P4PASSWD) invalid or unset.
at ChildProcess.exithandler (child_process.js:208:12) at emitTwo (events.js:87:13) at ChildProcess.emit (events.js:172:7) at maybeClose (internal/child_process.js:764:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5) (anonymous function) @ index.js:13 /Users/nbochev/.atom/packages/atom-perforce/lib/atom-perforce.js:446 Error: Command failed: /bin/sh -c p4 diff .p4config Perforce password (P4PASSWD) invalid or unset.
Perforce password (P4PASSWD) invalid or unset.
at ChildProcess.exithandler (child_process.js:208:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:764:16)
at Socket.
Perforce password (P4PASSWD) invalid or unset.
at ChildProcess.exithandler (child_process.js:208:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:764:16)
at Socket.
Here's the output of env:
$source ~/.bash_profile >/dev/null && env
TERM_PROGRAM=iTerm.app SHELL=/bin/bash TERM=xterm-256color CLICOLOR=true TMPDIR=/var/folders/yr/kt0jgk7d2l91ks5_vf926bvc002zn4/T/ DOCKER_HOST=tcp://192.168.99.100:2376 Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.kPZhwGGEJV/Render OLDPWD=/Users/nbochev USER=nbochev P4PASSWD=XXXXXXX SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.XsaP5iu9Ab/Listeners __CF_USER_TEXT_ENCODING=0x17EA4:0x0:0x0 DOCKER_TLS_VERIFY=1 LSCOLORS=gxfxcxdxbxCgCdabagacad PATH=/Library/PostgreSQL/9.4/bin:/usr/local/sbin:/usr/local/packer:/Library/Frameworks/Python.framework/Versions/3.5/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Users/nbochev/Development/go/bin:/build/apps/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/aria2/bin:/usr/local/go/bin:/mts/git/bin PWD=/Users/nbochev/Development/build EDITOR=vi LANG=en_US.UTF-8 ITERM_PROFILE=Default XPC_FLAGS=0x0 PS1=[\033[38;5;11m]\u[$(tput sgr0)][\033[38;5;15m]@[$(tput sgr0)][\033[38;5;12m]\h[$(tput sgr0)][\033[38;5;15m]:[$(tput sgr0)][\033[38;5;6m][\w]:[$(tput sgr0)][\033[38;5;15m]\n\$[$(tput sgr0)] XPC_SERVICE_NAME=0 DOCKER_CERTPATH=/Users/nbochev/.docker/machine/machines/default SHLVL=1 HOME=/Users/nbochev LOGNAME=nbochev GOPATH=/Users/nbochev/Development/go P4CONFIG=.p4config =/usr/bin/env
i am starting atom by going to the project dir and typing : $ atom .
Typing p4 info in that same dir, produces:
$p4 info User name: nbochev Client name: nbochev-build Client host: wolfheart-MBPRO.local Client root: /Users/nbochev/Development/build Current directory: /Users/nbochev/Development/build/depot/build/devil Peer address: xxxxxxx Client address: xxxxxx Server address: perforce-releng Server root: /p4d/perforce-releng_1850 Server date: 2015/11/11 07:36:41 -0800 PST Server uptime: 1270:07:38 Server version: P4D/LINUX26X86_64/2015.1/1217912 (2015/08/13) ServerID: perforce-releng_1850 Proxy address: xxxxxxxxx Proxy version: P4P/LINUX26X86_64/2015.1/1126382 (2015/06/22) Server license: xxxxx Server license-ip: xxxxxxx Case Handling: sensitive
Running commands on the shell works as expected.
@sh1ny that's odd. If you p4 login
from your terminal, does that alleviate the issue? seems like a reasonable workaround, and it's more secure than storing your password in a file.
That said, I'm not sure why your .p4config file isn't being used here...
I just upgraded from 1.5.3 to 1.6.2 and am running into the same problem. Interestingly, I don't store my password in a config file and normally use p4 login
from the command line. I've verified that I am logged in and commands are working from the command line. But inside Atom, I see the same errors as @sh1ny.
atom-perforce: loading environment vars via command "/bin/bash -c 'source ~/.profile >/dev/null && env'"
/Users/mdouglass/.atom/packages/atom-perforce/lib/environment.js:69 atom-perforce: loading environment vars via command "/bin/bash -c 'source ~/.bash_profile >/dev/null && env'"
/Users/mdouglass/.atom/packages/atom-perforce/lib/environment.js:69 atom-perforce: loading environment vars via command "/bin/bash -c 'source ~/.bashrc >/dev/null && env'"
index.js:46 Window load time: 1477ms
/Users/mdouglass/.atom/packages/atom-perforce/lib/environment.js:77 error executing command /bin/bash -c 'source ~/.profile >/dev/null && env': Error: Command failed: /bin/bash -c /bin/bash -c 'source ~/.profile >/dev/null && env'
/bin/bash: /Users/mdouglass/.profile: No such file or directory
/Users/mdouglass/.atom/packages/atom-perforce/lib/atom-perforce.js:446 Error: Command failed: /bin/sh -c p4 diff index.js
Perforce password (P4PASSWD) invalid or unset.
Perforce password (P4PASSWD) invalid or unset.
at ChildProcess.exithandler (child_process.js:208:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:764:16)
at Socket.<anonymous> (internal/child_process.js:319:11)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at Pipe._onclose (net.js:467:12)(anonymous function) @ /Users/mdouglass/.atom/packages/atom-perforce/lib/atom-perforce.js:446
Yea i am logged in , and no, using p4 login and then opening atom, doesn't help with the issue at all.
I don't use p4 in OSX environment so I can't test it. Put a breakpoint at L131 and look at the environmentReady
value would give you a much better idea on what's going on.
I left my laptop that has the issue at work, happy to take a swing at this on Monday.
@unional , I set the breakpoint as suggested, the promise environmentReady is resolving successfully but as an empty object { }
.
Looking at the code, this seems appropriate for my configuration as I don't set any of the searched-for variables P4CONFIG
, P4IGNORE
, P4PORT
, P4USER
, P4TICKETS
, P4PASSWD
in .bashrc
or .bash_profile
.
I have P4CONFIG
and P4IGNORE
set via p4 set -s
which then picks up a config file located above my project directory (but below my user directory). I tried to look at an older version of the code to figure out how this was working in the 1.5.x branch but couldn't see any obvious changes (though I likely missed it).
If there's any more troubleshooting/debugging you can suggest, I'm game.
Thanks
I see. So then trace up a bit at L441 and see what's in the openedBufferFilePath
, and use your terminal to go to the same folder and run the same command: /bin/sh -c p4 diff index.js
and see if you get the same error.
@mdouglass any reason you don't use env variables to set these values? I freely admit I am unaware of all the myriad ways of configuring a perforce environment and likely wrongly assumed everyone uses environment variables to do so. atom-perforce was written with this assumption.
I'm not using environment variables because I work in an (admittedly unusual) environment where there are multiple perforce servers (one per project). So at the top of the directory tree for each project I drop a .p4config file that has the proper settings for that tree.
my .p4config file is still utilized, although it only contains P4CLIENT. all other environment vars are set for me in .zshenv/.bashrc. Not sure what the difference is here.
Ok, so I did some more debugging and noticed a couple different things.
https://github.com/mattsawyer77/atom-perforce/blob/master/lib/atom-perforce.js#L537
I think the test of p4info.currentDirectory
may be reversed. Shouldn't this be && !startsWith
instead of || startsWith
? Things definitely seem to get farther if I flip this test around.
The calls to p4 are using /bin/sh
as the shell, not /bin/bash
(as the calls in environment.js are). Not sure that matters, but just to point it out.
environment.js getSourceShellEnvCommand
is creating the command line /bin/bash -c 'source...'
. I think the /bin/bash -c
is unnecessary here since the path is handled to child_process.exec
which is already going to invoke the command in the shell. (Also explains why my error messages show it /bin/bash -c twice:
error executing command /bin/bash -c 'source ~/.profile >/dev/null && env': Error: Command failed: /bin/bash -c /bin/bash -c 'source ~/.profile >/dev/null && env'
Still not sure why the problem is going on. Ultimately it issues a command with /bin/sh with a cwd set that works for me when run from the command line, but fails for the plugin. Maybe there's something else going on in the environment atom is setting up, I'll keep looking.
@unional -- I'm still coming up to speed on atom, how can I install your fork of the plugin?
Seems like you need to set the workspace on each call except p4 info
. I work on a similar issue on jspm-p4
and I able to get it to work by calling p4 -c {workspace} {cmd...}
.
But seems like node-perforce
does not allow that.
@mdouglass ah, you are right. I missed that one. PR coming in. :)
Forget about the fork for now, node-perforce
doesn't allow me to do what I was trying to to. See the comment above.
The calls to p4 are using /bin/sh as the shell, not /bin/bash (as the calls in environment.js are). Not sure that matters, but just to point it out.
I know it looks odd but trying to use any other shell (at least from in OS X) seems to prevent anything from working.
environment.js getSourceShellEnvCommand is creating the command line /bin/bash -c 'source...'. I think the /bin/bash -c is unnecessary here
in order to use the source command (which is not an actual filename) I have to use $shell -c
@mattsawyer77 , on https://github.com/mattsawyer77/atom-perforce/blob/master/lib/atom-perforce.js#L537, what's the intent? Should the setStatusClient()
still be called even if the current directory is not under the clientRoot
?
nvm. Figured it out. PR is sent.
I know it looks odd but trying to use any other shell (at least from in OS X) seems to prevent anything from working.
Fair enough, just wanted to mention it in case it was relevant.
in order to use the source command (which is not an actual filename) I have to use $shell -c
Agreed. My point was that child_process.exec
is doing that for you (see the docs at https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback, particularly the options.shell comment). That being said, it does not help with this issue, just something I noticed.
Ok, I think I figured it out this time.
https://github.com/unional/atom-perforce/blob/multi-workspaces/lib/atom-perforce.js#L30 runs all the p4 commands with an empty environment other than the extracted P4 variables. This means that the HOME
variable is dropped from the shell's environment, which I believe is how p4 is tracking back to find the .p4tickets file. I can duplicate this on the command line via:
SFOC02KT0LUFFT1:kmservices mdouglass$ /bin/sh -c 'p4 diff main.js'
main.js - file(s) not opened on this client.
SFOC02KT0LUFFT1:kmservices mdouglass$ HOME= /bin/sh -c 'p4 diff main.js'
Perforce password (P4PASSWD) invalid or unset.
@mdouglass ah, that could be. I might have been sidestepping this issue by doing export P4TICKETS=$HOME/.p4tickets
in my ~/.zshenv.
Hey,
I am using atom and perforce on a daily basis. After upgrade to 1.6.0/1.6.1 it totally stopped working on my mac.
I have .p4config with p4password and i have .bashrc and .bash_profile. Nothing helped, i kept getting P4PASSWD not set, even if it was. Downgrading to 1.5.3 solved the problem.
What info can i provide so this get fixed ?
Regards,