Skip to content

Composer archive for an empty svn tag triggers ErrorException #12391

@glaubinix

Description

@glaubinix

Running a composer archive command for a package hosted on a SVN server where a tag is empty. Triggers an ErrorException because Composer tries to copy a tar/zip file that doesn't exist.

My composer.json:

{
    "require": {
        "wpackagist-plugin/individual-multisite-author": "1.0"
    },
    "repositories": {
     "wpackagist": {
            "type": "composer",
            "url": "https://wpackagist.org"
        }
    },
    "config": {
        "allow-plugins": {
            "composer/installers": true
        }
    }
}

Output of composer diagnose:

Checking composer.json: WARNING
No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.
require.wpackagist-plugin/individual-multisite-author : exact version constraints (1.0) should be avoided if the package follows semantic versioning
Checking composer.lock: OK
Checking platform settings: OK
Checking git settings: OK git version 2.49.0
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking connectivity to https://wpackagist.org: OK
Checking github.com oauth access: OK does not expire
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking Composer version: OK
Checking Composer and its dependencies for vulnerabilities: OK
Composer version: 2.8.8
PHP version: 8.2.28
PHP binary path: /opt/homebrew/Cellar/php@8.2/8.2.28_1/bin/php
OpenSSL version: OpenSSL 3.4.1 11 Feb 2025
curl version: 8.13.0 libz 1.2.12 brotli brotli/1.1.0 zstd supported ssl OpenSSL/3.4.1 (SecureTransport)
zip: extension present, unzip present, 7-Zip not available

When I run this command:

composer archive wpackagist-plugin/individual-multisite-author 1.0 -vvv

I get the following output:

Running 2.8.8 (2025-04-04 16:56:46) with PHP 8.2.28 on Darwin / 24.3.0
Reading ./composer.json (/private/tmp/composer.json)
Loading config file /Users/glaubinix/.composer/config.json
Loading config file /Users/glaubinix/.composer/auth.json
Loading config file ./composer.json (/private/tmp/composer.json)
Checked CA file /opt/homebrew/etc/ca-certificates/cert.pem: valid
Executing command (/private/tmp): 'git' 'branch' '-a' '--no-color' '--no-abbrev' '-v'
Executing command (/private/tmp): 'git' 'describe' '--exact-match' '--tags'
Executing command (CWD): 'git' '--version'
Executing command (/private/tmp): 'git' 'log' '--pretty=%H' '-n1' 'HEAD' '--no-show-signature'
Executing command (/private/tmp): 'hg' 'branch'
Executing command (/private/tmp): 'fossil' 'branch' 'list'
Executing command (/private/tmp): 'fossil' 'tag' 'list'
Executing command (/private/tmp): 'svn' 'info' '--xml'
Reading /Users/glaubinix/.composer/composer.json
Loading config file /Users/glaubinix/.composer/config.json
Loading config file /Users/glaubinix/.composer/auth.json
Loading config file /Users/glaubinix/.composer/composer.json (/Users/glaubinix/.composer/composer.json)
Loading config file /Users/glaubinix/.composer/auth.json
Reading /Users/glaubinix/.composer/auth.json
Reading /private/tmp/vendor/composer/installed.json
Reading /Users/glaubinix/.composer/vendor/composer/installed.json
Loading plugin Composer\Installers\Plugin (from composer/installers)
Searching for the specified package.
Found an exact match wpackagist-plugin/individual-multisite-author 1.0.
Creating the archive into ".".
  - Downloading wpackagist-plugin/individual-multisite-author (1.0)
Downloading https://downloads.wordpress.org/plugin/individual-multisite-author.1.0.zip
[404] https://downloads.wordpress.org/plugin/individual-multisite-author.1.0.zip
    Failed to download wpackagist-plugin/individual-multisite-author from dist: The "https://downloads.wordpress.org/plugin/individual-multisite-author.1.0.zip" file could not be downloaded (HTTP/1.1 404 Not Found)
    Now trying to download from source
Executing command (CWD): 'svn' '--version'
  - Installing wpackagist-plugin/individual-multisite-author (1.0):  Checking out tags/1.0
Executing command (CWD): 'svn' 'co' '--non-interactive' '--' 'https://plugins.svn.wordpress.org/individual-multisite-author//tags/1.0' '/var/folders/gv/xyxc9g9s77z_jv3yx6b2djlm0000gn/T/composer_archived63bb0b145'
Checked out revision 3279961.

In Filesystem.php line 372:

  [ErrorException]
  copy(/var/folders/gv/xyxc9g9s77z_jv3yx6b2djlm0000gn/T/composer_archivea623124b81.tar): Failed to open stream: No such file or dire
  ctory


Exception trace:
  at phar:///opt/homebrew/Cellar/composer/2.8.8/bin/composer/src/Composer/Util/Filesystem.php:372
 Composer\Util\ErrorHandler::handle() at n/a:n/a
 copy() at phar:///opt/homebrew/Cellar/composer/2.8.8/bin/composer/src/Composer/Util/Filesystem.php:372
 Composer\Util\Filesystem->copy() at phar:///opt/homebrew/Cellar/composer/2.8.8/bin/composer/src/Composer/Util/Filesystem.php:350
 Composer\Util\Filesystem->copyThenRemove() at phar:///opt/homebrew/Cellar/composer/2.8.8/bin/composer/src/Composer/Util/Filesystem.php:453
 Composer\Util\Filesystem->rename() at phar:///opt/homebrew/Cellar/composer/2.8.8/bin/composer/src/Composer/Package/Archiver/ArchiveManager.php:229
 Composer\Package\Archiver\ArchiveManager->archive() at phar:///opt/homebrew/Cellar/composer/2.8.8/bin/composer/src/Composer/Command/ArchiveCommand.php:143
 Composer\Command\ArchiveCommand->archive() at phar:///opt/homebrew/Cellar/composer/2.8.8/bin/composer/src/Composer/Command/ArchiveCommand.php:98
 Composer\Command\ArchiveCommand->execute() at phar:///opt/homebrew/Cellar/composer/2.8.8/bin/composer/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at phar:///opt/homebrew/Cellar/composer/2.8.8/bin/composer/vendor/symfony/console/Application.php:1040
 Symfony\Component\Console\Application->doRunCommand() at phar:///opt/homebrew/Cellar/composer/2.8.8/bin/composer/vendor/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at phar:///opt/homebrew/Cellar/composer/2.8.8/bin/composer/src/Composer/Console/Application.php:397
 Composer\Console\Application->doRun() at phar:///opt/homebrew/Cellar/composer/2.8.8/bin/composer/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at phar:///opt/homebrew/Cellar/composer/2.8.8/bin/composer/src/Composer/Console/Application.php:137
 Composer\Console\Application->run() at phar:///opt/homebrew/Cellar/composer/2.8.8/bin/composer/bin/composer:98
 require() at /opt/homebrew/Cellar/composer/2.8.8/bin/composer:29

archive [-f|--format FORMAT] [--dir DIR] [--file FILE] [--ignore-filters] [--] [<package> [<version>]]

And I expected this to happen:
Either tell me that the 1.0 tag is empty or cannot be created. Empty tar/zip would also be fine. Please note that running composer install works just fine and I'll end up with an empty directory in the vendor folder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions