Skip to content

[Bug]: IMigrationStep progress bar does not advance(), error found in ConsoleOutput.php #35960

@birnbacs

Description

@birnbacs

⚠️ This issue respects the following points: ⚠️

  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • Nextcloud Server is running on 64bit capable CPU, PHP and OS.
  • I agree to follow Nextcloud's Code of Conduct.

Bug description

Nextcloud's migration system supports Repair Steps for db maintenance.
IMigrationStep offers a progress bar for console output.
The progress bar is a Symfony\Component\Console\Helper\ProgressBar component.

The progress bar does not advance when the advance() method is called.
Displayed is a series of empty bars and one final full bar.

Here is the cause:

In nextcloud/server/lib/private/Migration/ConsoleOutput.php #78 (function advance()) the call to the symfony object is wrong. The line reads:
if (!is_null($this->progressBar)) {
but it should read:
if (is_null($this->progressBar)) {
(note the missing negation)

Two more things: the second argument to NC's advance() method is not output at all and no newline character is appended to the output so the progress bars are all in the same line.

Steps to reproduce

  1. create class MyRepairStep: https://docs.nextcloud.com/server/19/developer_manual/app/repair.html?highlight=advance
  2. create schema file '000001Date20220303134500' that calls the created MyRepairStep in PostSchemaChange()
  3. trigger the migration manually: sudo -u www occ migrations:execute MyApp 000001Date20220303134500

Expected behavior

output should read roughly like this:
This step will take 10 seconds. 0/10 [>---------------------------] 1/10 [->--------------------------] 2/10 [-->-------------------------] 3/10 [--->------------------------] 4/10 [---->-----------------------] 5/10 [----->----------------------] 6/10 [------>---------------------] 7/10 [------->--------------------] 8/10 [-------->-------------------] 9/10 [--------->------------------] 1 [============================]

Installation method

Community Manual installation with Archive

Operating system

Other

PHP engine version

PHP 8.1

Web server

Nginx

Database engine version

PostgreSQL

Is this bug present after an update or on a fresh install?

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "defaultapp": "abakus,files",
        "default_language": "de",
        "debug": true,
        "apps_paths": [
            {
                "path": "\/usr\/local\/www\/nextcloud\/apps",
                "url": "\/apps",
                "writable": true
            },
            {
                "path": "\/usr\/local\/www\/nextcloud\/apps-pkg",
                "url": "\/apps-pkg",
                "writable": false
            }
        ],
        "logfile": "\/var\/log\/nextcloud\/nextcloud.log",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "192.168.245.51",
            "devcloud.here.us",
            "devcloud01.here.us"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "25.0.0.18",
        "overwrite.cli.url": "https:\/\/devcloud01.here.us",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "app_install_overwrite": [
            "notestutorial",
            "apporder"
        ],
        "maintenance": false,
        "theme": "",
        "loglevel": 2
    }
}

List of activated Apps

Enabled:
  - abakus: 0.2.1
  - circles: 25.0.0
  - cloud_federation_api: 1.8.0
  - comments: 1.15.0
  - contactsinteraction: 1.6.0
  - dav: 1.24.0
  - federatedfilesharing: 1.15.0
  - federation: 1.15.0
  - files: 1.20.1
  - files_pdfviewer: 2.6.0
  - files_rightclick: 1.4.0
  - files_sharing: 1.17.0
  - files_trashbin: 1.15.0
  - files_versions: 1.18.0
  - firstrunwizard: 2.14.0
  - logreader: 2.10.0
  - lookup_server_connector: 1.13.0
  - nextcloud_announcements: 1.14.0
  - notestutorial: 18.0.0
  - notifications: 2.13.1
  - oauth2: 1.13.0
  - password_policy: 1.15.0
  - privacy: 1.9.0
  - provisioning_api: 1.15.0
  - recommendations: 1.4.0
  - related_resources: 1.0.3
  - serverinfo: 1.15.0
  - settings: 1.7.0
  - sharebymail: 1.15.0
  - support: 1.8.0
  - systemtags: 1.15.0
  - text: 3.6.0
  - theming: 2.0.0
  - twofactor_backupcodes: 1.14.0
  - updatenotification: 1.15.0
  - user_status: 1.5.0
  - viewer: 1.9.0
  - weather_status: 1.5.0
  - workflowengine: 2.7.0
Disabled:
  - activity: 2.17.0
  - admin_audit
  - bruteforcesettings
  - dashboard: 7.5.0
  - encryption
  - files_external
  - photos: 2.0.0
  - survey_client: 1.13.0
  - suspicious_login
  - twofactor_totp
  - user_ldap

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

Bug found in nextcloud/server/lib/private/Migration/ConsoleOutput.php #78 (see bug description)

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmap25-feedbackbug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions