Tcl Source Code

View Ticket
Login
Ticket UUID: 05382a5317cf938117548b5b76fc9ed5a003b25d
Title: extra pipes opened with exec
Type: Bug Created on: 2015-12-09 13:46:25
Submitter: anonymous Assigned to: nobody
Subsystem: 16. Commands A-H Severity: Important
Priority: 5 Medium Last modified: 2026-10-22 17:19:31
Status: Closed Closed by: serhiy.storchaka
Resolution: Fixed Closed on: 2026-10-21 10:03:38
Version: 8.5.9
Description:
#!/usr/bin/tclsh

if {$::argv > 0} {
  incr ::argv -1
  exec $::argv0 $::argv &
  exit 0
}

vwait forever

-- snip --

run the snippet as 'foo.tcl <number>' then check the open fds with 'ls -l /proc/<pid>/fd/'

argv = 1 gives 4 pipes
argv = 5 gives 12 pipes
etc

bug is present on tcl 8.5.9
bug is (apparently) not present on tcl 8.6.1. always 2 pipes, regardless of iterations
User Comments:
serhiy.storchaka added on 2026-10-21 10:03:38:

Fixed in 8.5.13 by [662a69f571] (backport of [5a5e87fae7], in 8.6.0): the notifier's internal pipes are now close-on-exec, so exec'd children no longer inherit them.