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

Comments

Projects
None yet
2 participants
@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 from Fix error on windows to Fix error on windows: Cannot connect to Jul 4, 2017

@sebastianfeldmann

This comment has been minimized.

Show comment
Hide comment
@sebastianfeldmann

sebastianfeldmann Jul 4, 2017

Owner

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

Owner

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

Add '--force-local' option to tar - issue #101
This is needed to make sure files containing ';' are resolved
locally.
@sebastianfeldmann

This comment has been minimized.

Show comment
Hide comment
@sebastianfeldmann

sebastianfeldmann Jul 5, 2017

Owner

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

Owner

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

This comment has been minimized.

Show comment
Hide comment
@andrelopez

andrelopez Jul 7, 2017

It works like a charm!

Thank you.

andrelopez commented Jul 7, 2017

It works like a charm!

Thank you.

@sebastianfeldmann

This comment has been minimized.

Show comment
Hide comment
@sebastianfeldmann

sebastianfeldmann Jul 7, 2017

Owner

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

Owner

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