Richard Cooper has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/39897 )
Change subject: misc: Fix gem5img when used to manually unmount a disk
image.
......................................................................
misc: Fix gem5img when used to manually unmount a disk image.
When unmounting a disk image manually using the
`gem5img umount mount_point` command, the operation can fail if the
process is unable to stat any of the mounts in the mount table. On
some systems this can occur even when running using sudo.
Added an exception check so any mount points that fail to stat will not
cause the whole script to terminate early.
Change-Id: I69cd2494ad0e8c989e19ecd8af8a811905cd6c09
---
M util/gem5img.py
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/util/gem5img.py b/util/gem5img.py
index f4e8351..e5abe79 100755
--- a/util/gem5img.py
+++ b/util/gem5img.py
@@ -210,8 +210,11 @@
mountTable = mountTable.splitlines()
for line in mountTable:
chunks = line.split()
- if os.path.samefile(chunks[2], mountPoint):
- return LoopbackDevice(chunks[0])
+ try:
+ if os.path.samefile(chunks[2], mountPoint):
+ return LoopbackDevice(chunks[0])
+ except OSError:
+ continue
return None
@@ -285,8 +288,8 @@
mountCom.func = mountComFunc
# A command to unmount the first partition in the image.
-umountCom = Command('umount', 'Unmount the first partition in the disk
image.',
- [('mount point', 'What mount point to unmount.')])
+umountCom = Command('umount', 'Unmount the disk image mounted at
mount_point.',
+ [('mount_point', 'What mount point to unmount.')])
def umountComFunc(options, args):
(mountPoint,) = args
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39897
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I69cd2494ad0e8c989e19ecd8af8a811905cd6c09
Gerrit-Change-Number: 39897
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Cooper <richard.coo...@arm.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s