Skip to content
Tcl Source Code View Ticket
Login

View Ticket

glob tilde expansion injects extra slash.

Closed / Invalid3539231fffffffffffffffffffffffffffffffffCreated 14 years agoUpdated 13 years ago
Descriptionplain2012-07-01 04:13:03
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.
dkfplain2012-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.
dkf Ticket [3539231fff]: 3 changes [History diff]2012-07-02 16:38:06
dgp Ticket [3539231fff]: 1 change [History diff]2012-07-02 22:21:09
dgpplain2012-07-03 00:08:05
What does

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

return?
dgpplain2012-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.
blacksqrplain2012-07-03 11:21:12
% file normalize [lindex [glob ~dash-user] 0]
/home/dash-user
dgpplain2012-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.
dkf Closed ticket [3539231fff]. [History diff]2013-11-12 12:37:47
Log in (anonymous is fine) to add a comment.