cweagans / composer-patches

Simple patches plugin for Composer
https://www.cweagans.net/project/composer-patches
BSD 3-Clause "New" or "Revised" License
1.53k stars 240 forks source link

UTF-8 path is not supported. #586

Open VadimkaG opened 4 months ago

VadimkaG commented 4 months ago

Verification

What were you trying to do (and why)?

In the path to my project there is a path that has UTF-8 characters in the name (the directory is called in my native language)

What happened? What did you expect to happen?

Put the project in a path with a name that contains UTF-8 characters (non-ASCII). And try applying any patch. You will receive an error that the file was not found. And the file path will be missing all the characters that are missing ASCII

Contents of composer.json

"extra": {
        "patches": {
            "drupal/webform_rest": {
                "Issue #2899902": "https://www.drupal.org/files/issues/2024-07-05/webform_rest_upload.patch"
            }
        },

Contents of patches.lock.json

-

Full output of composer patches-doctor

-

Full output of relevant Composer command with the -vvv flag added

:~/Тест (test dir)$ composer install -vvv
Running 2.6.6 (2023-12-08 18:32:26) with PHP 8.3.9 on Linux / 5.15.0-113-generic
Reading ./composer.json (/home/vadim/Тест (test dir)/composer.json)
Loading config file ./composer.json (/home/vadim/Тест (test dir)/composer.json)
Checked CA file /etc/pki/tls/certs/ca-bundle.crt does not exist or it is not a file.
Checked directory /etc/pki/tls/certs/ca-bundle.crt does not exist or it is not a directory.
Checked CA file /etc/ssl/certs/ca-certificates.crt: valid
Executing command (/home/vadim/Тест (test dir)): 'git' 'branch' '-a' '--no-color' '--no-abbrev' '-v'
Executing command (/home/vadim/Тест (test dir)): git describe --exact-match --tags
Executing command (CWD): git --version
Executing command (/home/vadim/Тест (test dir)): git log --pretty="%H" -n1 HEAD --no-show-signature
Executing command (/home/vadim/Тест (test dir)): hg branch
Executing command (/home/vadim/Тест (test dir)): fossil branch list
Executing command (/home/vadim/Тест (test dir)): fossil tag list
Executing command (/home/vadim/Тест (test dir)): svn info --xml
Failed to initialize global composer: Composer could not find the config file: /home/vadim/.config/composer/composer.json

Reading /home/vadim/Тест (test dir)/vendor/composer/installed.json
Loading plugin Composer\Installers\Plugin (from composer/installers)
Loading plugin cweagans\Composer\Patches (from cweagans/composer-patches)
Loading plugin Drupal\Composer\Plugin\Scaffold\Plugin (from drupal/core-composer-scaffold)
Loading plugin Drupal\Composer\Plugin\ProjectMessage\MessagePlugin (from drupal/core-project-message)
Reading ./composer.lock (/home/vadim/Тест (test dir)/composer.lock)
> command: Drupal\Composer\Plugin\Scaffold\Plugin->onCommand
> pre-install-cmd: cweagans\Composer\Patches->checkPatches
Gathering patches for root package.
Removing package drupal/webform_rest so that it can be re-installed and re-patched.
  - Removing drupal/webform_rest (4.1.0)
Executing async command (CWD): rm -rf '/home/vadim/Тест (test dir)/web/modules/contrib/webform_rest'
Deleting /home/vadim/Тест (test dir)/web/modules/contrib/webform_rest - deleted
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Reading ./composer.lock (/home/vadim/Тест (test dir)/composer.lock)
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.
Built pool.
Generating rules
Resolving dependencies through SAT
Looking at all rules.

Dependency resolution completed in 0.000 seconds
Package operations: 1 install, 0 updates, 0 removals
Installs: drupal/webform_rest:4.1.0
Reading /home/vadim/.cache/composer/files/drupal/webform_rest/88ca923ba6f8361a4876474dc2407db251718900.zip from cache
  - Loading drupal/webform_rest (4.1.0) from cache
> pre-package-install: cweagans\Composer\Patches->gatherPatches
Gathering patches for root package.
Gathering patches for dependencies. This might take a minute.
Found 1 patches for drupal/webform_rest.
  - Installing drupal/webform_rest (4.1.0): Extracting archive
Executing async command (CWD): '/usr/bin/unzip' -qq '/home/vadim/Тест (test dir)/vendor/composer/tmp-a092df3a8596c3bb6276fd28b04bb436.zip' -d '/home/vadim/Тест (test dir)/vendor/composer/f418a2e0'
Executing async command (CWD): rm -rf '/home/vadim/Тест (test dir)/vendor/composer/f418a2e0'
> post-package-install: cweagans\Composer\Patches->postInstall
  - Applying patches for drupal/webform_rest
    https://www.drupal.org/files/issues/2024-07-05/webform_rest_upload.patch (Issue #2899902)
Downloading https://www.drupal.org/files/issues/2024-07-05/webform_rest_upload.patch
patch '-p1' --no-backup-if-mismatch -d '/home/vadim/ (test dir)/web/modules/contrib/webform_rest' < '/tmp/6694f3a9c4f7b.patch'
Executing command (CWD): patch '-p1' --no-backup-if-mismatch -d '/home/vadim/ (test dir)/web/modules/contrib/webform_rest' < '/tmp/6694f3a9c4f7b.patch'
patch: **** Can't change to directory '/home/vadim/ (test dir)/web/modules/contrib/webform_rest' : No such file or directory

patch '-p0' --no-backup-if-mismatch -d '/home/vadim/ (test dir)/web/modules/contrib/webform_rest' < '/tmp/6694f3a9c4f7b.patch'
Executing command (CWD): patch '-p0' --no-backup-if-mismatch -d '/home/vadim/ (test dir)/web/modules/contrib/webform_rest' < '/tmp/6694f3a9c4f7b.patch'
patch: **** Can't change to directory '/home/vadim/ (test dir)/web/modules/contrib/webform_rest' : No such file or directory

patch '-p2' --no-backup-if-mismatch -d '/home/vadim/ (test dir)/web/modules/contrib/webform_rest' < '/tmp/6694f3a9c4f7b.patch'
Executing command (CWD): patch '-p2' --no-backup-if-mismatch -d '/home/vadim/ (test dir)/web/modules/contrib/webform_rest' < '/tmp/6694f3a9c4f7b.patch'
patch: **** Can't change to directory '/home/vadim/ (test dir)/web/modules/contrib/webform_rest' : No such file or directory

patch '-p4' --no-backup-if-mismatch -d '/home/vadim/ (test dir)/web/modules/contrib/webform_rest' < '/tmp/6694f3a9c4f7b.patch'
Executing command (CWD): patch '-p4' --no-backup-if-mismatch -d '/home/vadim/ (test dir)/web/modules/contrib/webform_rest' < '/tmp/6694f3a9c4f7b.patch'
patch: **** Can't change to directory '/home/vadim/ (test dir)/web/modules/contrib/webform_rest' : No such file or directory

   Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2024-07-05/webform_rest_upload.patch

> post-package-install: Drupal\Composer\Plugin\Scaffold\Plugin->postPackage
Downloading https://packages.drupal.org/8/downloads
[200] https://packages.drupal.org/8/downloads
Generating autoload files
54 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> post-install-cmd: Drupal\Composer\Plugin\Scaffold\Plugin->postCmd
Executing command (/home/vadim/Тест (test dir)/web): git ls-files --error-unmatch '/home/vadim/Тест (test dir)/web//autoload.php'
Executing command (/home/vadim/Тест (test dir)): git rev-parse --show-toplevel
> post-install-cmd: Drupal\Composer\Plugin\ProjectMessage\MessagePlugin->displayPostCreateMessage
  * Homepage: https://www.drupal.org/project/drupal
  * Support:
    * docs: https://www.drupal.org/docs/user_guide/en/index.html
    * chat: https://www.drupal.org/node/314178