mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-03 06:58:42 +00:00
Fix #1964 : Unhandled UnpicklingError with corrupt state file
This commit is contained in:
parent
b2eb5aeb8c
commit
16bbedaf2b
5 changed files with 15 additions and 15 deletions
|
@ -652,7 +652,7 @@ class TorrentManager(component.Component):
|
||||||
os.path.join(get_config_dir(), "state", "torrents.state"), "rb")
|
os.path.join(get_config_dir(), "state", "torrents.state"), "rb")
|
||||||
state = cPickle.load(state_file)
|
state = cPickle.load(state_file)
|
||||||
state_file.close()
|
state_file.close()
|
||||||
except (EOFError, IOError, Exception), e:
|
except (EOFError, IOError, Exception, cPickle.UnpicklingError), e:
|
||||||
log.warning("Unable to load state file: %s", e)
|
log.warning("Unable to load state file: %s", e)
|
||||||
|
|
||||||
# Try to use an old state
|
# Try to use an old state
|
||||||
|
@ -741,8 +741,8 @@ class TorrentManager(component.Component):
|
||||||
state_file.flush()
|
state_file.flush()
|
||||||
os.fsync(state_file.fileno())
|
os.fsync(state_file.fileno())
|
||||||
state_file.close()
|
state_file.close()
|
||||||
except IOError:
|
except IOError, e:
|
||||||
log.warning("Unable to save state file.")
|
log.warning("Unable to save state file: %s", e)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# We have to move the 'torrents.state.new' file to 'torrents.state'
|
# We have to move the 'torrents.state.new' file to 'torrents.state'
|
||||||
|
|
|
@ -281,7 +281,7 @@ class FilesTab(Tab):
|
||||||
state_file = open(os.path.join(config_location, filename), "rb")
|
state_file = open(os.path.join(config_location, filename), "rb")
|
||||||
state = cPickle.load(state_file)
|
state = cPickle.load(state_file)
|
||||||
state_file.close()
|
state_file.close()
|
||||||
except (EOFError, IOError, AttributeError), e:
|
except (EOFError, IOError, AttributeError, cPickle.UnpicklingError), e:
|
||||||
log.warning("Unable to load state file: %s", e)
|
log.warning("Unable to load state file: %s", e)
|
||||||
|
|
||||||
if state == None:
|
if state == None:
|
||||||
|
|
|
@ -304,7 +304,7 @@ class ListView:
|
||||||
state_file = open(os.path.join(config_location, filename), "rb")
|
state_file = open(os.path.join(config_location, filename), "rb")
|
||||||
state = cPickle.load(state_file)
|
state = cPickle.load(state_file)
|
||||||
state_file.close()
|
state_file.close()
|
||||||
except (EOFError, IOError), e:
|
except (EOFError, IOError, cPickle.UnpicklingError), e:
|
||||||
log.warning("Unable to load state file: %s", e)
|
log.warning("Unable to load state file: %s", e)
|
||||||
|
|
||||||
# Keep the state in self.state so we can access it as we add new columns
|
# Keep the state in self.state so we can access it as we add new columns
|
||||||
|
@ -545,12 +545,12 @@ class ListView:
|
||||||
column.set_visible(column_state.visible)
|
column.set_visible(column_state.visible)
|
||||||
position = column_state.position
|
position = column_state.position
|
||||||
break
|
break
|
||||||
|
|
||||||
# Set this column to not visible if its not in the state and
|
# Set this column to not visible if its not in the state and
|
||||||
# its not supposed to be shown by default
|
# its not supposed to be shown by default
|
||||||
if not column_in_state and not default and not hidden:
|
if not column_in_state and not default and not hidden:
|
||||||
column.set_visible(False)
|
column.set_visible(False)
|
||||||
|
|
||||||
if position is not None:
|
if position is not None:
|
||||||
self.treeview.insert_column(column, position)
|
self.treeview.insert_column(column, position)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -17,9 +17,9 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with deluge. If not, write to:
|
# along with deluge. If not, write to:
|
||||||
# The Free Software Foundation, Inc.,
|
# The Free Software Foundation, Inc.,
|
||||||
# 51 Franklin Street, Fifth Floor
|
# 51 Franklin Street, Fifth Floor
|
||||||
# Boston, MA 02110-1301, USA.
|
# Boston, MA 02110-1301, USA.
|
||||||
#
|
#
|
||||||
# In addition, as a special exception, the copyright holders give
|
# In addition, as a special exception, the copyright holders give
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
# permission to link the code of portions of this program with the OpenSSL
|
||||||
|
@ -210,7 +210,7 @@ class PeersTab(Tab):
|
||||||
state_file = open(os.path.join(config_location, filename), "rb")
|
state_file = open(os.path.join(config_location, filename), "rb")
|
||||||
state = cPickle.load(state_file)
|
state = cPickle.load(state_file)
|
||||||
state_file.close()
|
state_file.close()
|
||||||
except (EOFError, IOError, AttributeError), e:
|
except (EOFError, IOError, AttributeError, cPickle.UnpicklingError), e:
|
||||||
log.warning("Unable to load state file: %s", e)
|
log.warning("Unable to load state file: %s", e)
|
||||||
|
|
||||||
if state == None:
|
if state == None:
|
||||||
|
|
|
@ -17,9 +17,9 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with deluge. If not, write to:
|
# along with deluge. If not, write to:
|
||||||
# The Free Software Foundation, Inc.,
|
# The Free Software Foundation, Inc.,
|
||||||
# 51 Franklin Street, Fifth Floor
|
# 51 Franklin Street, Fifth Floor
|
||||||
# Boston, MA 02110-1301, USA.
|
# Boston, MA 02110-1301, USA.
|
||||||
#
|
#
|
||||||
# In addition, as a special exception, the copyright holders give
|
# In addition, as a special exception, the copyright holders give
|
||||||
# permission to link the code of portions of this program with the OpenSSL
|
# permission to link the code of portions of this program with the OpenSSL
|
||||||
|
@ -432,7 +432,7 @@ class TorrentDetails(component.Component):
|
||||||
state_file = open(os.path.join(config_location, filename), "rb")
|
state_file = open(os.path.join(config_location, filename), "rb")
|
||||||
state = cPickle.load(state_file)
|
state = cPickle.load(state_file)
|
||||||
state_file.close()
|
state_file.close()
|
||||||
except (EOFError, IOError), e:
|
except (EOFError, IOError, cPickle.UnpicklingError), e:
|
||||||
log.warning("Unable to load state file: %s", e)
|
log.warning("Unable to load state file: %s", e)
|
||||||
|
|
||||||
return state
|
return state
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue