snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
10.84k stars 3.14k forks source link

Unable to update - finding extra files #15018

Open kwoodVisions opened 2 months ago

kwoodVisions commented 2 months ago

Debug mode

Describe the bug

I attempted to update after making sure I had PHP8.1 or greater and I'm getting the following error message:

error: The following untracked working tree files would be overwritten by merge: app/Http/Requests/UploadFileRequest.php app/Http/Traits/MigratesLegacyAssetLocations.php database/migrations/2024_02_28_080016_add_created_by_to_permission_groups.php database/migrations/2024_02_28_093807_add_min_qty_to_licenses.php resources/lang/aa-ER/account/general.php resources/lang/aa-ER/admin/accessories/general.php resources/lang/aa-ER/admin/accessories/message.php resources/lang/aa-ER/admin/accessories/table.php resources/lang/aa-ER/admin/asset_maintenances/form.php resources/lang/aa-ER/admin/asset_maintenances/general.php resources/lang/aa-ER/admin/asset_maintenances/message.php resources/lang/aa-ER/admin/asset_maintenances/table.php resources/lang/aa-ER/admin/categories/general.php resources/lang/aa-ER/admin/categories/message.php resources/lang/aa-ER/admin/categories/table.php resources/lang/aa-ER/admin/companies/general.php resources/lang/aa-ER/admin/companies/message.php resources/lang/aa-ER/admin/companies/table.php resources/lang/aa-ER/admin/components/general.php resources/lang/aa-ER/admin/components/message.php resources/lang/aa-ER/admin/components/table.php resources/lang/aa-ER/admin/consumables/general.php resources/lang/aa-ER/admin/consumables/message.php resources/lang/aa-ER/admin/consumables/table.php resources/lang/aa-ER/admin/custom_fields/general.php resources/lang/aa-ER/admin/custom_fields/message.php resources/lang/aa-ER/admin/departments/message.php resources/lang/aa-ER/admin/departments/table.php resources/lang/aa-ER/admin/depreciations/general.php resources/lang/aa-ER/admin/depreciations/message.php resources/lang/aa-ER/admin/depreciations/table.php resources/lang/aa-ER/admin/groups/message.php resources/lang/aa-ER/admin/groups/table.php resources/lang/aa-ER/admin/groups/titles.php resources/lang/aa-ER/admin/hardware/form.php resources/lang/aa-ER/admin/hardware/general.php resources/lang/aa-ER/admin/hardware/message.php resources/lang/aa-ER/admin/hardware/table.php resources/lang/aa-ER/admin/kits/general.php resources/lang/aa-ER/admin/labels/message.php resources/lang/aa-ER/admin/labels/table.php resources/lang/aa-ER/admin/licenses/form.php resources/lang/aa-ER/admin/licenses/general.php resources/lang/aa-ER/admin/licenses/message.php resources/lang/aa-ER/admin/licenses/table.php resources/lang/aa-ER/admin/locations/message.php resources/lang/aa-ER/admin/locations/table.php resources/lang/aa-ER/admin/manufacturers/message.php resources/lang/aa-ER/admin/manufacturers/table.php resources/lang/aa-ER/admin/models/general.php resources/lang/aa-ER/admin/models/message.php resources/lang/aa-ER/admin/models/table.php resources/lang/aa-ER/admin/reports/general.php resources/lang/aa-ER/admin/reports/message.php resources/lang/aa-ER/admin/settings/general.php resources/lang/aa-ER/admin/settings/message.php resources/lang/aa-ER/admin/settings/table.php resources/lang/aa-ER/admin/statuslabels/message.php resources/lang/aa-ER/admin/statuslabels/table.php resources/lang/aa-ER/admin/suppliers/message.php resources/lang/aa-ER/admin/suppliers/table.php resources/lang/aa-ER/admin/users/general.php resources/lang/aa-ER/admin/users/message.php resources/lang/aa-ER/admin/users/table.php resources/lang/aa-ER/auth.php resources/lang/aa-ER/auth/general.php resources/lang/aa-ER/auth/message.php resources/lang/aa-ER/button.php resources/lang/aa-ER/general.php resources/lang/aa-ER/help.php resources/lang/aa-ER/localizations.php resources/lang/aa-ER/mail.php resources/lang/aa-ER/pagination.php resources/lang/aa-ER/passwords.php resources/lang/aa-ER/reminders.php resources/lang/aa-ER/table.php resources/lang/aa-ER/validation.php resources/views/locations/bulk-delete.blade.php resources/views/partials/locations-bulk-actions.blade.php sample_csvs/components-sample.csv tests/Unit/Models/Company/CompanyTest.php tests/Unit/Models/Company/GetIdForCurrentUserTest.php Please move or remove them before you merge. Aborting

Reproduction steps

  1. Run git pull
  2. The error above is displayed...

Expected behavior

I'm expecting it to update Snipe-IT

Screenshots

NA

Snipe-IT Version

6.3.0

Operating System

Ubuntu 20.04

Web Server

Apache

PHP Version

8.1

Operating System

No response

Browser

No response

Version

No response

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

error: The following untracked working tree files would be overwritten by merge:
        app/Http/Requests/UploadFileRequest.php
        app/Http/Traits/MigratesLegacyAssetLocations.php
        database/migrations/2024_02_28_080016_add_created_by_to_permission_groups.php
        database/migrations/2024_02_28_093807_add_min_qty_to_licenses.php
        resources/lang/aa-ER/account/general.php
        resources/lang/aa-ER/admin/accessories/general.php
        resources/lang/aa-ER/admin/accessories/message.php
        resources/lang/aa-ER/admin/accessories/table.php
        resources/lang/aa-ER/admin/asset_maintenances/form.php
        resources/lang/aa-ER/admin/asset_maintenances/general.php
        resources/lang/aa-ER/admin/asset_maintenances/message.php
        resources/lang/aa-ER/admin/asset_maintenances/table.php
        resources/lang/aa-ER/admin/categories/general.php
        resources/lang/aa-ER/admin/categories/message.php
        resources/lang/aa-ER/admin/categories/table.php
        resources/lang/aa-ER/admin/companies/general.php
        resources/lang/aa-ER/admin/companies/message.php
        resources/lang/aa-ER/admin/companies/table.php
        resources/lang/aa-ER/admin/components/general.php
        resources/lang/aa-ER/admin/components/message.php
        resources/lang/aa-ER/admin/components/table.php
        resources/lang/aa-ER/admin/consumables/general.php
        resources/lang/aa-ER/admin/consumables/message.php
        resources/lang/aa-ER/admin/consumables/table.php
        resources/lang/aa-ER/admin/custom_fields/general.php
        resources/lang/aa-ER/admin/custom_fields/message.php
        resources/lang/aa-ER/admin/departments/message.php
        resources/lang/aa-ER/admin/departments/table.php
        resources/lang/aa-ER/admin/depreciations/general.php
        resources/lang/aa-ER/admin/depreciations/message.php
        resources/lang/aa-ER/admin/depreciations/table.php
        resources/lang/aa-ER/admin/groups/message.php
        resources/lang/aa-ER/admin/groups/table.php
        resources/lang/aa-ER/admin/groups/titles.php
        resources/lang/aa-ER/admin/hardware/form.php
        resources/lang/aa-ER/admin/hardware/general.php
        resources/lang/aa-ER/admin/hardware/message.php
        resources/lang/aa-ER/admin/hardware/table.php
        resources/lang/aa-ER/admin/kits/general.php
        resources/lang/aa-ER/admin/labels/message.php
        resources/lang/aa-ER/admin/labels/table.php
        resources/lang/aa-ER/admin/licenses/form.php
        resources/lang/aa-ER/admin/licenses/general.php
        resources/lang/aa-ER/admin/licenses/message.php
        resources/lang/aa-ER/admin/licenses/table.php
        resources/lang/aa-ER/admin/locations/message.php
        resources/lang/aa-ER/admin/locations/table.php
        resources/lang/aa-ER/admin/manufacturers/message.php
        resources/lang/aa-ER/admin/manufacturers/table.php
        resources/lang/aa-ER/admin/models/general.php
        resources/lang/aa-ER/admin/models/message.php
        resources/lang/aa-ER/admin/models/table.php
        resources/lang/aa-ER/admin/reports/general.php
        resources/lang/aa-ER/admin/reports/message.php
        resources/lang/aa-ER/admin/settings/general.php
        resources/lang/aa-ER/admin/settings/message.php
        resources/lang/aa-ER/admin/settings/table.php
        resources/lang/aa-ER/admin/statuslabels/message.php
        resources/lang/aa-ER/admin/statuslabels/table.php
        resources/lang/aa-ER/admin/suppliers/message.php
        resources/lang/aa-ER/admin/suppliers/table.php
        resources/lang/aa-ER/admin/users/general.php
        resources/lang/aa-ER/admin/users/message.php
        resources/lang/aa-ER/admin/users/table.php
        resources/lang/aa-ER/auth.php
        resources/lang/aa-ER/auth/general.php
        resources/lang/aa-ER/auth/message.php
        resources/lang/aa-ER/button.php
        resources/lang/aa-ER/general.php
        resources/lang/aa-ER/help.php
        resources/lang/aa-ER/localizations.php
        resources/lang/aa-ER/mail.php
        resources/lang/aa-ER/pagination.php
        resources/lang/aa-ER/passwords.php
        resources/lang/aa-ER/reminders.php
        resources/lang/aa-ER/table.php
        resources/lang/aa-ER/validation.php
        resources/views/locations/bulk-delete.blade.php
        resources/views/partials/locations-bulk-actions.blade.php
        sample_csvs/components-sample.csv
        tests/Unit/Models/Company/CompanyTest.php
        tests/Unit/Models/Company/GetIdForCurrentUserTest.php
Please move or remove them before you merge.
Aborting

Additional context

NA

snipe commented 2 months ago

Did you accidentally move some directories or something? There's nothing on our end that would cause that.

kwoodVisions commented 2 months ago

Did you accidentally move some directories or something? There's nothing on our end that would cause that.

I did not move anything. Last thing I did was update to 6.3 a while ago but that's it. Haven't applied any other updates or moved files.

snipe commented 2 months ago

I'm not really sure how to advise you here - there's nothing on our end that would have externally touched those files. :-/ You can I guess try git stash before the git pull and then upgrade.

kwoodVisions commented 2 months ago

Tried git stash but it didn't seem to do anything. I did "git add *" as instructed online, then git stash and git pull and it appeared to pull correctly however, when running "php upgrade.php" as the snipeitapp user I have, this is what I get:


--------------------------------------------------------
STEP 4: Backing up database:
--------------------------------------------------------

PHP Fatal error:  Uncaught Whoops\Exception\ErrorException: Using ${var} in strings is deprecated, use {$var} instead in /var/www/snipeit/vendor/facade/ignition/src/SolutionProviders/MergeConflictSolutionProvider.php:52
Stack trace:
#0 /var/www/snipeit/vendor/composer/ClassLoader.php(571): Whoops\Run->handleError()
#1 /var/www/snipeit/vendor/composer/ClassLoader.php(571): include()
#2 /var/www/snipeit/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile()
#3 [internal function]: Composer\Autoload\ClassLoader->loadClass()
#4 /var/www/snipeit/vendor/facade/ignition/src/SolutionProviders/SolutionProviderRepository.php(50): class_implements()
#5 [internal function]: Facade\Ignition\SolutionProviders\SolutionProviderRepository->Facade\Ignition\SolutionProviders\{closure}()
#6 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Collections/Arr.php(717): array_filter()
#7 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Collections/Collection.php(358): Illuminate\Support\Arr::where()
#8 /var/www/snipeit/vendor/facade/ignition/src/SolutionProviders/SolutionProviderRepository.php(49): Illuminate\Support\Collection->filter()
#9 /var/www/snipeit/vendor/nunomaduro/collision/src/Adapters/Laravel/IgnitionSolutionsRepository.php(36): Facade\Ignition\SolutionProviders\SolutionProviderRepository->getSolutionsForThrowable()
#10 /var/www/snipeit/vendor/nunomaduro/collision/src/Writer.php(244): NunoMaduro\Collision\Adapters\Laravel\IgnitionSolutionsRepository->getFromThrowable()
#11 /var/www/snipeit/vendor/nunomaduro/collision/src/Writer.php(123): NunoMaduro\Collision\Writer->renderSolution()
#12 /var/www/snipeit/vendor/nunomaduro/collision/src/Handler.php(39): NunoMaduro\Collision\Writer->write()
#13 /var/www/snipeit/vendor/filp/whoops/src/Whoops/Run.php(370): NunoMaduro\Collision\Handler->handle()
#14 [internal function]: Whoops\Run->handleException()
#15 {main}
  thrown in /var/www/snipeit/vendor/facade/ignition/src/SolutionProviders/MergeConflictSolutionProvider.php on line 52
PHP Fatal error:  Uncaught Whoops\Exception\ErrorException: Using ${var} in strings is deprecated, use {$var} instead in /var/www/snipeit/vendor/facade/ignition/src/SolutionProviders/MergeConflictSolutionProvider.php:52
Stack trace:
#0 /var/www/snipeit/vendor/composer/ClassLoader.php(571): Whoops\Run->handleError()
#1 /var/www/snipeit/vendor/composer/ClassLoader.php(571): include()
#2 /var/www/snipeit/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile()
#3 [internal function]: Composer\Autoload\ClassLoader->loadClass()
#4 /var/www/snipeit/vendor/facade/ignition/src/SolutionProviders/SolutionProviderRepository.php(50): class_implements()
#5 [internal function]: Facade\Ignition\SolutionProviders\SolutionProviderRepository->Facade\Ignition\SolutionProviders\{closure}()
#6 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Collections/Arr.php(717): array_filter()
#7 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Collections/Collection.php(358): Illuminate\Support\Arr::where()
#8 /var/www/snipeit/vendor/facade/ignition/src/SolutionProviders/SolutionProviderRepository.php(49): Illuminate\Support\Collection->filter()
#9 /var/www/snipeit/vendor/nunomaduro/collision/src/Adapters/Laravel/IgnitionSolutionsRepository.php(36): Facade\Ignition\SolutionProviders\SolutionProviderRepository->getSolutionsForThrowable()
#10 /var/www/snipeit/vendor/nunomaduro/collision/src/Writer.php(244): NunoMaduro\Collision\Adapters\Laravel\IgnitionSolutionsRepository->getFromThrowable()
#11 /var/www/snipeit/vendor/nunomaduro/collision/src/Writer.php(123): NunoMaduro\Collision\Writer->renderSolution()
#12 /var/www/snipeit/vendor/nunomaduro/collision/src/Handler.php(39): NunoMaduro\Collision\Writer->write()
#13 /var/www/snipeit/vendor/filp/whoops/src/Whoops/Run.php(370): NunoMaduro\Collision\Handler->handle()
#14 [internal function]: Whoops\Run->handleException()
#15 {main}
  thrown in /var/www/snipeit/vendor/facade/ignition/src/SolutionProviders/MergeConflictSolutionProvider.php on line 52
--
   TypeError

  Carbon\Carbon::setLastErrors(): Argument #1 ($lastErrors) must be of type array, false given, called in /var/www/snipeit/vendor/nesbot/carbon/src/Carbon/Traits/Creator.php on line 98

  at vendor/nesbot/carbon/src/Carbon/Traits/Creator.php:928
    924▕      * @param array $lastErrors
    925▕      *
    926▕      * @return void
    927▕      */
  ➜ 928▕     private static function setLastErrors(array $lastErrors)
    929▕     {
    930▕         static::$lastErrors = $lastErrors;
    931▕     }
    932▕

   Whoops\Exception\ErrorException

  Using ${var} in strings is deprecated, use {$var} instead

  at vendor/facade/ignition/src/SolutionProviders/MergeConflictSolutionProvider.php:52
     48▕     }
     49▕
     50▕     protected function getCurrentBranch(string $directory): string
     51▕     {
  ➜  52▕         $branch = "'".trim(shell_exec("cd ${directory}; git branch | grep \\* | cut -d ' ' -f2"))."'";
     53▕
     54▕         if ($branch === "''") {
     55▕             $branch = 'current branch';
     56▕         }

   Symfony\Component\ErrorHandler\Error\FatalError

  Uncaught Whoops\Exception\ErrorException: Using ${var} in strings is deprecated, use {$var} instead in /var/www/snipeit/vendor/facade/ignition/src/SolutionProviders/MergeConflictSolutionProvider.php:52
Stack trace:
#0 /var/www/snipeit/vendor/composer/ClassLoader.php(571): Whoops\Run->handleError()
#1 /var/www/snipeit/vendor/composer/ClassLoader.php(571): include()
#2 /var/www/snipeit/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile()
#3 [internal function]: Composer\Autoload\ClassLoader->loadClass()
#4 /var/www/snipeit/vendor/facade/ignition/src/SolutionProviders/SolutionProviderRepository.php(50): class_implements()
#5 [internal function]: Facade\Ignition\SolutionProviders\SolutionProviderRepository->Facade\Ignition\SolutionProviders\{closure}()
#6 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Collections/Arr.php(717): array_filter()
#7 /var/www/snipeit/vendor/laravel/framework/src/Illuminate/Collections/Collection.php(358): Illuminate\Support\Arr::where()
#8 /var/www/snipeit/vendor/facade/ignition/src/SolutionProviders/SolutionProviderRepository.php(49): Illuminate\Support\Collection->filter()
#9 /var/www/snipeit/vendor/nunomaduro/collision/src/Adapters/Laravel/IgnitionSolutionsRepository.php(36): Facade\Ignition\SolutionProviders\SolutionProviderRepository->getSolutionsForThrowable()
#10 /var/www/snipeit/vendor/nunomaduro/collision/src/Writer.php(244): NunoMaduro\Collision\Adapters\Laravel\IgnitionSolutionsRepository->getFromThrowable()
#11 /var/www/snipeit/vendor/nunomaduro/collision/src/Writer.php(123): NunoMaduro\Collision\Writer->renderSolution()
#12 /var/www/snipeit/vendor/nunomaduro/collision/src/Handler.php(39): NunoMaduro\Collision\Writer->write()
#13 /var/www/snipeit/vendor/filp/whoops/src/Whoops/Run.php(370): NunoMaduro\Collision\Handler->handle()
#14 [internal function]: Whoops\Run->handleException()
#15 {main}
  thrown

  at vendor/facade/ignition/src/SolutionProviders/MergeConflictSolutionProvider.php:52
     48▕     }
     49▕
     50▕     protected function getCurrentBranch(string $directory): string
     51▕     {
  ➜  52▕         $branch = "'".trim(shell_exec("cd ${directory}; git branch | grep \\* | cut -d ' ' -f2"))."'";
     53▕
     54▕         if ($branch === "''") {
     55▕             $branch = 'current branch';
     56▕         }

   Whoops\Exception\ErrorException

  Using ${var} in strings is deprecated, use {$var} instead

  at vendor/facade/ignition/src/SolutionProviders/MergeConflictSolutionProvider.php:52
     48▕     }
     49▕
     50▕     protected function getCurrentBranch(string $directory): string
     51▕     {
  ➜  52▕         $branch = "'".trim(shell_exec("cd ${directory}; git branch | grep \\* | cut -d ' ' -f2"))."'";
     53▕
     54▕         if ($branch === "''") {
     55▕             $branch = 'current branch';
     56▕         }

Something went wrong with your backup. Aborting!
kwoodVisions commented 2 months ago

Any other ideas?

kwoodVisions commented 1 month ago

Hey team...

Any other thoughts on this one? I haven't done anything special to the server and have always just used the automated upgrade process so I'm not certain what else could be wrong.

Is there a way for me to clean up these files and update or am I screwed? I feel like I've had other weird issues and we haven't done anything or made changes to the servers. Maybe it's because I login, then sudo su as root, then switch user to my SnipeIT user to install/update -- that's based on the permissions and settings there. I don't know if that has any impact on it.

snipe commented 1 month ago

You shouldn't ever have to run any of these things as root, and a permission change could definitely cause git to see them as changed.

I'd change the owners and permissions back down to whatever the web server user is, remove your vendors directory, try a git pull again, and then run composer install again.

snipe commented 1 month ago

The only stuff that ever needs to be run as root is when you're updating PHP itself (7.4 to 8.1 for example). The actual Snipe-IT upgrade doesn't require special permissions. Maybe @uberbrady has some additional suggestions though.

snipe commented 1 month ago

Those files it was "finding" are just new files in the repo. New languages, etc. They're expected and they should be there, pulling from our repo and you shouldn't have to commit them or anything. They come from us.