junstyle / vscode-php-cs-fixer

PHP CS Fixer extension for VS Code
https://marketplace.visualstudio.com/items?itemName=junstyle.php-cs-fixer
MIT License
355 stars 43 forks source link

EACCES fail on spawn .../php-cs-fixer when attempt to fix/format a document #200

Closed pgnd closed 1 year ago

pgnd commented 1 year ago

i run

Version: 1.77.0
Commit: 7f329fe6c66b0f86ae1574c2911b681ad5a45d63
Date: 2023-03-29T10:05:35.165Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Linux x64 6.2.8-200.fc37.x86_64
Sandboxed: No

with

composer -V
    Composer version 2.5.5 2023-03-21 11:50:05

which php
    /usr/bin/php

php -v
    PHP 8.2.4 (cli) (built: Mar 14 2023 16:11:05) (NTS gcc x86_64)
    Copyright (c) The PHP Group
    Zend Engine v4.2.4, Copyright (c) Zend Technologies
        with Zend OPcache v8.2.4, Copyright (c), by Zend Technologies
        with Xdebug v3.2.1, Copyright (c) 2002-2023, by Derick Rethans

and

php cs fixer
    v0.3.9

composer global show friendsofphp/php-cs-fixer
    Changed current directory to /var/lib/wwwrun/.config/composer
    name     : friendsofphp/php-cs-fixer
    descrip. : A tool to automatically fix PHP code style
    keywords : Static code analysis, fixer, standards, static analysis
    versions : * v3.16.0
    type     : application
    license  : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
    homepage :
    source   : [git] https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git d40f9436e1c448d309fa995ab9c14c5c7a96f2dc
    dist     : [zip] https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/d40f9436e1c448d309fa995ab9c14c5c7a96f2dc d40f9436e1c448d309fa995ab9c14c5c7a96f2dc
    path     : /var/lib/wwwrun/.config/composer/vendor/friendsofphp/php-cs-fixer
    names    : friendsofphp/php-cs-fixer

    support
    issues : https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues
    source : https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.16.0
    ...

ls -al  /var/lib/wwwrun/.config/composer/vendor/friendsofphp/php-cs-fixer/php-cs-fixer /var/lib/wwwrun/.config/composer/vendor/bin/php-cs-fixer
    -rwxrwxr-x+ 1 wwwrun www 3.3K Apr  3 06:16 /var/lib/wwwrun/.config/composer/vendor/bin/php-cs-fixer*
    -rwxr-xr-x+ 1 wwwrun www 3.4K Apr  2 15:30 /var/lib/wwwrun/.config/composer/vendor/friendsofphp/php-cs-fixer/php-cs-fixer*

/var/lib/wwwrun/.config/composer/vendor/bin/php-cs-fixer -V
    PHP CS Fixer 3.16.0 BoY42 by Fabien Potencier and Dariusz Ruminski.
    PHP runtime: 8.2.4

/var/lib/wwwrun/.config/composer/vendor/friendsofphp/php-cs-fixer/php-cs-fixer -V
    PHP CS Fixer 3.16.0 BoY42 by Fabien Potencier and Dariusz Ruminski.
    PHP runtime: 8.2.4

for my VSCode WorkSpace,

[
    {
        "name": "TestingWorkspace",
        "rootPath": "/home/dev/workspaces/vscode/TestingWorkspace.code-workspace",
        "paths": [],
        "tags": [],
        "enabled": true
    },
    {

any attempt to 'Format', or fix with php-cs, FAILs,

[
  "fix",
  "--using-cache=no",
  "--format=json",
  "--rules=@PER",
  "--path-mode=override",
  "/tmp/pcf-tmp0.07924350350536202/console.php"
]
{
  "errno": -13,
  "code": "EACCES",
  "syscall": "spawn /var/lib/wwwrun/.config/composer/vendor/bin/php-cs-fixer",
  "path": "/var/lib/wwwrun/.config/composer/vendor/bin/php-cs-fixer",
  "spawnargs": [
    "fix",
    "--using-cache=no",
    "--format=json",
    "--rules=@PER",
    "--path-mode=override",
    "/tmp/pcf-tmp0.07924350350536202/console.php"
  ]
}

where

ls -ald /tmp
    drwxrwxrwt 27 root root 960 Apr  3 17:33 /tmp/

i only see such EACCES fails with vscode-php-cs-fixer i'm not convinced this EACCES originates with this extension but suspect that it's uniquely (in my env) sensitive to a perms problem

question is -- what? or at least, what to check for more detail?

jardakotesovec commented 1 year ago

@pgnd how you solved it?