diff options
author | aspect <aspect+tclcore@abstracted-spleen.org> | 2017-04-30 05:34:44 (GMT) |
---|---|---|
committer | aspect <aspect+tclcore@abstracted-spleen.org> | 2017-04-30 05:34:44 (GMT) |
commit | ed50b08a564ee5cad2b0e1ae0bfb777f06215410 (patch) | |
tree | db3d785e5306c60fd75d447f1d614b3400390ff5 | |
parent | a291109ed2c14d7a263b8b8132e2688266223c97 (diff) | |
download | tcl-aspect_bug_391bc0fd2c.zip tcl-aspect_bug_391bc0fd2c.tar.gz tcl-aspect_bug_391bc0fd2c.tar.bz2 |
glob for hidden files on unix should not require stat()aspect_bug_391bc0fd2c
-rw-r--r-- | tests/fileName.test | 19 | ||||
-rw-r--r-- | unix/tclUnixFile.c | 4 |
2 files changed, 21 insertions, 2 deletions
diff --git a/tests/fileName.test b/tests/fileName.test index d224011..4025b0f 100644 --- a/tests/fileName.test +++ b/tests/fileName.test @@ -730,6 +730,25 @@ test filename-11.12 {Tcl_GlobCmd} {testsetplatform} { set env(HOME) $home set x } {1 {couldn't find HOME environment variable to expand path}} +test filename-11.13 {Tcl_GlobCmd: hidden links on unix without stat()} -constraints {testsetplatform} -setup { + testsetplatform unix + file mkdir globTest/11.13 + close [open globTest/11.13/nonexistent w] + file link -symbolic globTest/11.13/badlink nonexistent + file link -symbolic globTest/11.13/.badlink nonexistent + file delete globTest/11.13/nonexistent +} -body { + # these should either both give results, or neither. Bug 391bc0fd2c + list [ + glob -nocomplain -tails -types l -dir globTest/11.13 * + ] [ + glob -nocomplain -tails -types {hidden l} -dir globTest/11.13/ * + ] +} -cleanup { + file delete globTest/11.13/badlink + file delete globTest/11.13/.badlink + file delete globTest/11.13 +} -result {badlink .badlink} if {[testConstraint testsetplatform]} { testsetplatform $platform diff --git a/unix/tclUnixFile.c b/unix/tclUnixFile.c index 0a2099c..a8bc9eb 100644 --- a/unix/tclUnixFile.c +++ b/unix/tclUnixFile.c @@ -433,7 +433,7 @@ NativeMatchType( return 0; } } else { - if (types->perm != 0) { + if ((types->perm & ~TCL_GLOB_PERM_HIDDEN) != 0) { if (TclOSstat(nativeEntry, &buf) != 0) { /* * Either the file has disappeared between the 'readdir' call @@ -474,7 +474,7 @@ NativeMatchType( } } if (types->type != 0) { - if (types->perm == 0) { + if ((types->perm & ~TCL_GLOB_PERM_HIDDEN) == 0) { /* * We haven't yet done a stat on the file. */ |