New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"timezone" HVM pref still doesn't work #1437

Open
mattmccutchen opened this Issue Nov 19, 2015 · 1 comment

Comments

Projects
None yet
4 participants
@mattmccutchen

When setting the timezone pref for my Windows HVM in an attempt to fix the time in the VM, using qubes-core-dom0-3.0.25-1.fc20.x86_64, I still observe the following problems noted in #1184:

  • setting positive offset makes VM unbootable (AttributeError: 'int' object has no attribute 'lower'): Looks like the check actually causing the boot problem is this one, not the one that was changed in #1184.
  • setting negative value doesn't work (qvm-prefs: error: no such option: -3): Looks like no attempt was made to fix this in #1184.

I cannot reopen #1184 so I'm filing a new bug report. My original problem (which I'll report separately to qubes-users) ended up being unrelated to this pref, so this bug is low priority to me.

@marmarek marmarek added this to the Release 3.0 updates milestone Jan 6, 2016

@plushambush

This comment has been minimized.

Show comment
Hide comment
@plushambush

plushambush Sep 7, 2016

  • The first problem (positive offset) can be fixed with a simple patch:
--- 01QubesHVm.py       2016-09-07 18:52:37.394008910 +0300
+++ 01QubesHVm.py.new   2016-09-07 18:52:23.155008444 +0300
@@ -73,7 +73,8 @@
         attrs['maxmem'].pop('save')
         attrs['maxmem']['func'] = lambda x: self.memory
         attrs['timezone'] = { 'default': 'localtime',
-                              'save': lambda: str(self.timezone) }
+                              'save': lambda: str(self.timezone),
+                              'func': lambda x: str(x)  }
         attrs['qrexec_installed'] = { 'default': False,
             'attr': '_qrexec_installed',
             'save': lambda: str(self._qrexec_installed) }
@@ -249,11 +250,11 @@
             params['time_basis'] = 'localtime'
             params['timeoffset'] = '0'
         elif self.timezone.isdigit():
-            params['time_basis'] = 'UTC'
+            params['time_basis'] = 'utc'
             params['timeoffset'] = self.timezone
         else:
             print >>sys.stderr, "WARNING: invalid 'timezone' value: %s" % self.timezone
-            params['time_basis'] = 'UTC'
+            params['time_basis'] = 'utc'
             params['timeoffset'] = '0'
         return params

I can make a pull request with this commit if it's ok

  • The second problem (negative offset) is OptionParser's (Optik) module (used by qvm-prefs) issue:
    It treats any "-" followed by a character as (short) option token and thus can not recognize a negative integer.
         elif arg[:1] == "-" and len(arg) > 1:
                # process a cluster of short options (possibly with
                # value(s) for the last one only)
                self._process_short_opts(rargs, values)

Imho this can be completely fixed only by replacing option parsing module with some other or doing dirty tricks by inheriting OptionParser and overwriting some parsing methods in inherited class.

I managed to fix it and get it working but only for the case of a single property value like
qvm-prefs -s <vmname> <property> <negative integer value>
it still throws an error when one try to set a property with multiple values (are there any?) of which some are negative integers like
qvm-prefs -s <vmname> <property> <value1> <value2> <negative integer value3> <value4> ...

  • The first problem (positive offset) can be fixed with a simple patch:
--- 01QubesHVm.py       2016-09-07 18:52:37.394008910 +0300
+++ 01QubesHVm.py.new   2016-09-07 18:52:23.155008444 +0300
@@ -73,7 +73,8 @@
         attrs['maxmem'].pop('save')
         attrs['maxmem']['func'] = lambda x: self.memory
         attrs['timezone'] = { 'default': 'localtime',
-                              'save': lambda: str(self.timezone) }
+                              'save': lambda: str(self.timezone),
+                              'func': lambda x: str(x)  }
         attrs['qrexec_installed'] = { 'default': False,
             'attr': '_qrexec_installed',
             'save': lambda: str(self._qrexec_installed) }
@@ -249,11 +250,11 @@
             params['time_basis'] = 'localtime'
             params['timeoffset'] = '0'
         elif self.timezone.isdigit():
-            params['time_basis'] = 'UTC'
+            params['time_basis'] = 'utc'
             params['timeoffset'] = self.timezone
         else:
             print >>sys.stderr, "WARNING: invalid 'timezone' value: %s" % self.timezone
-            params['time_basis'] = 'UTC'
+            params['time_basis'] = 'utc'
             params['timeoffset'] = '0'
         return params

I can make a pull request with this commit if it's ok

  • The second problem (negative offset) is OptionParser's (Optik) module (used by qvm-prefs) issue:
    It treats any "-" followed by a character as (short) option token and thus can not recognize a negative integer.
         elif arg[:1] == "-" and len(arg) > 1:
                # process a cluster of short options (possibly with
                # value(s) for the last one only)
                self._process_short_opts(rargs, values)

Imho this can be completely fixed only by replacing option parsing module with some other or doing dirty tricks by inheriting OptionParser and overwriting some parsing methods in inherited class.

I managed to fix it and get it working but only for the case of a single property value like
qvm-prefs -s <vmname> <property> <negative integer value>
it still throws an error when one try to set a property with multiple values (are there any?) of which some are negative integers like
qvm-prefs -s <vmname> <property> <value1> <value2> <negative integer value3> <value4> ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment