Open ericgaspar opened 1 year ago
!testme
!testme
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Aborting as no plugin should be loaded if running as super user is not explicitly allowed
Odd, I thought ynh_install_composer
automatically dealt with the privileges issue?
It does not!
https://yunohost.org/en/packaging_apps_helpers#ynh-composer-exec and its "Dude, show me the code!" link: https://github.com/YunoHost/yunohost/blob/19eb48b6e73267685e1417122ac47908c1cf2472/helpers/php#L490
There is no ynh_exec_as
or sudo -u $app
in there.
However, I am surprised other apps like Flarum have not triggered that warning and failure...
Hey @ericgaspar , mind if I upload a patch to this branch to solve the ynh_install_composer
issue (and continue the packaging), or would you rather do it yourself?
!testme
Sorry about that, I just found that php-symfony-mercure
is only shipped on Debian 12 or higher.
!testme
Another snag we hit: turns out that I can't simply chain ynh_exec_as
and ynh_install_composer
- the latter doesn't get properly escaped. Any ideas?
101202 INFO INFO - [#######++++.........] > Installing kbin with Composer...
101202 INFO DEBUG - + ynh_exec_as kbin ynh_install_composer
101202 INFO DEBUG - + local user=kbin
101202 INFO DEBUG - + shift 1
101202 INFO DEBUG - ++ whoami
101202 INFO DEBUG - + [[ kbin = root ]]
101202 INFO DEBUG - + sudo -u kbin ynh_install_composer
101202 INFO WARNING - sudo: ynh_install_composer: command not found
OK I think I have an idea of what happened. ynh_install_composer
does not require the ynh_exec_as
, but the rest of the commands do. !testme
!testme
Never mind, the Composer commands also fail here. Any clues on how to make it run as the app user instead of root, while correctly escaping the YNH macros?
I had to go and browse an old version of flarum_ynh
's repository to get a version of ynh_install_composer
that did allow to set the user that would run the application. So, I had to manually import it into the repository.
!testme
!testme
!testme
So we still have to bind $final_path
- how did this helper even work in the first place?
!testme
!testme
!testme
!testme
!testme
!testme
!testme
!testme
!testme
Bingo:
WARNING Invalid argument dump-env prod. Use "composer require dump-env prod" instead to add packages to your composer.json.
!testme
To confirm - is this pull request still in progress? @ericgaspar
!testme
!testme
Problem
Solution
PR Status
Automatic tests
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ after creating the PR, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)