satis icon indicating copy to clipboard operation
satis copied to clipboard

satis tries to write to vendor when creating archives

Open glensc opened this issue 6 years ago • 8 comments

i've installed satis with composer, and therefore /bin/satis, /vendor/ are readonly.

but satis seems to need that dir writable for operation when creating archives:


Dumping 'example/project'.
  - Installing example/project (0.14.2): Downloading https://gitlab.example.net/api/v4/projects/example%2Fproject/repository/archive.zip?sha=ad841d207fdd310e1cf5956887bde19b073c
5678
Downloading (100%)Writing /app/var/cache/composer/files/example/project/be550bf3db6920647a810a52364747aa28d243f8.zip into cache from /tmp/composer_archive5b926e308f6e6/e081b3085
fa3914a25d5d162bbccf1f1.zip

 Extracting archive    Failed to download example/project from dist: /app/vendor/composer/57d9f2fd does not exist and could not be created.
    Now trying to download from source
  - Installing example/project (0.14.2): Executing command (CWD): git --version

    Cloning to cache at '/app/var/cache/composer/vcs/git-gitlab.example.net-example-project.git/'
Executing command (CWD): git clone --mirror '[email protected]:example/project.git' '/app/var/cache/composer/vcs/git-gitlab.example.net-example-project.git/'
[email protected]'s password:
[http@38df93fc3780 app]$ ls -ld /app/vendor/composer/
drwxr-xr-x 9 root root 4096 Sep  7 11:45 /app/vendor/composer/
[root@38df93fc3780 app]# chmod a+rwx /app/vendor/composer/
[http@38df93fc3780 app]$ php -dmemory_limit=-1 /app/bin/satis  build config/satis.json public/ -vvv
...

  - Installing example/project (0.14.2): Reading /app/var/cache/composer/files/example/project/be550bf3db6920647a810a52364747aa28d243f8.zip from cache
Loading from cache
 Extracting archive
Executing command (CWD): unzip -qq  '/tmp/composer_archive5b92701e9e4f3/3719ac648055c21a987223f76c35a05e.zip' -d '/app/vendor/composer/0b9e11f4'
...
[http@38df93fc3780 app]$ composer show|grep composer
composer/ca-bundle        1.1.2   Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.
composer/composer         1.7.2   Composer helps you declare, manage and install dependencies of PHP projects, ensuring you have the right stack everywhere.
composer/satis            1.0.0   Simple Repository Generator
composer/semver           1.4.2   Semver library that offers utilities, version constraint parsing and validation.
composer/spdx-licenses    1.4.0   SPDX licenses list and validation library.
composer/xdebug-handler   1.3.0   Restarts a process without xdebug.

glensc avatar Sep 07 '18 12:09 glensc

Can you show us your exact satis.sjon and the command you are running (even if it's a docker command or something)?

Also

i've installed satis with composer, and therefore /bin/satis, /vendor/ are readonly.

I do not know understand the implication of using composer and the direct correlation you are drawing with /bin/satis and /vendor being read only. This is something I never heard of before.

alcohol avatar Sep 08 '18 07:09 alcohol

brief setup description:

  • /app - place where satis is installed via composer
  • /app/vendor - satis vendor dir
  • /app/vendor/composer - satis vendor dir for composer vendored packages
  • /app/vendor/etc/etc - and so on.

that /app tree is readonly, because it's owned by root. satis should not write anything underneath that path, but to $HOME/.composer/cache or whatever env override specifies.

in my example i had setup COMPOSER_CACHE_HOME=/app/var/cache/composer, and that path is writable for user running satis, yet satis/composer tried to write to arbitary path /app/vendor/compose which failed, as that tree is readonly.

glensc avatar Sep 09 '18 09:09 glensc

https://gist.github.com/glensc/e4e1fac01b331d11ecafb9e1878aa941

git clone -b v2 https://gist.github.com/e4e1fac01b331d11ecafb9e1878aa941.git bug-497
cd bug-497/

# optional for better cache in docker build
#composer install

docker build . -t satis
docker run --rm -it satis
➔ docker run --rm -it satis
Scanning packages
Creating local downloads in 'public/packages'
Dumping 'php-gettext/php-gettext'.
  - Installing php-gettext/php-gettext (1.0.11): Downloading (100%)

In Filesystem.php line 186:

  /app/vendor/composer/4be6ca62 does not exist and could not be created.


build [--repository-url [REPOSITORY-URL]] [--no-html-output] [--skip-errors] [--stats] [--] [<file>] [<output-dir>] [<packages>]...

glensc avatar Sep 09 '18 09:09 glensc

ping. were you able to understand and reproduce the problem?

glensc avatar Sep 20 '18 10:09 glensc

Yes, I think I was able to reproduce it. It has been a while though. I might have some time later today to look into it again.

alcohol avatar Sep 20 '18 10:09 alcohol

friendly poke ;)

just spent again too much time before figured out i had vendor/composer not writable in docker composer (didn't realize it was not bind mounted. huh.)

glensc avatar Oct 10 '18 11:10 glensc

@glensc was this fixed for you? I'm facing the same issue.

REDLINK avatar Jun 25 '20 15:06 REDLINK

@REDLINK I solved for myself with a workaround, and as here is no update, I did not see a reason to re-check that it maybe be fixed.

I've updated my reproducer with latest versions with tag v2 and the problem remains:

  • https://github.com/composer/satis/issues/497#issuecomment-419704039

glensc avatar Jun 25 '20 17:06 glensc