After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 692246 - unattended-installer: Be less strict about driver arch
unattended-installer: Be less strict about driver arch
Status: RESOLVED FIXED
Product: gnome-boxes
Classification: Applications
Component: installer
unspecified
Other All
: Normal normal
: --
Assigned To: GNOME Boxes maintainer(s)
GNOME Boxes maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-01-22 00:57 UTC by Zeeshan Ali
Modified: 2016-03-31 13:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add utility function to compare CPU architectures (2.71 KB, patch)
2013-01-22 01:00 UTC, Zeeshan Ali
needs-work Details | Review
unattended-installer: Be less strict about driver arch (1.41 KB, patch)
2013-01-22 01:00 UTC, Zeeshan Ali
none Details | Review
Add utility function to compare CPU architectures (4.58 KB, patch)
2013-01-22 21:04 UTC, Zeeshan Ali
committed Details | Review
unattended-installer: Be less strict about driver arch (1.47 KB, patch)
2013-01-22 21:04 UTC, Zeeshan Ali
committed Details | Review

Description Zeeshan Ali 2013-01-22 00:57:25 UTC
See patches
Comment 1 Zeeshan Ali 2013-01-22 01:00:49 UTC
Created attachment 234058 [details] [review]
Add utility function to compare CPU architectures
Comment 2 Zeeshan Ali 2013-01-22 01:00:55 UTC
Created attachment 234059 [details] [review]
unattended-installer: Be less strict about driver arch

This fixes the issue of "i386" drivers not being picked for "i686" OS.
Comment 3 Alexander Larsson 2013-01-22 08:50:36 UTC
Review of attachment 234058 [details] [review]:

It seems to me like this should use an enum rather than hardcoding the int values.
Comment 4 Alexander Larsson 2013-01-22 08:52:16 UTC
Review of attachment 234058 [details] [review]:

::: src/installer-media.vala
@@ +96,3 @@
     public bool is_architecture_compatible (string architecture) {
         return os_media == null || // Unknown media
+               compare_cpu_architectures (architecture, os_media.architecture) >= 0;

i.e. this woudld be compare_... () != INCOMPATIBLE
Comment 5 Alexander Larsson 2013-01-22 08:55:24 UTC
Review of attachment 234058 [details] [review]:

Actually, maybe it could be a enum bitfield?
Comment 6 Alexander Larsson 2013-01-22 08:58:18 UTC
Review of attachment 234059 [details] [review]:

::: src/unattended-installer.vala
@@ +681,3 @@
+            if (compatibility == 0 || compatibility == 1)
+                // We don't entertain compatiblity when word-size is different because 32-bit drivers
+                // are not guaranteed to work on 64-bit architectures in all OSs.

What about a "modern" (say i686) driver on an old OS? i386? 
With this code that won't be used, but is that really right? Just because an os is marked as "works on i386" doesn't mean it can't handle i686 drivers?
Comment 7 Zeeshan Ali 2013-01-22 20:55:40 UTC
Review of attachment 234059 [details] [review]:

::: src/unattended-installer.vala
@@ +681,3 @@
+            if (compatibility == 0 || compatibility == 1)
+                // We don't entertain compatiblity when word-size is different because 32-bit drivers
+                // are not guaranteed to work on 64-bit architectures in all OSs.

I just added a warning comment to the util function to avoid this misunderstanding:
    // Warning: architecture compability is not computative. e.g "i386" is compatible with "i686" but "i686" is
    // incompatible with "i386".
Comment 8 Zeeshan Ali 2013-01-22 21:04:12 UTC
Created attachment 234141 [details] [review]
Add utility function to compare CPU architectures

v2:

* Add enum for comparison results.
* Handle "i486" and "i586" as well.
Comment 9 Zeeshan Ali 2013-01-22 21:04:47 UTC
Created attachment 234142 [details] [review]
unattended-installer: Be less strict about driver arch

v2: Use enum introduced in v2 of previous patch.
Comment 10 Alexander Larsson 2013-01-24 09:12:10 UTC
Review of attachment 234141 [details] [review]:

::: src/installer-media.vala
@@ +102,3 @@
+        return compatibility == CPUArchCompatibity.IDENTICAL ||
+               compatibility == CPUArchCompatibity.COMPATIBLE ||
+               compatibility == CPUArchCompatibity.COMPATIBLE_DIFF_WORDSIZE;

This seems a bit large, why not just compatibility != INCOMPATIBLE? not a blocker issue though.
Comment 11 Alexander Larsson 2013-01-24 09:12:56 UTC
Review of attachment 234142 [details] [review]:

ack
Comment 12 Zeeshan Ali 2013-01-24 13:43:17 UTC
Review of attachment 234141 [details] [review]:

::: src/installer-media.vala
@@ +102,3 @@
+        return compatibility == CPUArchCompatibity.IDENTICAL ||
+               compatibility == CPUArchCompatibity.COMPATIBLE ||
+               compatibility == CPUArchCompatibity.COMPATIBLE_DIFF_WORDSIZE;

I'll change that. Lets agree to forget I made this mistake. :P
Comment 13 Zeeshan Ali 2013-01-24 14:00:21 UTC
Attachment 234141 [details] pushed as fb018a6 - Add utility function to compare CPU architectures
Attachment 234142 [details] pushed as 11cfd62 - unattended-installer: Be less strict about driver arch