Tcl Source Code

View Ticket
Login
Ticket UUID: 3539231
Title: glob tilde expansion injects extra slash.
Type: Bug Version: obsolete: 8.5.11
Submitter: blacksqr Created on: 2012-07-01 04:13:03
Subsystem: 36. Pathname Management Assigned To: dgp
Priority: 3 Low Severity: Minor
Status: Closed Last Modified: 2013-11-12 12:37:47
Resolution: Invalid Closed By: dkf
    Closed on: 2013-11-12 12:37:47
Description:
When a user account is created whose name has a dash in it, attempting to glob the account's home directory results in an extra slash appearing in the result path string:

$ useradd -b /home/ -p dash -m dash-user
$ tclsh
% info patchlevel
8.5.11
% glob ~dash-user
/home//dash-user

Ubuntu 12.04 64-bit.  Tclsh installed from default repository using apt-get.
User Comments: dgp added on 2012-07-05 21:17:30:
I don't have root on any linux systems, so I cannot reproduce
the issue.  Best I can tell from examining the Tcl source code,
whichever of the system's getpwnam* family of system calls
is called is returning the non-normalized result.  The system tells
Tcl this is the home directory to use, and Tcl believes the system
and stores it for future use when talking to the system again.
That seems like the right thing to be doing.  I'd say "Not a Bug."

If someone with ability to reproduce can dig out more details that
contradict that view, please speak up.

blacksqr added on 2012-07-03 11:21:12:
% file normalize [lindex [glob ~dash-user] 0]
/home/dash-user

dgp added on 2012-07-03 00:15:38:
Any testing you can do to determine whether the
bad results come back from the getpwnam* system
calls or not would be useful.

dgp added on 2012-07-03 00:08:05:
What does

file normalize [lindex [glob ~dash-user] 0]

return?

dkf added on 2012-07-02 16:38:05:
The system has an obviously non-normalized name for the user's home directory? That's... well, not really Tcl's fault IMO (there are cases where normalizing would be bad IIRC, such as automounters). My inclination would be Wont Fix, but I don't claim to be an expert on what [glob] should do here.