Skip to content

Commit 6686cd0

Browse files
mediaministerdagwieers
authored andcommitted
support paths with spaces when calculating Chrome OS losetup offset (#224)
1 parent b0bbe08 commit 6686cd0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/inputstreamhelper/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,12 @@ def _chromeos_offset(self, bin_path):
265265

266266
output = self._run_cmd(cmd, sudo=False)
267267
if output['success']:
268+
import re
268269
for line in output['output'].splitlines():
269-
partition_data = line.split()
270+
partition_data = re.match(r'^\s?(3|.+bin3)\s+(\d+)s?\s+\d+', line)
270271
if partition_data:
271-
if partition_data[0] == '3' or '.bin3' in partition_data[0]:
272-
offset = int(partition_data[1].replace('s', ''))
272+
if partition_data.group(1) == '3' or partition_data.group(1).endswith('.bin3'):
273+
offset = int(partition_data.group(2))
273274
return str(offset * config.CHROMEOS_BLOCK_SIZE)
274275

275276
log('Failed to calculate losetup offset.')

0 commit comments

Comments
 (0)