diff --git a/CHANGELOG b/CHANGELOG index 079c336..3e3ec13 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -9,6 +9,7 @@ Option in Control menu to split the session view between horizontally and vertic The session list now dynamically expands to the needed with. Better log messages Fix regression and workarounds for crashes introduced by a recent PyQt update. +Fix a bug where symlink targets are not available or have no permission but the session list tries to count the symlink and filesizes and crashes. This CHANGELOG is now available through the programs help menu directly. diff --git a/engine/nsmservercontrol.py b/engine/nsmservercontrol.py index ca25f70..ae18701 100644 --- a/engine/nsmservercontrol.py +++ b/engine/nsmservercontrol.py @@ -1591,7 +1591,17 @@ class NsmServerControl(object): entry["sessionFile"] = sessionFile entry["lockFile"] = pathlib.Path(basePath, ".lock") entry["fullPath"] = str(basePath) - entry["sizeInBytes"] = sum(f.stat().st_size for f in basePath.glob('**/*') if f.is_file() ) + + #No generator expression for the next one. We need to watch out for PermissionError (sudo chmod 000) + sizeInBytes = 0 + for f in basePath.glob('**/*'): + try: + if f.exists() and f.is_file(): + sizeInBytes += f.stat().st_size + except PermissionError: + logger.error(f"PermissionError for {f}. It is possible that the file is read-protected. Trying to load the session anyway, please be careful.") + + entry["sizeInBytes"] = sizeInBytes entry["numberOfClients"] = len(open(sessionFile).readlines()) entry["hasSymlinks"] = self._checkDirectoryForSymlinks(basePath) entry["parents"] = basePath.relative_to(self.sessionRoot).parts[:-1] #tuple of each dir between NSM root and nsmSessionName/session.nsm, exluding the actual project name. This is the tree