Richard Cooper has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/39897 )
Change subject: util: Fix gem5img when used to manually unmount a disk
image.
......................................................................
util: 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
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39897
Reviewed-by: Bobby R. Bruce <[email protected]>
Reviewed-by: Gabe Black <[email protected]>
Maintainer: Bobby R. Bruce <[email protected]>
Maintainer: Gabe Black <[email protected]>
Tested-by: kokoro <[email protected]>
---
M util/gem5img.py
1 file changed, 7 insertions(+), 4 deletions(-)
Approvals:
Gabe Black: Looks good to me, but someone else must approve; Looks good
to me, approved
Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/util/gem5img.py b/util/gem5img.py
index 616dd72..9523a77 100755
--- a/util/gem5img.py
+++ b/util/gem5img.py
@@ -208,8 +208,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
@@ -283,8 +286,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: 5
Gerrit-Owner: Richard Cooper <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Richard Cooper <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s