Bareos Bug Tracker
Bareos Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000973bareos-core[All Projects] webuipublic2018-06-28 11:192018-08-08 13:09
Reporterjhon 
Assigned Toaron_s 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionopen 
PlatformLinuxOSCentOSOS Version7
Product Version18.3.1 
Target VersionFixed in Version 
Summary0000973: WEBUI Restore Too Many Files error caused by bad JSON [issue present at least from 17.2.4]
DescriptionI solved this issue on my 17.2.4 install but when I looked at the code in the master, I saw that this issues was "fixed". However, the "fix" in the master is not good and will also cause bad JSON to be uploaded to the webui causing the "too many files" error box.
Steps To ReproduceFor the current master branch:
- go to the restore ui
- try to open a directory without subdirectories.

For the 17.2.4 version:
- go to the restore UI
- try to open a directory containing one directory and multiple files.

Additional InformationFor the current master, the issue is on line 361 of /master/webui/module/Restore/src/Restore/Controller/RestoreController.php

[https://github.com/bareos/bareos/blob/master/webui/module/Restore/src/Restore/Controller/RestoreController.php [^]]

This line is now:
if($fnum > 0) {

This does not take into account the case when there are no subdirs in this subtree and will add a stray comma before the files json elements, causing an error in the browser.

Changing this line to
if( $tmp > 0 && $fnum > 0 ) {

solves the problem. ($tmp is set to $dnum and holds the number of directories in the subtree.

---

Additional info:

In the 17.2.4 branch, this line is actually different, but also wrong:
if( $tmp > 2 && $fnum > 0 ) {

The $tmp > 2 is wrong since directories with only 1 or 2 subdirs won't get the comma added and a JSON error complaining about that will result.
I suspect the current state of the file in master is a result of someone "fixing" this problem incorrectly.
TagsNo tags attached.
bareos-master: impactyes
bareos-master: actionwill care
bareos-17.2: impact
bareos-17.2: action
bareos-16.2: impact
bareos-16.2: action
bareos-15.2: impact
bareos-15.2: action
bareos-14.2: impact
bareos-14.2: action
bareos-13.2: impact
bareos-13.2: action
bareos-12.4: impact
bareos-12.4: action
Attached Files

- Relationships

-  Notes
(0003095)
aron_s (developer)
2018-08-08 13:09

Thank you for the report and the already fixed line.
I tested this and submitted a PR against our master branch.
Furthermore I'd like to encourage you to just open a pull request yourself the next time.
That case is likely to be handled much faster than opening a bug report here!

- Issue History
Date Modified Username Field Change
2018-06-28 11:19 jhon New Issue
2018-08-07 14:01 aron_s Assigned To => aron_s
2018-08-07 14:01 aron_s Status new => assigned
2018-08-08 13:09 aron_s bareos-master: impact => yes
2018-08-08 13:09 aron_s bareos-master: action => will care
2018-08-08 13:09 aron_s Note Added: 0003095
2018-08-08 13:09 aron_s Status assigned => resolved


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker