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
This commit is contained in:
Marek Marczykowski-Górecki 2015-10-10 17:30:40 +02:00
parent 18edf4946c
commit 350e279f4f
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -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