qemu-iotests: Fix FilePaths cleanup
PATCH 1/1 qemu-iotests: Fix FilePaths cleanup
If os.remove() fails to remove one of the paths, for example if the file was removed by the test, the cleanup loop would exit silently, without removing the rest of the files.
--- dtc | 2 +- tests/qemu-iotests/iotests.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
dtc +1 -1
@@ -1 +1 @@ -Subproject commit 85e5d839847af54efab170f2b1331b2a6421e647 +Subproject commit 88f18909db731a627456f26d779445f84e449536
tests/qemu-iotests/iotests.py +4 -4
@@ -468,11 +468,11 @@ class FilePaths: return self.paths def __exit__(self, exc_type, exc_val, exc_tb): - try: - for path in self.paths: + for path in self.paths: + try: os.remove(path) - except OSError: - pass + except OSError: + pass return False class FilePath(FilePaths):
Signature · 1 line
2.26.2
Quoted 16 lines · Nir Soffer
If
os.remove()fails to remove one of the paths, for example if the file was removed by the test, the cleanup loop would exit silently, without removing the rest of the files.Signed-off-by Nir Soffer <[email protected]>--- dtc | 2 +- tests/qemu-iotests/iotests.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)dtc +0
-0
dtc line 1
Quoted 2 lines
dtc +1
-1@@ -1 +1 @@ -Subproject commit 85e5d839847af54efab170f2b1331b2a6421e647 +Subproject commit 88f18909db731a627456f26d779445f84e449536
This sneaked into the patch somehow, I did not change this.
Quoted 23 lines
tests/qemu-iotests/iotests.py +4
-5@@ -468,11 +468,11 @@ class FilePaths: return self.paths def __exit__(self, exc_type, exc_val, exc_tb): - try: - for path in self.paths: + for path in self.paths: + try: os.remove(path) - except OSError: - pass + except OSError: + pass return False class FilePath(FilePaths): --2.26.2
Quoted 15 lines · Nir Soffer
If
os.remove()fails to remove one of the paths, for example if the file was removed by the test, the cleanup loop would exit silently, without removing the rest of the files.Signed-off-by Nir Soffer <[email protected]>--- dtc | 2 +- tests/qemu-iotests/iotests.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)dtc +0
-0
dtc line 1
Quoted 2 lines
dtc +1
-1@@ -1 +1 @@ -Subproject commit 85e5d839847af54efab170f2b1331b2a6421e647 +Subproject commit 88f18909db731a627456f26d779445f84e449536
Modulo the unintended submodule bump,
Quoted 8 lines
tests/qemu-iotests/iotests.py +0
-0@@ -468,11 +468,11 @@ class FilePaths: return self.paths def __exit__(self, exc_type, exc_val, exc_tb):
tests/qemu-iotests/iotests.py class FilePaths: · line 476
Quoted 10 lines
tests/qemu-iotests/iotests.py +4
-4- try: - for path in self.paths: + for path in self.paths: + try: os.remove(path) - except OSError: - pass + except OSError: + pass return False
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Quoted 5 lines · Eric Blake
Quoted 4 lines · Nir Soffer
If
os.remove()fails to remove one of the paths, for example if the file was removed by the test, the cleanup loop would exit silently, without removing the rest of the files.
Quoted 8 lines
Quoted 5 lines
Signed-off-by Nir Soffer <[email protected]>---
dtc | 2 +-
tests/qemu-iotests/iotests.py| 8 ++++----2 files changed, 5 insertions(+), 5 deletions(-)Reviewed-by Eric Blake <[email protected]>
By the way, what test did you hit this on? If possible, I'd like to add a Fixes: tag pointing to a commit that includes the problem.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Nir Soffer
Reviewed-by Max ReitzQuoted 14 lines · Eric Blake
Quoted 12 lines · Eric Blake
Quoted 9 lines · Nir Soffer
If
os.remove()fails to remove one of the paths, for example if the file was removed by the test, the cleanup loop would exit silently, without removing the rest of the files.Signed-off-by Nir Soffer <[email protected]>--- dtc | 2 +- tests/qemu-iotests/iotests.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
Quoted 4 lines
Quoted 1 line
Reviewed-by Eric Blake <[email protected]>By the way, what test did you hit this on? If possible, I'd like to add a Fixes: tag pointing to a commit that includes the problem.
I did not hit this issue, found it while reviewing another patch, while trying to
understand what FilePath is doing.
The error was introduced in:
commit de263986b5dc7571d12a95305ffc7ddd2f349431
Author: John Snow <[email protected]> Date: Mon Jul 29 16:35:54 2019 -0400
iotests: teach FilePath to produce multiple paths
Use "FilePaths" instead of "FilePath" to request multiple files be cleaned up after we leave that object's scope.
This is not crucial; but it saves a little typing.
Message-id: [email protected]
Quoted 16 lines · Nir Soffer
Quoted 14 lines · Eric Blake
Quoted 12 lines · Eric Blake
Quoted 9 lines · Nir Soffer
If
os.remove()fails to remove one of the paths, for example if the file was removed by the test, the cleanup loop would exit silently, without removing the rest of the files.Signed-off-by Nir Soffer <[email protected]>--- dtc | 2 +- tests/qemu-iotests/iotests.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
Reviewed-by Eric Blake <[email protected]>By the way, what test did you hit this on? If possible, I'd like to add a Fixes: tag pointing to a commit that includes the problem.
I'll send a v2 with a Fixes tag, and few other related fixes.
Quoted 22 lines
I did not hit this issue, found it while reviewing another patch, while trying to
understand what FilePath is doing.The error was introduced in:
commit
de263986b5dc7571d12a95305ffc7ddd2f349431Author: John Snow <[email protected]> Date: Mon Jul 29 16:35:54 2019 -0400iotests: teach FilePath to produce multiple paths
Use "FilePaths" instead of "FilePath" to request multiple files be cleaned up after we leave that object's scope.
This is not crucial; but it saves a little typing.
Signed-off-by John Snow <[email protected]>Reviewed-by Max Reitz <[email protected]>Message-id: [email protected]
Signed-off-by John Snow <[email protected]>