Tcl Source Code

View Ticket
Login
Ticket UUID: 24ebbce9635d2a149e59df37af1dae971220bfd3
Title: [file] operations return EFAULT when [pwd] is inaccessible
Type: Bug Version:
Submitter: sgolovan Created on: 2018-11-09 07:48:33
Subsystem: 16. Commands A-H Assigned To: dgp
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2018-11-09 12:13:19
Resolution: Duplicate Closed By: dgp
    Closed on: 2018-11-09 12:13:19
Description:
Appears that if tclsh starts in an inaccessible working directory,
some [file] operations like [file delete] return EFAULT.
The way to reproduce the problem has been reporte to Debian
at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=913189

$ rm -rf d
$ mkdir d
$ cd d
$ rm -rf ../d
$ env - pwd
pwd: couldn't find directory entry in '..' with matching i-node
$ tclsh8.6
% file delete spong
error deleting "spong": bad address in system call argument
%

strace shows:

getcwd(0x7ffcf224aeb0, 4097)            = -1 ENOENT (No such file or directory)
lstat(NULL, 0x7ffcf224c100)             = -1 EFAULT (Bad address)

I would expect another error (file not found) in this case.
Or is there a reason for this behavior?
User Comments: dgp added on 2018-11-09 12:13:19:
Duplicate

https://core.tcl-lang.org/tcl/tktview?name=469c5ea507