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

couscous deploy copy error: target could not be opened for writing #226

Open
BenCrulis opened this issue Oct 22, 2018 · 3 comments
Open

Comments

@BenCrulis
Copy link

Context

I made some local changes in my git configuration, played with git submodules and branches and then suddenly couscous deploy ceased to work.
I now always get the same error:

$ couscous deploy
Generating /path_to_project to /path_to_project/.couscous/generated
[notice] Executing cd "/path_to_project" && cp -r figures/ .couscous/generated/

Deploying the website
Cloning https://github.com/bencrulis/BDMA_M1_Project in /tmp/couscous_deploy_cqlLxP
Checking out branch gh-pages
Copying generated website

In Filesystem.php line 63:
                                                                               
  Failed to copy "/path_to_project/.couscous/generated/.git" to "/tmp/couscous_deploy_cqlLxP/.git" because target file could not be opened for writing.                                              
                                                                               
deploy [--repository REPOSITORY] [--branch BRANCH] [--config CONFIG] [--] [<source>]

Couscous seems to have the writing permission but the source is a file and the target is a folder.

The content of the .git file in question is

gitdir: ../.git/modules/website

What I tried

Couscous preview still works perfectly.

Although no commit or push was done, it also ceased to work when deploying from another machine.

I also hoped adding .git to the excluded folders in couscous.yml would change something but it didn't work.

@BenCrulis
Copy link
Author

I found a workaround, it seems to work again by telling couscous to remove the .git file after html generation in its scripts section:

scripts:
    after:
        - rm .couscous/generated/.git

@mnapoli
Copy link
Member

mnapoli commented Oct 28, 2018

Hi, this is weird, Couscous should ignore hidden directories:

->ignoreDotFiles(true);

so it should not try to copy the .git directory at all 🤔

Can you confirm this is what Couscous is doing and this is the problem?

@BenCrulis
Copy link
Author

Hi, I added some debug prints under $excludedDirectories at the end of Project.php to see what's excluded:

    echo "Debug:\n";
    foreach($excludedDirectories->toArray() as $thing){
        echo $thing;
        echo "\n";
    }

I ran a couscous preview and couscous deploy, it printed tons of files starting with a dot:

Debug:
vendor
website
.git
.gitignore
__pycache__

.Python
build
develop-eggs
dist
downloads
eggs
.eggs
lib
lib64
parts
sdist
var
wheels
.installed.cfg
MANIFEST
pip-log.txt
pip-delete-this-directory.txt
htmlcov
.tox
.coverage
.cache
nosetests.xml
coverage.xml
.hypothesis
.pytest_cache
local_settings.py
db.sqlite3
instance
.webassets-cache
.scrapy
docs/_build
target
.ipynb_checkpoints
.python-version
celerybeat-schedule
.env
.venv
env
venv
ENV
env.bak
venv.bak
.spyderproject
.spyproject
.ropeproject
site
.mypy_cache
.couscous
Debug:
vendor
website
.git
.gitignore
__pycache__

.Python
build
develop-eggs
dist
downloads
eggs
.eggs
lib
lib64
parts
sdist
var
wheels
.installed.cfg
MANIFEST
pip-log.txt
pip-delete-this-directory.txt
htmlcov
.tox
.coverage
.cache
nosetests.xml
coverage.xml
.hypothesis
.pytest_cache
local_settings.py
db.sqlite3
instance
.webassets-cache
.scrapy
docs/_build
target
.ipynb_checkpoints
.python-version
celerybeat-schedule
.env
.venv
env
venv
ENV
env.bak
venv.bak
.spyderproject
.spyproject
.ropeproject
site
.mypy_cache
.couscous

I tried another debug print:

    echo "Debug 2:\n";
    foreach ($finder as $thing) {
        echo $thing;
        echo "\n";
    }

This time, no dotted files are printed, only directories.

I suspect the problem does not come from this file as it seems to be specific to couscous deploy.

Thank you for looking into this, I have absolutely no php skill to look myself.

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

2 participants