Skip to content

Conversation

pscheit
Copy link
Contributor

@pscheit pscheit commented Feb 23, 2025

Problem: On Linux there can be directories that contain backslashes in the name.
Repository with a folder with backslashes in it: https://github.com/psc-acme/repo19
(you cannot test this on windows)

The showed the errors:

Warning: fileperms(): stat failed for /tmp/composer_archive558c5d2d06/folder/with/backslashes/README.md 
Warning: ZipArchive::addFile(): No such file or directory

when using the ZipArchiver to create a dist file from such a git repository.

Since all backslashes were forwarded the file wasnt found anymore.
The test reproduces that.

Other way is to run this in the repo above:

psc@~/packagist/psc-acme/repo19(main)
$ composer archive --format zip -v
Cannot load Xdebug - it was already loaded
Creating the archive into ".".

In ZipArchiver.php line 55:

  [ErrorException]
  ZipArchive::addFile(): No such file or directory


Exception trace:
  at phar:///usr/local/bin/composer/src/Composer/Package/Archiver/ZipArchiver.php:55
 Composer\Util\ErrorHandler::handle() at n/a:n/a
 ZipArchive->addFile() at phar:///usr/local/bin/composer/src/Composer/Package/Archiver/ZipArchiver.php:55
 Composer\Package\Archiver\ZipArchiver->archive() at phar:///usr/local/bin/composer/src/Composer/Package/Archiver/ArchiveManager.php:222
 Composer\Package\Archiver\ArchiveManager->archive() at phar:///usr/local/bin/composer/src/Composer/Command/ArchiveCommand.php:143
 Composer\Command\ArchiveCommand->archive() at phar:///usr/local/bin/composer/src/Composer/Command/ArchiveCommand.php:98
 Composer\Command\ArchiveCommand->execute() at phar:///usr/local/bin/composer/vendor/symfony/console/Command/Command.php:298
 Symfony\Component\Console\Command\Command->run() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:1040
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:301
 Symfony\Component\Console\Application->doRun() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:397
 Composer\Console\Application->doRun() at phar:///usr/local/bin/composer/vendor/symfony/console/Application.php:171
 Symfony\Component\Console\Application->run() at phar:///usr/local/bin/composer/src/Composer/Console/Application.php:137
 Composer\Console\Application->run() at phar:///usr/local/bin/composer/bin/composer:98
 require() at /usr/local/bin/composer:29

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

@Seldaek Seldaek added this to the 2.8 milestone Feb 25, 2025
@Seldaek Seldaek added the Bug label Feb 25, 2025
@Seldaek Seldaek merged commit e44b2d8 into composer:main Feb 25, 2025
19 of 20 checks passed
@Seldaek
Copy link
Member

Seldaek commented Feb 25, 2025

Thanks

kayw-geek pushed a commit to kayw-geek/composer that referenced this pull request Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants