Browse Source

Fix handling /etc/localtime hardlink

If /etc/localtime in dom0 is a hardlink to zoneinfo file (instead of
symlink) and more than one zoneinfo file is hardlinked to this inode,
appVMs will get invalid timezone, e.g. "Europe/Warsaw\x0aPoland".

Reported by @yaqu, fix provided by @yaqu
Fixes QubesOS/qubes-issues#1315
Marek Marczykowski-Górecki 8 years ago
parent
commit
350e279f4f
1 changed files with 3 additions and 2 deletions
  1. 3 2
      core-modules/000QubesVm.py

+ 3 - 2
core-modules/000QubesVm.py

@@ -1008,8 +1008,9 @@ class QubesVm(object):
                 return None
             if tz_info.st_nlink > 1:
                 p = subprocess.Popen(['find', '/usr/share/zoneinfo',
-                                       '-inum', str(tz_info.st_ino)],
-                                      stdout=subprocess.PIPE)
+                                      '-inum', str(tz_info.st_ino),
+                                      '-print', '-quit'],
+                                     stdout=subprocess.PIPE)
                 tz_path = p.communicate()[0].strip()
                 return tz_path.replace('/usr/share/zoneinfo/', '')
         return None