Opened 10 years ago

Closed 10 years ago

#43194 closed defect (worksforme)

Failed to initialize Macports

Reported by: awil1026.1090@… Owned by: neverpanic (Clemens Lang)
Priority: Normal Milestone:
Component: base Version: 2.2.1
Keywords: Cc:
Port:

Description (last modified by neverpanic (Clemens Lang))

My port command does not function at all. Here is the output i get when using s simple port command:

%% sudo port 
error reading "file6": illegal operation on a directory
    while executing
"gets $f"
    (procedure "auto_load_index" line 23)
    invoked from within
"auto_load_index"
    (procedure "auto_load" line 30)
    invoked from within
"auto_load $name [uplevel 1 {::namespace current}]"
    (autoloading "::tcl::tm::UnknownHandler")
    (procedure "::unknown" line 30)
    invoked from within
"::tcl::tm::UnknownHandler  {::tcl::MacOSXPkgUnknown ::tclPkgUnknown} msgcat 0-"
    ("package unknown" script)
    invoked from within
"package require msgcat"
    (file "/opt/local/share/macports/Tcl/registry2.0/registry.tcl" line 40)
    invoked from within
"source /opt/local/share/macports/Tcl/registry2.0/registry.tcl"
    ("package ifneeded registry 1.0" script)
    invoked from within
"package require registry 1.0"
    (procedure "mportinit" line 444)
    invoked from within
"mportinit ui_options global_options global_variations"
Error: /opt/local/bin/port: Failed to initialize MacPorts, error reading "file6": illegal operation on a directory

I've searched the for a fix, but can't find anything

Attachments (1)

find_the_culprit.tcl (424 bytes) - added by neverpanic (Clemens Lang) 10 years ago.

Download all attachments as: .zip

Change History (13)

comment:1 Changed 10 years ago by neverpanic (Clemens Lang)

Component: portsbase
Description: modified (diff)
Keywords: port file6 removed
Owner: changed from macports-tickets@… to cal@…

Please use WikiFormatting when posting in Trac.

I'm not sure why auto_load_index is trying to read a directory named file6 from some path where it probably shouldn't be, but I think the error might also be occurring because of Tcl 8.6. Please provide the output of

head -n4 /opt/local/bin/port
echo 'puts [info patchlevel]' | /usr/bin/tclsh

comment:2 Changed 10 years ago by awil1026.1090@…

here is the output of that command:

#!/bin/sh
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
# Run the Tcl interpreter \
exec /usr/bin/tclsh "$0" "$@"
iMac:~ imac$ echo 'puts [info patchlevel]' | /usr/bin/tclsh
8.5.9

comment:3 Changed 10 years ago by neverpanic (Clemens Lang)

OK, so the problem isn't with the version of Tcl used, but it seems there's a file or directory in one of the paths referenced by your $auto_path variable that shouldn't be there.

What are the contents of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts? Do you have a file called tclIndex there? Also, does tm.tcl exist in this directory and does that file contain proc ::tcl::tm::UnknownHandler?

From the error message and reading the source code it seems that in one of the directories printed by

echo 'puts $auto_path' | /usr/bin/tclsh

there is a directory called tclIndex. Is that correct?

comment:4 Changed 10 years ago by awil1026.1090@…

Yes, I have the tclIndex and the tm.tcl with the line proc ::tcl::tm::UnknownHandler {original name args} in the /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts directory.

The last question: there is a directory called tclIndex, are you asking if there is a tclIndex folder within the /usr/bin/tclsh directory?

The answer to that question would be no, but if you are reemphasizing whether I had the tclIndex folder within the /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts directory, then yes as stated above.

comment:5 in reply to:  4 Changed 10 years ago by neverpanic (Clemens Lang)

Replying to awil1026.1090@…:

Yes, I have the tclIndex and the tm.tcl with the line proc ::tcl::tm::UnknownHandler {original name args} in the /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts directory.

OK. tm.tcl obviously is a file, but is tclIndex a file aswell, or is it a directory? It should be a file, if it's a directory your Tcl installation is broken.

The last question: there is a directory called tclIndex, are you asking if there is a tclIndex folder within the /usr/bin/tclsh directory?

No, I'm not asking if there's a tclIndex folder in /usr/bin/tclsh, because /usr/bin/tclsh is a file.

The answer to that question would be no, but if you are reemphasizing whether I had the tclIndex folder within the /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts directory, then yes as stated above.

Yeah, so that's the problem here. I'm not sure how you ended up with a folder called tclIndex in this system directory. Maybe your filesystem is flipping some bits it shouldn't? Try running repair from Disk Utility, and if that doesn't fix it, do the following:

  • Move /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/tclIndex aside, e.g. to tclIndex.bak
  • Recreate the tclIndex file by running cd /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts && echo 'auto_mkindex .' | sudo /usr/bin/tclsh
  • Make sure the new tclIndex file has the correct permissions (rw for root, readable by group and world).

comment:6 Changed 10 years ago by awil1026.1090@…

I made a mistake, the tclIndex is a file (and not a folder as I previously said) in that location. I typed tclIndex folder unintentionally.

Changed 10 years ago by neverpanic (Clemens Lang)

Attachment: find_the_culprit.tcl added

comment:7 Changed 10 years ago by neverpanic (Clemens Lang)

I have attached a script. Please download it, make it executable, run it and paste its output. It recreates the steps that fail in auto_load_index and prints some debugging information that should easily pinpoint the problem.

comment:8 Changed 10 years ago by awil1026.1090@…

here is the output I got from terminal
iMac:Downloads imac$ tclsh find_the_culprit.tcl file /Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/tclIndex

none /Library/Frameworks/Tcl.framework/Versions/8.5/Resources/tclIndex
none /usr/local/lib/tclIndex
none ~/Library/Tcl/tclIndex
none /Library/Tcl/tclIndex
none /System/Library/Tcl/tclIndex
none ~/Library/Frameworks/tclIndex
none /Library/Frameworks/tclIndex
none /System/Library/Frameworks/tclIndex
none /Library/Tcl/teapot/package/macosx10.5-i386-x86_64/lib/tclIndex
none /Library/Tcl/teapot/package/tcl/lib/tclIndex

comment:9 Changed 10 years ago by neverpanic (Clemens Lang)

OK, so the problem isn't in any of the default entries of $auto_path. IIRC MacPorts adds a directory to the $auto_path variable during initialization, so maybe that one's the culprit. That directory would be /opt/local/share/macports/Tcl. Do you have a directory called tclIndex there?

comment:10 Changed 10 years ago by awil1026.1090@…

Nope, no tclIndex in that directory either

comment:11 Changed 10 years ago by neverpanic (Clemens Lang)

I'm not sure where to go from there then. You could try installing the 2.3 beta over your current installation, that might fix things.

There's not much MacPorts can do about this, though -- we rely on a working Tcl installation, and yours doesn't appear to be.

comment:12 Changed 10 years ago by neverpanic (Clemens Lang)

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.