Commit 94a0cd9
authored
fix: SG-42147: Fix rvpkg -remove <package_name> (#1370)
### fix: [SG-42147](https://autodesk.atlassian.net/browse/SG-42147): Fix
rvpkg -remove <package_name>
### Summarize your change.
- [X] Add `baseNameFromPackageFileName()` helper function to avoid
duplicating regex matching that was already present in
`loadPackageInfo()`
- [X] Replace all `cd()` calls with `filePath()` to make sure the path
is formed the expected way instead of failing silently
- [X] Remove unnecessary `pfile` variable that was unused in
`uninstallPackage()`
- [X] Remove unnecessary supportdir/<package_name> directory creation
just to delete it after and only call `removeRecursively()` if that
directory exists
- [X] Set `m_packages[i].file` and `m_packages[i].baseName` respectively
to the missing package path and name to make sure both values exist
before using them in `uninstallPackage()`
- [X] Validate that the incoming package to remove actually exists in
`removePackages()` to prevent logging an error about it not being
removed if it was already manually removed
### Describe the reason for the change.
When calling `rvpkg -remove <package_name>` after manually deleting the
.rvpkg for that package, the whole parent directory of the one you were
currently in would get recursively removed. Since the file did not
exist, the bare file name from rvinstall was kept instead of its
absolute path causing `uninstallPackage()` to resolved against the
current working directory. Every `cd()` into the sub-directories were
silently failing since nothing was checking the return value of the
call, so `supportdir` was left pointing at the parent of the current
working directory (because of `rdir.cdUp()`) when `removeRecursively()`
was called on it. Some other QDir errors were also shown because the
package base name would resolved to an empty string which is not a valid
directory.
### Describe what you have tested and on which operating system.
Calling `rvpkg -remove <package_name>` after manually deleting the
.rvpkg for that package was tested on Rocky Linux 9.
Signed-off-by: Éloïse Brosseau <eloise.brosseau@autodesk.com>1 parent 6a3af6e commit 94a0cd9
1 file changed
Lines changed: 32 additions & 40 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
23 | 38 | | |
24 | 39 | | |
25 | 40 | | |
| |||
812 | 827 | | |
813 | 828 | | |
814 | 829 | | |
815 | | - | |
816 | | - | |
817 | | - | |
818 | | - | |
819 | | - | |
820 | | - | |
821 | | - | |
822 | | - | |
823 | 830 | | |
824 | | - | |
825 | | - | |
826 | | - | |
827 | | - | |
828 | | - | |
829 | | - | |
830 | | - | |
831 | | - | |
| 831 | + | |
832 | 832 | | |
833 | | - | |
834 | | - | |
835 | | - | |
836 | | - | |
837 | | - | |
838 | | - | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
839 | 841 | | |
840 | 842 | | |
841 | 843 | | |
| |||
988 | 990 | | |
989 | 991 | | |
990 | 992 | | |
991 | | - | |
| 993 | + | |
| 994 | + | |
992 | 995 | | |
| 996 | + | |
993 | 997 | | |
994 | 998 | | |
995 | 999 | | |
| |||
1351 | 1355 | | |
1352 | 1356 | | |
1353 | 1357 | | |
1354 | | - | |
1355 | | - | |
1356 | | - | |
1357 | | - | |
1358 | | - | |
1359 | | - | |
1360 | | - | |
1361 | | - | |
1362 | | - | |
1363 | | - | |
1364 | | - | |
1365 | | - | |
1366 | | - | |
1367 | | - | |
| 1358 | + | |
1368 | 1359 | | |
1369 | 1360 | | |
1370 | 1361 | | |
| |||
1506 | 1497 | | |
1507 | 1498 | | |
1508 | 1499 | | |
1509 | | - | |
| 1500 | + | |
| 1501 | + | |
1510 | 1502 | | |
1511 | 1503 | | |
1512 | 1504 | | |
1513 | 1505 | | |
1514 | 1506 | | |
1515 | | - | |
| 1507 | + | |
1516 | 1508 | | |
1517 | 1509 | | |
1518 | 1510 | | |
| |||
1863 | 1855 | | |
1864 | 1856 | | |
1865 | 1857 | | |
1866 | | - | |
| 1858 | + | |
1867 | 1859 | | |
1868 | 1860 | | |
1869 | 1861 | | |
| |||
0 commit comments