Page MenuHomePhabricator

arc land does not work on windows
Closed, InvalidPublic

Description

Hi when I try arc land on my windows pc, I'm getting this error

$ arc land
Landing current branch 'master'.
TARGET Landing onto "master", selected by following tracking branches upstream to the closest remote.
REMOTE Using remote "origin", selected by following tracking branches upstream to the closest remote.
FETCH Fetching origin/master...
Exception
Failed to passthru proc_open(): proc_open(): CreateProcess failed, error code - 87
(Run with --trace for a full exception trace.)

with trace

[2016-04-03 08:33:32] EXCEPTION: (Exception) Failed to passthru proc_open(): proc_open(): CreateProcess failed, error code - 87 at [<phutil>\src\future\exec\PhutilExecPassthru.php:99]
arcanist(), phutil()

#0 PhutilExecPassthru::execute() called at [<phutil>\src\future\exec\execx.php:50]
#1 phutil_passthru(string, string, string) called at [<arcanist>\src\repository\api\ArcanistGitAPI.php:46]
#2 ArcanistGitAPI::execPassthru(string, string, string) called at [<arcanist>\src\land\ArcanistGitLandEngine.php:139]
#3 ArcanistGitLandEngine::fetchTarget() called at [<arcanist>\src\land\ArcanistGitLandEngine.php:14]
#4 ArcanistGitLandEngine::execute() called at [<arcanist>\src\workflow\ArcanistLandWorkflow.php:296]
#5 ArcanistLandWorkflow::run() called at [<arcanist>\scripts\arcanist.php:392]

I'm using php 7 from bitnami wamstack

Event Timeline

We don't have PHP7 verified/supported (see T9888, T9640) and we don't support third party installers. In order to accept this you'll need to:

  • Install a supported version of PHP from PHP.net
  • Provide full details on how we can reproduce the issue

@chad the php is based on the official one. Just modified a bit to run with wamstack. Unless it is not modified.

@chad steps to reproduce is to

git clone from https://phabricator.wikimedia.org/diffusion/1883/

then cd into that folder then create a test file suc as a test php file or edit existing patch.

Then arc land.

This is all done on windows.

@chad the php is based on the official one. Just modified a bit to run with wamstack. Unless it is not modified.

We don't support third party installers, because we don't know what they may or may not do. In general this is outside of what we provide under free support. It's up to you to reproduce the bug in a supported environment.

More specifically, we have no other reports on Windows issues with arcanist when installed in a supported environment.

@chad ok ive installed php 7 64bit from http://windows.php.net/download/ and this is the error I still get

[2016-04-03 16:25:20] EXCEPTION: (Exception) Failed to passthru proc_open(): proc_open(): CreateProcess failed, error code - 87 at [<phutil>\src\future\exec\PhutilExecPassthru.php:99]
arcanist(), phutil()

#0 PhutilExecPassthru::execute() called at [<phutil>\src\future\exec\execx.php:50]
#1 phutil_passthru(string, string, string) called at [<arcanist>\src\repository\api\ArcanistGitAPI.php:46]
#2 ArcanistGitAPI::execPassthru(string, string, string) called at [<arcanist>\src\land\ArcanistGitLandEngine.php:139]
#3 ArcanistGitLandEngine::fetchTarget() called at [<arcanist>\src\land\ArcanistGitLandEngine.php:14]
#4 ArcanistGitLandEngine::execute() called at [<arcanist>\src\workflow\ArcanistLandWorkflow.php:296]
#5 ArcanistLandWorkflow::run() called at [<arcanist>\scripts\arcanist.php:392]

I have installed it on a supported platform by you and I still get the error.

Is this what you installed? From the page it looks clear that 7.0.4 is a Developer install, not a Stable/Production Install.

pasted_file (295×984 px, 47 KB)

We don't support PHP7, see my comments above for related tasks. I'll add this as another example though. Thanks for verifying!

In T10717#168249, @chad wrote:

Is this what you installed? From the page it looks clear that 7.0.4 is a Developer install, not a Stable/Production Install.

pasted_file (295×984 px, 47 KB)

Yes that is, now I'm testing using official php builds. Ive tested php 7 and 5.6 and both doint work with arc land. arc diff works.

chad edited projects, added Bug Report (Needs Information); removed Bug Report.

OK, I'll leave it open and wait for reproduction steps. Right now the steps provided aren't reproducing in my local environment. Please take the time to include full steps to reproduce, as if you were setting up a whole new computer to isolate the cause. This is what we'll be doing. Loading a VM with your same version, installing the same PHP scripts, etc, etc.

@chad ok.

This is my steps to reproduce.

Use the windows installer https://github.com/paladox/Arcanist-installer-for-windows

that installs arc,

then download php 5.6 x64 from http://windows.php.net/download/ non threaded and save in c:\php folder and add that to path.

Then open up git for window and git clone this

https://phabricator.wikimedia.org/diffusion/1883/

then cd into the folder create a test file or edit one of the files. Then git add -A --all git commit then arc land.

chad claimed this task.

Use the windows installer https://github.com/paladox/Arcanist-installer-for-windows

We don't support third party installers.

This is just way too far off the map as far was what we take under "Free Support" and "Bug Report". Specifically:

  • We don't support third party installers for arcanist
  • We don't support third party installers for PHP
  • We don't support PHP 7 (yet)
  • We don't take bug reports without reproduction steps.

It'd be helpful with future filings if you could more completely follow our documentation. I know it feels like you're providing complete information, but without all steps and all software versions, we can't move forward. I still don't know what OS to put on my VM to reproduce. These may not seem important, but if you're the only one experiencing this bug, every detail is vital. The best bug reports provide too much information, but are easily reproduced by anyone.

@chad the installer just installs the files it doesn't do anything else so all the files are from phabricator except from installer.

But I rolled back some commits and found that either https://github.com/phacility/arcanist/commit/fcc11b3a278199fa15b90692aba65f54fef5d7f7 or https://github.com/phacility/arcanist/commit/d6b1531b94b2be58d9e074e0bf2ab6c126cc4e65 broke it since rolling back to https://github.com/phacility/arcanist/commit/57f6fb59d73994d90cd94143787424ce0fdbf73b works now.

Understood, but we still need the details to be able to see and fix the bug locally. Without knowing how or why your environment is different than ours, we have no means of identifying and verifying a fix.

@chad

when I run arc land it doesn't detect the revision so I have to manually select it.

But when I get to

Revision 'D48: Sync with master via external script' has not been
accepted. Continue anyway? [y/N] y

It brings this up

Landing revision 'D48: Sync with master via external script'...
PUSHING Pushing changes to "origin/master".
Exception
Failed to passthru proc_open(): proc_open(): CreateProcess failed, error code - 87
(Run with --trace for a full exception trace.)

@chad what details do I give you about my envrioment, because it is setup the same as everyone else.

Windows / Git / PHP / Arcanist versions would be a good start.

@chad how do I get the Arcanist version.

I'm using this revision https://github.com/phacility/arcanist/commit/57f6fb59d73994d90cd94143787424ce0fdbf73b of Arcanist

but it is getting a little bit forward now but I'm then returning to the same error

[0] <conduit> user.whoami() <bytes = 117>
[1] <http> https://phabricator.wikimedia.org/api/user.whoami

<<< [1] <http> 1,498,832 us
<<< [0] <conduit> 1,500,469 us

[2] <conduit> repository.query() <bytes = 154>
[3] <http> https://phabricator.wikimedia.org/api/repository.query

<<< [3] <http> 280,640 us
<<< [2] <conduit> 281,074 us

[4] <exec> $ git symbolic-ref --quiet HEAD

<<< [4] <exec> 91,856 us
Landing current branch 'master'.

[5] <exec> $ git rev-parse --symbolic-full-name "master"upstream

<<< [5] <exec> 89,318 us

[6] <exec> $ git rev-parse --symbolic-full-name "master"upstream

<<< [6] <exec> 92,832 us

[7] <exec> $ git symbolic-ref --quiet HEAD

<<< [7] <exec> 115,467 us

[8] <exec> $ git rev-parse --symbolic-full-name "master"upstream

<<< [8] <exec> 89,746 us
TARGET Landing onto "master", selected by following tracking branches upstream to the closest remote.

[9] <exec> $ git rev-parse --symbolic-full-name "master"upstream

<<< [9] <exec> 91,027 us
REMOTE Using remote "origin", selected by following tracking branches upstream to the closest remote.

[10] <exec> $ git diff --no-ext-diff --no-textconv --raw "HEAD" --
[11] <exec> $ git ls-files --others --exclude-standard

<<< [11] <exec> 126,985 us
<<< [10] <exec> 133,682 us

[12] <exec> $ git diff-files --name-only

<<< [12] <exec> 86,544 us

[13] <exec> $ git rev-parse --verify "origin/master"

<<< [13] <exec> 107,215 us

[14] <exec> $ git rev-parse --verify "master"

<<< [14] <exec> 244,017 us
FETCH Fetching origin/master...

[15] <exec> $ git fetch -- "origin" "master"

<<< [15] <exec> 2,763,437 us

[16] <exec> $ git log --oneline "origin/master".."6c217b81864537b934873f14c83e14f757826a29" --

<<< [16] <exec> 170,862 us
This commit will be landed:

  • 6c217b8 Test

[17] <exec> $ git rev-parse HEAD

<<< [17] <exec> 114,699 us

[18] <exec> $ git rev-parse --abbrev-ref HEAD

<<< [18] <exec> 88,069 us

[19] <exec> $ git checkout "master" --

<<< [19] <exec> 111,979 us

[20] <conduit> differential.query() <bytes = 151>
[21] <http> https://phabricator.wikimedia.org/api/differential.query

<<< [21] <http> 263,808 us
<<< [20] <conduit> 264,246 us

[22] <exec> $ git checkout "master" --

<<< [22] <exec> 118,551 us

[23] <exec> $ git reset --hard "6c217b81864537b934873f14c83e14f757826a29" --

<<< [23] <exec> 125,052 us

[24] <exec> $ git submodule update --init --recursive

<<< [24] <exec> 1,952,618 us

Also windows I'm running is windows 10 insider preview,

php version is php 5.6.

Git version is 2.8.0 from git for windows.

It seems arc land carn't find any revisions I created or wont create any.

Can you reproduce against our test repositories here? See rGITTEST

@chad ive tested it now on your test differential still same problem, I'm using revision https://github.com/phacility/arcanist/commit/57f6fb59d73994d90cd94143787424ce0fdbf73b so it would have failed with proc_open if I was to use the latest revision.

But heres the error I get.

$ arc land
Landing current branch 'master'.
TARGET Landing onto "master", selected by following tracking branches upstream to the closest remote.
REMOTE Using remote "origin", selected by following tracking branches upstream to the closest remote.
FETCH Fetching origin/master...
This commit will be landed:

  • f3d5e5e Test

Usage Exception: arc can not identify which revision exists on branch 'master'. Update the revision with recent changes to synchronize the branch name and hashes, or use 'arc amend' to amend the commit message at HEAD, or use '--revision <id>' to select a revision explicitly.

Yep it is passthru proc_open(): proc_open(): CreateProcess causing the problem.

$ arc land
Landing current branch 'master'.
TARGET Landing onto "master", selected by following tracking branches upstream to the closest remote.
REMOTE Using remote "origin", selected by following tracking branches upstream to the closest remote.
FETCH Fetching origin/master...
Exception
Failed to passthru proc_open(): proc_open(): CreateProcess failed, error code - 87
(Run with --trace for a full exception trace.)

since using https://github.com/phacility/arcanist/commit/d6b1531b94b2be58d9e074e0bf2ab6c126cc4e65 gets me the error faster wheras using https://github.com/phacility/arcanist/commit/57f6fb59d73994d90cd94143787424ce0fdbf73b gets me a bit further before getting that error.

Could we add something to bypass proc_open since it seems to be a bug on windows.

https://github.com/mikehaertl/phpwkhtmltopdf/pull/74/files

Aren't you running a beta of Windows?

@chad yes. But php wouldn't stop working like that because of the windows version unless it would.

@chad or we could use exec for windows and proc_open for everyone else.

We still need to be able to reproduce the bug locally.

Oh ok, I'm not sure why I'm getting it and your not.

But changing

private function pushChange() {
  $api = $this->getRepositoryAPI();

  $this->writeInfo(
    pht('PUSHING'),
    pht('Pushing changes to "%s".', $this->getTargetFullRef()));

  $err = $api->execPassthru(
    'push -- %s %s:%s',
    $this->getTargetRemote(),
    $this->mergedRef,
    $this->getTargetOnto());

  if ($err) {
    throw new ArcanistUsageException(
      pht(
        'Push failed! Fix the error and run "%s" again.',
        'arc land'));
  }
}

to

private function pushChange() {
  $api = $this->getRepositoryAPI();

  $this->writeInfo(
    pht('PUSHING'),
    pht('Pushing changes to "%s".', $this->getTargetFullRef()));

  $api->execxLocal(
    'push -- %s %s:%s',
    $this->getTargetRemote(),
    $this->mergedRef,
    $this->getTargetOnto());

}

and

private function fetchTarget() {
  $api = $this->getRepositoryAPI();

  $ref = $this->getTargetFullRef();

  $this->writeInfo(
    pht('FETCH'),
    pht('Fetching %s...', $ref));

  // NOTE: Although this output isn't hugely useful, we need to passthru
  // instead of using a subprocess here because `git fetch` may prompt the
  // user to enter a password if they're fetching over HTTP with basic
  // authentication. See T10314.

  $err = $api->execPassthru(
    'fetch -- %s %s',
    $this->getTargetRemote(),
    $this->getTargetOnto());

  if ($err) {
    throw new ArcanistUsageException(
      pht(
        'Fetch failed! Fix the error and run "%s" again.',
        'arc land'));
  }
}

to

private function fetchTarget() {
  $api = $this->getRepositoryAPI();

  $ref = $this->getTargetFullRef();

  $this->writeInfo(
    pht('FETCH'),
    pht('Fetching %s...', $ref));

  // NOTE: Although this output isn't hugely useful, we need to passthru
  // instead of using a subprocess here because `git fetch` may prompt the
  // user to enter a password if they're fetching over HTTP with basic
  // authentication. See T10314.

  $api->execxLocal(
    'fetch -- %s %s',
    $this->getTargetRemote(),
    $this->getTargetOnto());

}

fixed the proc_open problem for now because were not running it through it.

But I'm getting this now

$ arc land
Landing current branch 'master'.
TARGET Landing onto "master", selected by following tracking branches upstream to the closest remote.
REMOTE Using remote "origin", selected by following tracking branches upstream to the closest remote.
FETCH Fetching origin/master...
This commit will be landed:

  • f3d5e5e Test

Usage Exception: arc can not identify which revision exists on branch 'master'. Update the revision with recent changes to synchronize the branch name and hashes, or use 'arc amend' to amend the commit message at HEAD, or use '--revision <id>' to select a revision explicitly.

And doing

$ arc land --revision 182a42c
Landing current branch 'master'.
TARGET Landing onto "master", selected by following tracking branches upstream to the closest remote.
REMOTE Using remote "origin", selected by following tracking branches upstream to the closest remote.
FETCH Fetching origin/master...
This commit will be landed:

  • 182a42c Test

Exception
ERR-CONDUIT-CORE: Expected a numeric scalar or null for %Ld conversion. Query: r.id IN (%Ld)
(Run with --trace for a full exception trace.)

@chad it seems to be working now

You have to do arc diff first then you can do arc land otherwise it will error out.

Ive uploaded this patch https://secure.phabricator.com/D15597 to fix the proc_open error.

@paladox, your interactions with this upstream have consistently wasted our time and energy.

I warned you about untested patches in D14813. D15597 obviously hasn't been tested either since it misspells --quiet.

You need to read Support Resources, Contributing Bug Reports, and Providing Reproduction Steps very carefully and follow the rules they set out. You need to apply common sense, critical thinking, and basic software engineering skills in interactions with this upstream. If you are unable to do these things, you need to stop interacting with the upstream.

I tried to reproduce everything. I have never personally developed on Windows, so everything was done from scratch.

@paladox, your interactions with this upstream have consistently wasted our time and energy.

I warned you about untested patches in D14813. D15597 obviously hasn't been tested either since it misspells --quiet.

You need to read Support Resources, Contributing Bug Reports, and Providing Reproduction Steps very carefully and follow the rules they set out. You need to apply common sense, critical thinking, and basic software engineering skills in interactions with this upstream. If you are unable to do these things, you need to stop interacting with the upstream.

But I did test this patch.

You did not test the patch. As I noted, the patch runs git fetch --queit instead of git fetch --quiet.

no.png (222×595 px, 32 KB)

You also ignored the large explanatory comment immediately above the changed code which explains why it uses passthru and the specific problem that passthru solves, with a reference to the original issue.

You did not test the patch. As I noted, the patch runs git fetch --queit instead of git fetch --quiet.

no.png (222×595 px, 32 KB)

You also ignored the large explanatory comment immediately above the changed code which explains why it uses passthru and the specific problem that passthru solves, with a reference to the original issue.

I did test it, by changing execPassthru to execxLocal. Which worked for me maybe I may have changed queit but I was testing to see weather changing execPassthru back to execxLocal would work.

You did not test the patch. As I noted, the patch runs git fetch --queit instead of git fetch --quiet.

no.png (222×595 px, 32 KB)

You also ignored the large explanatory comment immediately above the changed code which explains why it uses passthru and the specific problem that passthru solves, with a reference to the original issue.

Also yes sorry I see that now, but proc_open doesn't work on windows. I doint know why you carn't reproduce the problem I'm having. But I'm having the problem.

I'm also not trying to waste your time.

Other users are having problems with proc_open and the recommended way is to use exec

https://github.com/mikehaertl/phpwkhtmltopdf/issues/56

@epriestley and @chad ive done some digging at it seems to be this

It seems to be this

public function execPassthru($pattern /* , ... */) {
  $args = func_get_args();

  static $git = null;
  if ($git === null) {
    if (phutil_is_windows()) {
      // NOTE: On Windows, phutil_passthru() uses 'bypass_shell' because
      // everything goes to hell if we don't. We must provide an absolute
      // path to Git for this to work properly.
      $git = Filesystem::resolveBinary('git');
      $git = csprintf('%s', $git);
    } else {
      $git = 'git';
    }
  }

  $args[0] = $git.' '.$args[0];

  return call_user_func_array('phutil_passthru', $args);
}

By changing

if ($git === null) {
  if (phutil_is_windows()) {
    // NOTE: On Windows, phutil_passthru() uses 'bypass_shell' because
    // everything goes to hell if we don't. We must provide an absolute
    // path to Git for this to work properly.
    $git = Filesystem::resolveBinary('git');
    $git = csprintf('%s', $git);
  } else {
    $git = 'git';
  }
}

to

if ($git === null) {

    $git = 'git';
  
}

that fixed the problem.

Are you still working on a beta of Windows?

Yes. It seems it may not be able to find the git. Since git for windows updated a lot of things so I doint know if that check works now. But also I doint know if your check will find git in the 64-bit folder or 32-bit.

And you understand any "fix" against a beta/unsupported environment is not valid in the upstream, correct?

That is, you are still required to provide a valid bug report (steps to reproduce) against a supported environment so that we may observe the bug and verify any fix.

Or keep the patch locally yourself, that's fine as well.

In T10717#168288, @chad wrote:

I tried to reproduce everything. I have never personally developed on Windows, so everything was done from scratch.

@chad these are the right steps except from arc patch or arc land.

I downloaded a test repo from https://phabricator.wikimedia.org/diffusion/1883/

then I created either a test file or edited an file.

Then git add -A --all then git commit then arc diff or arc land.

Did you download git for windows from https://github.com/git-for-windows/git/releases the .exe file 64-bit.

I'm hesitant to provide further discussion on this issue because of conversation above, but never-the-less in case anyone else using Windows stumbles across this issue, then here's the following advice:

More often than not, this error indicates that the path that you attempted to execute was not a valid Windows binary, or you don't have permission to execute the binary. Run where git (for Command Prompt) or which git (for Git Bash) from the same console that you're running arc and getting the error. Make sure the first path that's reported by that command is valid Windows executable, it doesn't have something like "Run as Administrator" set, and that you can execute it from the same command prompt by running the full path.

For example, you might diagnose the issue like this from the Command Prompt:

C:\...\> arc land
(verify that the failure actually occurs in this command prompt)
C:\...\> where git
C:\Program Files (x86)\Git\cmd\git.exe
C:\...\> "C:\Program Files (x86)\Git\cmd\git.exe" --help
(observe the output, does Windows throw an error? etc.)

@hach-que thanks for your suggestion, you helped me. I get different directors from different command line so cmd throughs C:\Program Files\Git\cmd\git.ex whereas git for windows throughs /mingw64/bin/git

on git for windows the command is which git

on cmd its where git.

@chad @epriestley arcanist works straight of the master branch in cmd on windows for me. But git for windows does not work.

Probaly because of the way the paths are done. So $git = 'git'; works on Linux which git for windows is based on since it is bash. So

$git = Filesystem::resolveBinary('git');
$git = csprintf('%s', $git);

will not work. Because c:\ is not supported in git for windows it throws errors with any thing that does c:\ since it only recognises the Linux path. We need to add a check so when on git for windows it uses $git = 'git'; instead of

$git = Filesystem::resolveBinary('git');
$git = csprintf('%s', $git);