Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"clear-cache" ignores "cache-dir" defined in "composer.json" #11921

Closed
JanWennrichPCSG opened this issue Apr 5, 2024 · 0 comments
Closed

"clear-cache" ignores "cache-dir" defined in "composer.json" #11921

JanWennrichPCSG opened this issue Apr 5, 2024 · 0 comments
Labels
Milestone

Comments

@JanWennrichPCSG
Copy link

My composer.json:

{
    "name": "jan/composer-test",
    "require": {
        "ramsey/uuid": "^4.7"
    },
    "autoload": {
        "psr-4": {
            "Jan\\ComposerTest\\": "src/"
        }
    },
    "authors": [
        {
            "name": "Jan Wennrich",
            "email": "jan.wennrich@pcsg.de"
        }
    ],
    "config": {
        "cache-dir": "/tmp/composer-cache"
    }
}

Output of composer diagnose:

Composer could not detect the root package (jan/composer-test) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
Checking composer.json: WARNING
No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.
Checking platform settings: OK
Checking git settings: OK git version 2.39.3
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
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.7.2
PHP version: 8.2.17
PHP binary path: /opt/homebrew/Cellar/php@8.2/8.2.17/bin/php
OpenSSL version: OpenSSL 3.2.1 30 Jan 2024
cURL version: 8.7.1 libz 1.2.12 ssl (SecureTransport) OpenSSL/3.2.1
zip: extension present, unzip present, 7-Zip present (7z)

When I run this command:

composer cc -vvv

I get the following output:

Running 2.7.2 (2024-03-11 17:12:18) with PHP 8.2.17 on Darwin / 23.4.0
Reading ./composer.json (/private/tmp/composer-test/composer.json)
Loading config file ./composer.json (/private/tmp/composer-test/composer.json)
Checked CA file /opt/homebrew/etc/ca-certificates/cert.pem: valid
Executing command (/private/tmp/composer-test): 'git' 'branch' '-a' '--no-color' '--no-abbrev' '-v'
Executing command (/private/tmp/composer-test): git describe --exact-match --tags
Executing command (CWD): git --version
Executing command (/private/tmp/composer-test): git log --pretty="%H" -n1 HEAD --no-show-signature
Executing command (/private/tmp/composer-test): hg branch
Executing command (/private/tmp/composer-test): fossil branch list
Executing command (/private/tmp/composer-test): fossil tag list
Executing command (/private/tmp/composer-test): svn info --xml
Composer could not detect the root package (jan/composer-test) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
Failed to initialize global composer: Composer could not find the config file: /Users/jan/.composer/composer.json

Reading ./composer.lock (/private/tmp/composer-test/composer.lock)
Reading /private/tmp/composer-test/vendor/composer/installed.json
Cache directory does not exist (cache-vcs-dir):
Cache directory does not exist (cache-repo-dir):
Clearing cache (cache-files-dir): /Users/jan/Library/Caches/composer/files
Clearing cache (cache-dir): /Users/jan/Library/Caches/composer
All caches cleared.

And I expected this to happen:

The cache directory (/tmp/composer-cache) - as defined in the config.cache-dir property in the composer.json - should be cleared.

Instead my global cache directory (/Users/jan/Library/Caches/composer) is cleared.

When installing packages, I see the /tmp/composer-cache directory being populated with files.

The config --list command also outputs that directory as the cache-dir config value:

❯ composer config --list
Composer could not detect the root package (jan/composer-test) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
[repositories.packagist.org.type] composer
[repositories.packagist.org.url] https://repo.packagist.org
[process-timeout] 300
[use-include-path] false
[use-parent-dir] prompt
[preferred-install] dist
[audit.abandoned] fail
[notify-on-install] true
[github-protocols] [https, ssh]
[gitlab-protocol]
[vendor-dir] vendor (/private/tmp/composer-test/vendor)
[bin-dir] {$vendor-dir}/bin (/private/tmp/composer-test/vendor/bin)
[cache-dir] /tmp/composer-cache
[data-dir] /Users/jan/.composer
[cache-files-dir] {$cache-dir}/files (/tmp/composer-cache/files)
[cache-repo-dir] {$cache-dir}/repo (/tmp/composer-cache/repo)
[cache-vcs-dir] {$cache-dir}/vcs (/tmp/composer-cache/vcs)
[cache-ttl] 15552000
[cache-files-ttl] 15552000
[cache-files-maxsize] 300MiB (314572800)
[cache-read-only] false
[bin-compat] auto
[discard-changes] false
[autoloader-suffix]
[sort-packages] false
[optimize-autoloader] false
[classmap-authoritative] false
[apcu-autoloader] false
[prepend-autoloader] true
[github-domains] [github.com]
[bitbucket-expose-hostname] true
[disable-tls] false
[secure-http] true
[cafile]
[capath]
[github-expose-hostname] true
[gitlab-domains] [gitlab.com]
[store-auths] prompt
[archive-format] tar
[archive-dir] .
[htaccess-protect] true
[use-github-api] true
[lock] true
[platform-check] php-only
[home] /Users/jan/.composer
@Seldaek Seldaek added the Bug label Apr 15, 2024
@Seldaek Seldaek added this to the 2.7 milestone Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants