summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/fsobject/fsobject.py9
-rw-r--r--ranger/gui/widgets/statusbar.py7
2 files changed, 10 insertions, 6 deletions
diff --git a/ranger/fsobject/fsobject.py b/ranger/fsobject/fsobject.py
index 9d942c65..f0adab67 100644
--- a/ranger/fsobject/fsobject.py
+++ b/ranger/fsobject/fsobject.py
@@ -35,8 +35,7 @@ class FileSystemObject(MimeTypeAware, FileManagerAware):
 	last_used,
 	path,
 	permissions,
-	readlink,
-	stat) = (None,) * 12
+	stat) = (None,) * 11
 
 	(content_loaded,
 	force_load,
@@ -209,8 +208,10 @@ class FileSystemObject(MimeTypeAware, FileManagerAware):
 				self.exists = False
 				self.runnable = False
 			if is_link:
-				self.realpath = realpath(path)
-				self.readlink = readlink(path)
+				try:
+					self.realpath = realpath(path)
+				except OSError:
+					pass  # it is impossible to get the link destination
 		else:
 			self.accessible = False
 
diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py
index 752bfd6b..3019930b 100644
--- a/ranger/gui/widgets/statusbar.py
+++ b/ranger/gui/widgets/statusbar.py
@@ -23,7 +23,7 @@ such as the space used by all the files in this directory.
 
 from pwd import getpwuid
 from grp import getgrgid
-from os import getuid
+from os import getuid, readlink
 from time import time, strftime, localtime
 
 from ranger.ext.human_readable import human_readable
@@ -164,7 +164,10 @@ class StatusBar(Widget):
 
 		if target.is_link:
 			how = target.exists and 'good' or 'bad'
-			dest = target.readlink if target.readlink is not None else '?'
+			try:
+				dest = readlink(target.path)
+			except:
+				dest = '?'
 			left.add(' -> ' + dest, 'link', how)
 		else:
 			if self.settings.display_size_in_status_bar and target.infostring: