EmilyDirsh / hotwire-shell

Automatically exported from code.google.com/p/hotwire-shell
Other
0 stars 0 forks source link

ls: cannot change directory to a symbolic link pointing to a directory #121

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

to reproduce, create a symbolic link to a directory and try to change to
that directory in a "ls" view. hotwire only shows a directory containing a
single item with the name of the symbolic link. the attached patch fixes
this by changing the default behaviour of fs.test_directory to
follow_link=True - this may however not be the right solution although I
think normally you want that behaviour. the patch for issue 119 currently
assumes this patch is applied so that symlinks to directories are shown
before files.

Original issue reported on code.google.com by KaiSchro...@gmail.com on 24 Jan 2008 at 5:03

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
--- tmp/tmpAjDQ-T-meld/fs_impl/fs_gnomevfs.py 
+++ 
home/kai/src/hotwire/hotwire-shell-read-only/hotwire/sysdep/fs_impl/fs_gnomevfs.
py 
@@ -47,7 +47,7 @@
         self.target_vfsstat = None
         self.target_vfsstat_error = None 

-    def test_directory(self, follow_link=False):
+    def test_directory(self, follow_link=True):
         if not self.vfsstat:
             return False
         if follow_link and self.vfsstat.type == gnomevfs.FILE_TYPE_SYMBOLIC_LINK:
--- tmp/tmpAjDQ-T-meld/fs.py 
+++ home/kai/src/hotwire/hotwire-shell-read-only/hotwire/sysdep/fs.py 
@@ -187,7 +187,7 @@
         self.target_stat = None
         self.stat_error = None

-    def test_directory(self, follow_link=False):
+    def test_directory(self, follow_link=True):
         if not self.stat:
             return False
         if follow_link and stat.S_ISLNK(self.stat.st_mode):

Original comment by KaiSchro...@gmail.com on 24 Jan 2008 at 5:09

GoogleCodeExporter commented 9 years ago
Ok, I see the bug.  I'm a bit nervous about this change though - the 
test_directory
is used in a number of places and we'd need to double-check all of the callers. 
 I'm
pretty sure there is at least a case or two in the code where we don't want to 
follow
the link.

I'll take a closer look tonight.

Original comment by cgwalt...@gmail.com on 24 Jan 2008 at 6:20

GoogleCodeExporter commented 9 years ago
Note that not only all users of test_directory() had to be audited, but all 
users of
"is_directory" as well, because it changed too with this patch.

I did a pass through the code and didn't see anything that should break (and I
noticed this patch fixed one other bug where we added a space after a symlink 
to a
directory).

Still though we should keep an eye out for any regressions.  The current test 
suite
isn't yet very comprehensive.

Anyways, committed.  Thank you for the patch!

Committed r885
    M   hotwire/sysdep/fs.py
    M   hotwire/sysdep/fs_impl/fs_gnomevfs.py
r885 = 2faa0e634098b1345061813164e929896c403528 (git-svn)

Original comment by cgwalt...@gmail.com on 26 Jan 2008 at 3:21