PackageLock Bugs #41

Closed
opened 2022-12-20 09:17:12 +00:00 by netkas · 4 comments
netkas commented 2022-12-20 09:17:12 +00:00 (Migrated from git-old.n64.cc)

There are several bugs with the PackageLock system where the runtime fails to import some packages correctly, for instance here is part of a var_dump result of a broken PackageEntry object

["Versions"]=>
  array(2) {
    [0]=>
    object(ncc\Objects\PackageLock\VersionEntry)#31 (6) {
      ["Version"]=>
      string(5) "1.0.0"
      ["Compiler"]=>
      object(ncc\Objects\ProjectConfiguration\Compiler)#32 (3) {
        ["Extension"]=>
        string(3) "php"
        ["MinimumVersion"]=>
        string(3) "8.0"
        ["MaximumVersion"]=>
        string(3) "8.2"
      }
      ["Dependencies"]=>
      array(0) {
      }
      ["ExecutionUnits"]=>
      array(0) {
      }
      ["MainExecutionPolicy"]=>
      NULL
      ["Location"]=>
      string(42) "/var/ncc/packages/net.nosial.optslib=1.0.0"
    }
    [1]=>
    object(ncc\Objects\PackageLock\VersionEntry)#33 (6) {
      ["Version"]=>
      string(5) "1.0.1"
      ["Compiler"]=>
      object(ncc\Objects\ProjectConfiguration\Compiler)#34 (3) {
        ["Extension"]=>
        string(3) "php"
        ["MinimumVersion"]=>
        string(3) "8.0"
        ["MaximumVersion"]=>
        string(3) "8.2"
      }
      ["Dependencies"]=>
      array(0) {
      }
      ["ExecutionUnits"]=>
      array(0) {
      }
      ["MainExecutionPolicy"]=>
      NULL
      ["Location"]=>
      string(1) "1"
    }
  }
  ["UpdateSource"]=>
  NULL
}

Issue 1

Location in the second object (or second iteration) points to a incorrect location, rather than the actual package path.

["Location"] => string(1) "1"

Issue 2

The update source is not implemented correctly.

["UpdateSource"] => NULL
There are several bugs with the PackageLock system where the runtime fails to import some packages correctly, for instance here is part of a var_dump result of a broken PackageEntry object ```php ["Versions"]=> array(2) { [0]=> object(ncc\Objects\PackageLock\VersionEntry)#31 (6) { ["Version"]=> string(5) "1.0.0" ["Compiler"]=> object(ncc\Objects\ProjectConfiguration\Compiler)#32 (3) { ["Extension"]=> string(3) "php" ["MinimumVersion"]=> string(3) "8.0" ["MaximumVersion"]=> string(3) "8.2" } ["Dependencies"]=> array(0) { } ["ExecutionUnits"]=> array(0) { } ["MainExecutionPolicy"]=> NULL ["Location"]=> string(42) "/var/ncc/packages/net.nosial.optslib=1.0.0" } [1]=> object(ncc\Objects\PackageLock\VersionEntry)#33 (6) { ["Version"]=> string(5) "1.0.1" ["Compiler"]=> object(ncc\Objects\ProjectConfiguration\Compiler)#34 (3) { ["Extension"]=> string(3) "php" ["MinimumVersion"]=> string(3) "8.0" ["MaximumVersion"]=> string(3) "8.2" } ["Dependencies"]=> array(0) { } ["ExecutionUnits"]=> array(0) { } ["MainExecutionPolicy"]=> NULL ["Location"]=> string(1) "1" } } ["UpdateSource"]=> NULL } ``` ### Issue 1 Location in the second object (or second iteration) points to a incorrect location, rather than the actual package path. ```php ["Location"] => string(1) "1" ``` ### Issue 2 The update source is not implemented correctly. ```php ["UpdateSource"] => NULL ```
netkas commented 2022-12-20 09:17:13 +00:00 (Migrated from git-old.n64.cc)

assigned to @netkas

assigned to @netkas
netkas commented 2022-12-20 09:17:42 +00:00 (Migrated from git-old.n64.cc)

changed the description

changed the description
netkas commented 2022-12-20 20:00:24 +00:00 (Migrated from git-old.n64.cc)

mentioned in commit 1b5991425d

mentioned in commit 1b5991425df6ac07b7da64c16c3f13bc6ef3d518
netkas commented 2022-12-20 20:02:44 +00:00 (Migrated from git-old.n64.cc)

On \ncc\Objects\PackageLock > PackageEntry > addVersion()
$version->Location = $install_path;
This is the only instance where the Location property of a VersionEntry object is set.

addVersion() is called and one of the calls passes on $install_path as "1"

Usage report of \ncc\Objects\PackageLock > PackageEntry > addVersion()
Method
addVersion

Usages in All Places  (2 usages found)
    Method call  (2 usages found)
        ncc  (2 usages found)
            src/ncc/Objects  (2 usages found)
                PackageLock.php  (2 usages found)
                    PackageLock  (2 usages found)
                        addPackage  (2 usages found)
                            65 $package_entry->addVersion($package, $install_path, true);
                            76 $this->Packages[$package->Assembly->Package]->addVersion($package, true);
  1. Shows no sign of invalid values being passed on.

On \ncc\Objects > PackageLock > addPackage()
$this->Packages[$package->Assembly->Package]->addVersion($package, true);
The argument #1 is passed on as "true" which results in the value "1" to be entered.
Update the problematic code to
$this->Packages[$package->Assembly->Package]->addVersion($package, $install_path, true);

This change seems to have fixed the issue.

On `\ncc\Objects\PackageLock > PackageEntry > addVersion()` `$version->Location = $install_path;` This is the only instance where the Location property of a `VersionEntry` object is set. `addVersion()` is called and one of the calls passes on `$install_path` as "`1`" Usage report of `\ncc\Objects\PackageLock > PackageEntry > addVersion()` Method addVersion ``` Usages in All Places (2 usages found) Method call (2 usages found) ncc (2 usages found) src/ncc/Objects (2 usages found) PackageLock.php (2 usages found) PackageLock (2 usages found) addPackage (2 usages found) 65 $package_entry->addVersion($package, $install_path, true); 76 $this->Packages[$package->Assembly->Package]->addVersion($package, true); ``` 65. Shows no sign of invalid values being passed on. 76. On `\ncc\Objects > PackageLock > addPackage()` `$this->Packages[$package->Assembly->Package]->addVersion($package, true);` The argument #1 is passed on as "true" which results in the value "1" to be entered. Update the problematic code to `$this->Packages[$package->Assembly->Package]->addVersion($package, $install_path, true);` This change seems to have fixed the issue.
netkas (Migrated from git-old.n64.cc) closed this issue 2022-12-20 20:02:45 +00:00
Sign in to join this conversation.
No description provided.