platformsh / legacy-cli

This is the legacy version of Platform.sh's command-line interface. The new version is at: https://github.com/platformsh/cli
https://docs.platform.sh/administration/cli.html
MIT License
221 stars 120 forks source link

CLI error: "file changed as we read it" when doing a platform build #657

Open dandinu opened 6 years ago

dandinu commented 6 years ago

Hi,

I'm currently using the platform CLI in Lando (on a Windows 10 machine) to run a Drupal 7 environment based off of this example. I am getting a very strange error and I'm hoping you guys have an idea of what the issue is.

c:\repo\>lando platform build
Building application app (runtime type: php:5.6)
Installing php dependencies with 'composer': drush/drush
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 20 installs, 0 updates, 0 removals
  - Installing webmozart/assert (1.2.0): Downloading (100%)
  - Installing webmozart/path-util (2.3.0): Downloading (100%)
  - Installing symfony/yaml (v3.4.1): Downloading (100%)
  - Installing symfony/polyfill-mbstring (v1.6.0): Downloading (100%)
  - Installing symfony/var-dumper (v3.4.1): Downloading (100%)
  - Installing symfony/finder (v3.4.1): Downloading (100%)
  - Installing symfony/event-dispatcher (v3.4.1): Downloading (100%)
  - Installing psr/log (1.0.2): Downloading (100%)
  - Installing symfony/debug (v3.4.1): Downloading (100%)
  - Installing symfony/console (v3.4.1): Downloading (100%)
  - Installing jakub-onderka/php-console-color (0.1): Downloading (100%)
  - Installing jakub-onderka/php-console-highlighter (v0.3.2): Downloading (100%)
  - Installing dnoegel/php-xdg-base-dir (0.1): Downloading (100%)
  - Installing nikic/php-parser (v3.1.2): Downloading (100%)
  - Installing psy/psysh (v0.8.15): Downloading (100%)
  - Installing phpdocumentor/reflection-docblock (2.0.5): Downloading (100%)
  - Installing pear/console_table (v1.3.0): Downloading (100%)
  - Installing consolidation/output-formatters (3.1.13): Downloading (100%)
  - Installing consolidation/annotated-command (2.8.2): Downloading (100%)
  - Installing drush/drush (8.1.15): Downloading (100%)
symfony/var-dumper suggests installing ext-symfony_debug ()
symfony/event-dispatcher suggests installing symfony/dependency-injection ()
symfony/event-dispatcher suggests installing symfony/http-kernel ()
symfony/console suggests installing symfony/lock ()
symfony/console suggests installing symfony/process ()
psy/psysh suggests installing ext-pcntl (Enabling the PCNTL extension makes PsySH a lot happier :))
psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to work.)
psy/psysh suggests installing hoa/console (A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit.)
phpdocumentor/reflection-docblock suggests installing dflydev/markdown (~1.0)
phpdocumentor/reflection-docblock suggests installing erusev/parsedown (~1.0)
pear/console_table suggests installing pear/Console_Color2 (>=0.1.2)
drush/drush suggests installing ext-pcntl (*)
drush/drush suggests installing drush/config-extra (Provides configuration workflow commands, such as config-merge.)
Writing lock file
Generating optimized autoload files
  Beginning to build /app/project.make.                                                                                                                                                                                                                [ok]
  drupal-7.56 downloaded.                                                                                                                                                                                                                              [ok]
   >> apply_for_role-7.x-1.0-beta9 downloaded.                                                                                                                                                                                                         [ok]
   >> Project advanced_help contains 2 modules: help_example, advanced_help.
   >> Project apachesolr contains 3 modules: apachesolr_access, apachesolr_search, apachesolr.
   >> entity-7.x-1.6 downloaded.                                                                                                                                                                                                                       [ok]
   >> entity_view_mode-7.x-1.0-rc1 downloaded.                                                                                                                                                                                                         [ok]
...
   >> waypoints-7.x-1.0 downloaded.                                                                                                                                                                                                                    [ok]
   >> Project custom_search contains 4 modules: custom_search_taxonomy, custom_search_blocks, custom_search_i18n, custom_search.
   >> custom_search-7.x-1.20 downloaded.                                                                                                                                                                                                               [ok]
   >> workbench-7.x-1.2 downloaded.                                                                                                                                                                                                                    [ok]
   >> Project xmlsitemap contains 9 modules: xmlsitemap_engines, xmlsitemap_user, xmlsitemap_node, xmlsitemap_menu, xmlsitemap_i18n, xmlsitemap_modal, xmlsitemap_taxonomy, xmlsitemap_custom, xmlsitemap.
   >> xmlsitemap-7.x-2.3 downloaded.                                                                                                                                                                                                                   [ok]
   >> Project registry_rebuild contains 0 modules: .
   >> registry_rebuild-7.x-2.5 downloaded.                                                                                                                                                                                                             [ok]
   >> platform-7.x-1.4 downloaded.                                                                                                                                                                                                                     [ok]
Found a custom settings.php file: /app/settings.php
  Your settings.php file has been copied (not symlinked) into the build directory.
  You will need to rebuild if you edit this file.
Running post-build hooks
Saving build archive

  [ProcessFailedException]
  The command failed with the exit code: 1

  Full command: 'tar' '-czp' '-C/app/.platform/local/builds/default-tmp' '-f/app/.platform/local/build-archives/5b303aa5445cf2e3ba752f12cc4bffe0f54ce7d0.tar.gz' '.'

  Error output:
  tar: ./public/sites/all/modules/contrib/date: file changed as we read it
  tar: ./public/sites/all/modules/contrib: file changed as we read it
  tar: ./public: file changed as we read it

Here is a screenshot of what it looks like: image

pjcdawkins commented 6 years ago

The error usually means something recursive is going on, for example that tar is trying to add the archive to itself. That doesn't seem to be the case here, unless the arguments to tar are wrong (they look OK to me), or perhaps if the build somehow includes the whole project within itself via a (Windows-style?) symlink or hard-link that tar is unwittingly following (tar normally does not follow symlinks).

Until we understand this, you can run platform build --no-archive as a workaround.

dandinu commented 6 years ago

Thank you for the workaround @pjcdawkins, I can confirm it works now using --no-archive.

Yesterday, I used the platform CLI source, where I was able to hardcode --ignore-failed-read inside the tar and it worked just as well. It seems like this is a warning that forces the CLI to exit.