Artifacts Associated With Ticket aa9f3ef820
Ticket change [9f146e56ff] (rid 248108) by anonymous on 2025-11-12 12:43:04:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-plain"
- comment initialized to:
Working with serial ports the "file exists" command has weird behavior, inconsistent with both "file type" and "::open" command (it's not the known pitfall of missing prefix \\.\ for serial ports on Windows platform): --- a) The following returns 1 for EVERY serial port COM1 to COM9 (even if some of them do not exist): for {set i 1} {$i < 10} {incr i} { puts [file exists com$i] } Compared to this "file type" command works as expected and returns "characterSpecial" for serial ports available and raises errors for non-existing serial ports. --- b) Adding \\.\ prefix for Windows changes behavior (although behavior of "file type" does not change): for {set i 1} {$i < 10} {incr i} { puts [file exists [string cat {\\.\com} $i]] } This returns zero for all serial ports COM1 to COM9 even if they are available. However the following succeeds (for serial ports available): file type [string cat {\\.\com} 13] --- c) For COM ports > 10 "file exists" always return 0 even if they are available, e.g. puts [file exists {\\.\com13}] always returns zero. However the following succeeds (given that serial port is available): puts [file type {\\.\com13}] # -> characterSpecial set h [::open {\\.\com13} r] close $h --- The behavior seems inconsistent: Even if one defines that "file" commands work on disk files only why does "file exists" returns 1 for COM1 to COM9? And if one defines that "file" works on special devices like serial ports it should return 1 whenever "file type" returns "characterSpecial". Commands "file readable" and "file writable" show similar behavior btw. Platform is Windows 11 with Tcl 8.6.17 (other versions and platforms not tested yet). - foundin initialized to: "8.6.17"
- is_private initialized to: "0"
- login: "anonymous"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Important"
- status initialized to: "Open"
- submitter initialized to: "anonymous"
- subsystem initialized to: "37. File System"
- title initialized to: "Inconsistent behavior of "file exists" command"
- type initialized to: "Bug"