Page 1 of 1

Make sure MX Package Installer doesn't assume incorrect Debian version in the case of a defect

Posted: Tue Jun 17, 2025 1:51 pm
by Nokkaelaein
Now that MX-25 is nearing, I recalled this detail that you might want to check:

In the case of an unidentified version string (or not being able to read it in the first place), MX Package Installer defaults to Bullseye also on MX-23. It would be nicer if it defaulted to the current / correct version, along with an indication that this has taken place.

Search for "bullseye" in mainwindow.cpp, which contains default returns like:

Code: Select all

QString MainWindow::getDebianVerName()
{
    const auto version = getDebianVerNum();
    static const std::map<uchar, QString> versionMap
        = {{Release::Jessie, QStringLiteral("jessie")},     {Release::Stretch, QStringLiteral("stretch")},
           {Release::Buster, QStringLiteral("buster")},     {Release::Bullseye, QStringLiteral("bullseye")},
           {Release::Bookworm, QStringLiteral("bookworm")}, {Release::Trixie, QStringLiteral("trixie")}};

    if (const auto it = versionMap.find(version); it != versionMap.end()) {
        return it->second;
    }

    qWarning() << "Error: Invalid Debian version, assumes Bullseye";
    return QStringLiteral("bullseye");
}
In most cases, there is probably something more seriously wrong with the system if the version name doesn't match with any of the ones provided, so a properly serious confirmation dialog when default returning anything seems like a good idea. In any case, return the one used as the base for the current / currently running MX version (the latter would need a bit more version checking under the hood, or having the return distinct in each Package Installer available for currently supported major MX versions).

Re: Make sure MX Package Installer doesn't assume incorrect Debian version in the case of a defect

Posted: Tue Jun 17, 2025 4:22 pm
by Adrian
That was a temporary fix while we were testing Bullseye, it didn't have the regular format in /etc/debian_version so I just rigged that to return "bullseye", but you are probably right the app should fail if it doesn't detect the version and pop up a message.

Re: Make sure MX Package Installer doesn't assume incorrect Debian version in the case of a defect

Posted: Tue Jun 17, 2025 4:40 pm
by Nokkaelaein
Yep. I would suggest a dialog telling the user about what happened, and not hard failing out of the program altogether right away (if it's, for example, a defect situation in which the user already knows the version string will not be readable, but still wants to use the MXPI).

Optimally, the way I'd probably set it up, is showing a popup that informs the user about the error, and has a selector for all the values iterated from that versionMap collection of valid versions. And the user can either choose one and Continue, or Quit. I understand that's still work for something that isn't a high prio thing, and probably nobody has even bumped into this in a "real enough" scenario. Only found out about this myself when building my OS and having the /etc borked, wondering why I'm seeing MX-21 packages. But yeah.

Re: Make sure MX Package Installer doesn't assume incorrect Debian version in the case of a defect

Posted: Wed Jun 18, 2025 10:04 am
by DeepDayze
Nokkaelaein wrote: Tue Jun 17, 2025 4:40 pm Yep. I would suggest a dialog telling the user about what happened, and not hard failing out of the program altogether right away (if it's, for example, a defect situation in which the user already knows the version string will not be readable, but still wants to use the MXPI).

Optimally, the way I'd probably set it up, is showing a popup that informs the user about the error, and has a selector for all the values iterated from that versionMap collection of valid versions. And the user can either choose one and Continue, or Quit. I understand that's still work for something that isn't a high prio thing, and probably nobody has even bumped into this in a "real enough" scenario. Only found out about this myself when building my OS and having the /etc borked, wondering why I'm seeing MX-21 packages. But yeah.
That would be a good failsafe should /etc/debian_version and/or /etc/mx-version somehow gets corrupted/not readable. To me whenever an app encounters an error it should throw up a dialog with the description of the error and give users a sensible option to try to continue or cancel the operation.

Re: Make sure MX Package Installer doesn't assume incorrect Debian version in the case of a defect

Posted: Wed Jun 18, 2025 10:12 am
by Nokkaelaein
DeepDayze wrote: Wed Jun 18, 2025 10:04 am That would be a good failsafe should /etc/debian_version and/or /etc/mx-version somehow gets corrupted/not readable.
I peeked on github Adrian already made a commit about this :) ... That's cool, cheers 👍️