Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2002-06-27
19:36 • Closed ticket [218355ffff]: problem with file names starting with tilde plus... artifact: f6e4e2f7de user: vincentdarley
2002-05-31
01:01 • Add attachment globTilde.diffs to ticket [218355ffff] artifact: 62c5827caa user: vincentdarley
01:01 • Ticket [218355ffff] problem with file names starting with tilde status still... artifact: a1f2d157ba user: vincentdarley
00:35 • Open ticket [218355ffff]. artifact: e3413cba8b user: vincentdarley
2001-04-14
02:22 • Ticket [218355ffff]: 3 changes artifact: 9b0a0525ce user: dgp
2000-10-26
08:20 • Closed ticket [218355ffff]. artifact: 7dfd476586 user: welch
00:56 • New ticket [218355ffff]. artifact: 3c2d0f8c02 user: nobody

problem with file names starting with tilde

Closed / Invalid218355ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 24 years ago
Descriptionplain2000-10-26 00:56:38
OriginalBugID: 4131 Bug
Version: 8.3b2
SubmitDate: '2000-02-07'
LastModified: '2000-03-01'
Severity: LOW
Status: Closed
Submitter: techsupp
ChangedBy: hobbs
OS: Windows 98
OSVersion: 4.10.1998
Machine: Celeron 300 / 64 Mb
FixedDate: '2000-10-25'
ClosedDate: '2000-03-01'


Name: SnakE

Comments:
The bug is in the 'glob' command. In example above its output is:
      tools Stuff ~test.file temp
    while it should be:
      tools Stuff ./~test.file temp

ReproducibleScript:
test.tsh:
  foreach name [glob -nocomplain *] { puts [file join somedir $name] }

To see the bug, you should have a file which name starts with tilde, '~test.file' for example, in the current directory. Then run the test: 'tclsh83.exe test.tsh'

ObservedBehavior:
The output will be like this:
  somedir/tools
  somedir/Stuff
  ~test.file
  somedir/temp
As you've noticed, directory name 'somedir' have been lost for the '~test.file' by 'file join' command

DesiredBehavior:
The output should be like this:
  somedir/tools
  somedir/Stuff
  somedir/~test.file
  somedir/temp



The ~ is one of those chars that has to be handled separately, and
with minor coding improvements you can make the above work without
problems:
    foreach name [glob -nocomplain ./*] { puts [file join somedir $name] }

or in 8.3:
    foreach name [glob -nocomplain -dir . *] { ... }
 
-- 03/01/2000 hobbs
welch Closed ticket [218355ffff]. [History diff]2000-10-26 08:20:08
dgp Ticket [218355ffff]: 3 changes [History diff]2001-04-14 02:22:30
vincentdarleyplain2002-05-31 00:35:26
Logged In: YES 
user_id=32170

One side-effect of the new VFS code is that this bug is 
now rather easy to fix (it would have been much more 
complex to fix in Tcl 8.3), since the changes are now 
restricted to tclFileName.c and tclIOUtil.c, if it is indeed 
considered a bug.  I think it should probably be viewed 
as a bug, since 'file split' actually handles '~' specially, 
so should 'glob'.

Any thoughts?
vincentdarleyplain2002-05-31 01:01:03
File Added - 24079: globTilde.diffs

Logged In: YES 
user_id=32170

Attached patch to fix.
vincentdarleyplain2002-06-27 19:36:55
Logged In: YES 
user_id=32170

On balance I think I agree with Jeff that the current 
behaviour is most useful.  Therefore I'm closing this 
bug.  A patch is attached if anyone wants a different 
behaviour.
Log in (anonymous is fine) to add a comment.

Attachments: