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

Fix error on windows: Cannot connect to #101

Closed
andrelopez opened this issue Jul 4, 2017 · 4 comments
Closed

Fix error on windows: Cannot connect to #101

andrelopez opened this issue Jul 4, 2017 · 4 comments
Assignees
Labels

Comments

@andrelopez
Copy link

@andrelopez andrelopez commented Jul 4, 2017

Hi Sebastian! very nice library!
I was testing this tool on windows and I got the next error:

Exception 'phpbu\App\Exception' with message 'tar failed: tar (child): Cannot connect to C: resolve failed /usr/bin/tar: C:/MAMP/htdocs/.......

I did some research, and I found this:

The reason is that tar interprets colons (:) in file names as meaning it is a file on another machine. You can disable this behavior by using the flag --force-local.

https://stackoverflow.com/a/37996249

So the solution is add the --force-local on the phpbu\App\Cli\Executable\Tar file at the createProcess function:

    /**
     * Process generator
     */
    protected function createProcess()
    {
        $this->validateSetup();

        $process = new Process();
        $tar     = new Cmd($this->binary);

        foreach ($this->excludes as $path) {
            $tar->addOption('--exclude', $path);
        }

        $tar->addOptionIfNotEmpty('--ignore-failed-read', $this->ignoreFailedRead, false);
        $tar->addOptionIfNotEmpty('--use-compress-program', $this->compressProgram);
        $tar->addOption('-' . (empty($this->compressProgram) ? $this->compression : '') . 'cf');
        $tar->addArgument($this->tarPathname);
        $tar->addOption('-C', dirname($this->path), ' ');
        $tar->addArgument(basename(($this->path)));
        /* Added to work on windows */
        $tar->addOption('--force-local');

        $process->addCommand($tar);

        // delete the source data if requested
        if ($this->removeSourceDir) {
            $process->addCommand($this->getRmCommand());
        }

        return $process;
    }

Let me know If I can help on anything else,
Keep up the good work!

@andrelopez andrelopez changed the title Fix error on windows Fix error on windows: Cannot connect to Jul 4, 2017
@sebastianfeldmann
Copy link
Owner

@sebastianfeldmann sebastianfeldmann commented Jul 4, 2017

Hi, thanks for the great analysis.
I will add the --force-local option asap ;)

@sebastianfeldmann sebastianfeldmann self-assigned this Jul 4, 2017
sebastianfeldmann added a commit that referenced this issue Jul 5, 2017
This is needed to make sure files containing ';' are resolved
locally.
@sebastianfeldmann
Copy link
Owner

@sebastianfeldmann sebastianfeldmann commented Jul 5, 2017

I just released phpbu 4.0.10 you can now add

<option name="forceLocal" value="true" />

to your tar configuration and the --force-local option will be applied to the tar command.

Hope that helps ;)
Cheers, Sebastian

@andrelopez
Copy link
Author

@andrelopez andrelopez commented Jul 7, 2017

It works like a charm!

Thank you.

@sebastianfeldmann
Copy link
Owner

@sebastianfeldmann sebastianfeldmann commented Jul 7, 2017

Thank you for investigating this and making it an easy fix!

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.