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

Fix for updater/application.php cli fatal errors #472 #482 owncloud/core#31425 #485

Merged
merged 1 commit into from
Sep 20, 2018

Conversation

danieldjewell
Copy link
Contributor

Description

As reported in several issues, running "php updater/application.php upgrade:detect/info" results in a fatal error.

Traced issue to an unnecessary/fatal "=" in the command line being provided to "php occ" by ConfigReader.php:109. I am unsure if the issue is with the original change of this code to its current revision (f78291e#diff-ad6d84de30f605974920c65454932957 ) or if the issue is one of a Symfony framework change.

The root issue appears to be Symfony\Component\Process\Process by way of occRunner->runJson interpreting the array as a key-value pair with an empty argument. This results in the argument to "occ" changing from '--private' to '--private=' ... resulting in a fatal error in "occ" and thus a fatal error in "updater/application.php".

Example cmd line: [commandline:Symfony\Component\Process\Process:private] => php /path/occ --no-warnings config:list --output=json '--private='

Nevertheless, changing ConfigReader.php:109 to simply remove the associative array assignment of an empty string (e.g. ** => '' **) appears to fix the issue.

Related Issue

Motivation and Context

I am unsure when this actually stopped working - presumably, when the original commit was made 2 years ago, it worked. My only guess is a regression and/or change in the Symfony framework process code -- or a commit/change to "occ" to make it perform more strict command line argument testing.

This proposed pull fixes the immediate issues with updater/application.php being 99.9% broken -- however, there may be other regressions/effects by the ultimate root cause that was the source of this.

How Has This Been Tested?

  • test environment 1: Ubuntu 16.04/PHP 7.0/Owncloud 10.0.9 Stable
  • test environment 2: Ubuntu 18.04/PHP 7.2/Owncloud 10.0.9 Stable
  • test case 1: run "sudo -u www-data php updater/application.php upgrade:info"
  • test result 1: it works! no more fatal error.
  • other impacts: I do not believe this would impact other code since it only changes one function in the updater

Screenshots (if appropriate):

See issues for details.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests

Checklist:

  • [#] Code changes
  • [?] Unit tests added
  • [?] Acceptance tests added
  • [?] Documentation ticket raised:
    Do we really need the above for this?

Open tasks:

  • Backport (if applicable set "backport-request" label and remove when the backport was done)

…d#453 - and owncloud/core/#31425) - when running application.php from command line, fatal error occurs.

Traced issue to an unnecessary/fatal "=" in the command line being provided to "php occ" by ConfigReader.php:109. I am unsure if the issue is with the original change of this code to its current revision (owncloud@f78291e#diff-ad6d84de30f605974920c65454932957 ) or if the issue is one of a Symfony framework change.

The root issue appears to be Symfony\Component\Process\Process by way of occRunner->runJson interpreting the array as a key-value pair with an empty argument.

Example cmd line:    [commandline:Symfony\Component\Process\Process:private] => php /path/occ --no-warnings config:list --output=json '--private='

Nevertheless, changing ConfigReader.php:109 to simply remove the associative array assignment of an empty string (e.g. ** => '' **) appears to fix the issue.

I have tested this change on OC 10.0.9/Ubuntu 18.04/PHP 7.2 and the error is resolved and the command line changes to remove the "=".
@danieldjewell
Copy link
Contributor Author

More notes are in #482 - more analysis appears to be that this commit fixes an incorrect implementation of the parsing code as implemented in https://github.com/owncloud/updater/blob/master/src/Utils/OccRunner.php#L73-L80

@VicDeo
Copy link
Member

VicDeo commented Sep 20, 2018

@danieldjewell thanks a lot for taking this over!
Tested in CLI/Web UI and works

@VicDeo VicDeo merged commit 851f7c6 into owncloud:master Sep 20, 2018
@VicDeo
Copy link
Member

VicDeo commented Sep 20, 2018

@danieldjewell May I ask you to submit another PR against stable10 branch?

@VicDeo VicDeo added this to the development milestone Sep 20, 2018
@VicDeo VicDeo self-assigned this Sep 20, 2018
@danieldjewell
Copy link
Contributor Author

Hey @VicDeo no problem! Sorry, haven't been on in awhile and didn't see your reply until now. Glad to help! Just confirming -- did you still need me to submit another PR against stable10?

@VicDeo
Copy link
Member

VicDeo commented Nov 21, 2018

@danieldjewell yes, please

@danieldjewell
Copy link
Contributor Author

@VicDeo done! see PR #500 - sorry it took a little while! :)

@VicDeo
Copy link
Member

VicDeo commented Feb 18, 2019

@danieldjewell thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Updating from 10.0.7.2 to 10.0.8 failed
2 participants