Tcl Source Code

View Ticket
Login
Ticket UUID: f6db6d1ec409ca399cabf528ad530e045e7d4b40
Title: glob raises an error with too long pathnames on windows
Type: Bug Created on: 2022-05-17 17:27:04
Submitter: ralfixx Assigned to: nobody
Subsystem: 36. Pathname Management Severity: Minor
Priority: 5 Medium Last modified: 2026-05-22 11:11:26
Status: Closed Closed by: apnadkarni
Resolution: Fixed Closed on: 2026-05-22 11:11:26
Version: 8.6.12
Description:
tcl 8.6.12, Windows 10, with latest updates applied

Asking for long filename (which does not exist)
    % glob -nocomplain [string repeat x 251]
Ok, empty list.

Adding a "*" makes the path name too long and glob err out
instead of returning an empty list:
    % glob -nocomplain [string repeat x 251]*
    couldn't read directory "C:/Users/ralf/AppData/Local/Temp/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*": no such file or directory

=> IMHO both commands should return an empty list, even if the second command hits
the MAX_PATH limit in Windows.

As an aside, on Linux I can do

  % glob -nocomplain [string repeat x 1000000]
  % glob -nocomplain [string repeat x 1000000]*

=> empty list each, no error, although trying to create that file also
returns an error since the file name is too long.
User Comments:
apnadkarni added on 2026-05-22 11:11:26:

Still present in 9.0.3. Fixed for 9.0.4

% info patch
9.0.3
% glob -nocomplain [string repeat x 251]*
couldn't read directory "C:/src/tcltk/9.0.3/tcl/win/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*": no such file or directory
% info patch
9.0.4
% glob -nocomplain [string repeat x 251]*