Overview
| Artifact ID: | d5f14fb0b2a286f218d9814cff231f1a34f6adfb |
|---|---|
| Ticket: | 230474ffffffffffffffffffffffffffffffffff
glob returns hidden files on win/macos |
| User & Date: | vincentdarley on 2001-01-30 17:14:11 |
Changes
- assignee changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
On Unix, 'glob' only returns the hidden/invisible files (matching .*) if the pattern starts with '.' -- i.e. if the user specifically requested them. On MacOS and Windows, in which invisibility is specified differently, hidden files are returned by default, even though the '-types hidden' option provides a mechanism to return them if they are desired. For consistency the MacOS and Windows versions of glob should be updated to follow the Unix example. Here's a patch for MacOS (tclMacFile.c should read): int typeOk = 1; if (types == NULL) { /* If invisible, don't return the file */ if (pb.hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible) { typeOk = 0; } } else { if (pb.hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible) { /* If invisible */ if ((types->perm == 0) || !(types->perm & TCL_GLOB_PERM_HIDDEN)) { typeOk = 0; } } else { /* Visible */ if ((types->perm == 0) || (types->perm & TCL_GLOB_PERM_HIDDEN)) { typeOk = 0; } } if (typeOk == 1 && types->perm != 0) { if ( ((types->perm & TCL_GLOB_PERM_RONLY) && !(pb.hFileInfo.ioFlAttrib & 1)) || ((types->perm & TCL_GLOB_PERM_R) && (TclpAccess(fname, R_OK) != 0)) || ((types->perm & TCL_GLOB_PERM_W) && (TclpAccess(fname, W_OK) != 0)) || ((types->perm & TCL_GLOB_PERM_X) && (TclpAccess(fname, X_OK) != 0)) ) { typeOk = 0; } } and for Windows (tclWinFile.c): int typeOk = 1; attr = (*tclWinProcs->getFileAttributesProc)(nativeName); if (types == NULL) { /* If invisible, don't return the file */ if (attr & FILE_ATTRIBUTE_HIDDEN) { typeOk = 0; } } else { if (attr & FILE_ATTRIBUTE_HIDDEN) { /* If invisible */ if ((types->perm == 0) || !(types->perm & TCL_GLOB_PERM_HIDDEN)) { typeOk = 0; } } else { /* Visible */ if ((types->perm == 0) || (types->perm & TCL_GLOB_PERM_HIDDEN)) { typeOk = 0; } } if (typeOk == 1 && types->perm != 0) { if ( ((types->perm & TCL_GLOB_PERM_RONLY) && !(attr & FILE_ATTRIBUTE_READONLY)) || ((types->perm & TCL_GLOB_PERM_R) && (TclpAccess(fname, R_OK) != 0)) || ((types->perm & TCL_GLOB_PERM_W) && (TclpAccess(fname, W_OK) != 0)) || ((types->perm & TCL_GLOB_PERM_X) && (TclpAccess(fname, X_OK) != 0)) ) { typeOk = 0; } } - foundin changed to: "obsolete: 8.4a2"
- priority changed to: "5 Medium"
- resolution changed to: "None"
- status changed to: "Open"
- submitter changed to: "vincentdarley"
- subsystem changed to: "37. File System"
- title changed to: "glob returns hidden files on win/macos"
- type changed to: "Bug"