Reviewing multiple build files of multiple AUR packages visually leaks files into the review window of latter AUR packages
Pamac --version
Pamac 10.5.0-1 - libpamac 11.5.0-1
Variant in use
GUI
Distribution
Manjaro
Desktop environment
XFCE
What's not working
While reviewing multiple build files of multiple AUR packages, files visually leak from the previously reviewed package into the next.
This doesn't affect the actual build process, however it makes reviewing packages (=> auditing for the sake of security) way more cumbersome, since users don't know if the file shown to them is actually part of the currently reviewed package or not.
How to reproduce?
- Select multiple AUR packages that contain multiple build files for installation (e.g.
visual-studio-code-bin
andopenboard
) - Click "Apply" button
- In the "Transaction Summary" dialog select "Edit build files"
- You'll be shown the first set of build files related to the first reviewed package - click the "Save" or "Cancel" button (doesn't matter which one)
- The dialog changes its title to indicate that the build files of the next package are shown. The build files of the next package are shown, however there are also remnant files of the previous package listed as tabs.
More information (optional)
I don't know the Vala Programming language, however I believe the problem exists because of the following code segment in transaction-gtk.vala
int num_pages = build_files_notebook.get_n_pages ();
for (int i = 0; i < num_pages; i++) {
build_files_notebook.remove_page (i);
}
A similar code segment exists at https://gitlab.manjaro.org/applications/pamac/-/blob/400dc79aea340b425432818d1071ae915c23e501/src/transaction-gtk.vala#L962-965
The problem I see with this is that the total number of tabs (I believe those are the pages of the notebook) is stored in advance in num_pages
and then you iterate with i
from page 0 to one smaller than num_pages
and remove the page at index i
. However if you start at 0 and iterate forwards, instead of starting at the end and iterating backwards, you are changing the indexes of the latter pages. (e.g. when you remove the page at index 0, the index of all other pages will decrement by one, since the second page (previously index 1) is now the first page (now index 0)).
This leads to situations where it will try to remove pages at indexes where no page exists anymore.
I don't know if this is the actual reason for the problem (and I have no build environment to check and fix it myself), however as a programmer I would think that the following code doesn't have this problem:
int num_pages = build_files_notebook.get_n_pages ();
for (int i = num_pages-1; i >= 0; i--) {
build_files_notebook.remove_page (i);
}
You could also iterate forwards and use remove_page(-1)
which removes the last page with each iteration according to the gtk3 documentation.
The same problem also occurs when you just view the build files of a package normally (without any installation intentions). Steps to reproduce:
- Open
pamac-manager
(GUI) - Search for "openboard"
- Select the
openboard
AUR package in the search results - Select "Build files" where it says "Details", "Dependencies", "Files", "Build files".
- The
openboard
build files will be shown (PKGBUILD
,openboard.desktop
,qchar.patch
,quazip.patch
,drop_ThirdParty_repo.patch
,ffmpeg.patch
) - Select
openboardview
from the search results - Select "Build files" where it says "Details", "Dependencies", "Files", "Build files".
- It shows
openboard.desktop
,quazip.patch
,ffmpeg.patch
,PKGBUILD
(PKGBUILD ofopenboardview
) - even though openboardview only has a PKGBUILD.