Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#30749 closed defect (fixed)

TMPDIR in root login foils building ports

Reported by: merlyn.macports@… Owned by: macports-tickets@…
Priority: Low Milestone: MacPorts 2.0.2
Component: base Version: 2.0.1
Keywords: Cc:
Port:

Description

I know, every single doc says you should "sudo port blah blah". But if you're already logged in as root, the "sudo" step seems redundant.

However, ports fail to build! The login process sets up a TMP_DIR environment variable pointing at a directory owned by root. When "port" drops privileges to finish the build, the less-privileged user cannot write into TMP_DIR, and fails.

Using "sudo" takes care of erasing most of the environment, so this isn't normally a problem.

However, if the "port" command could also deliberately remove TMP_DIR from the environment, that would allow direct execution of "port" by root, without worrying about TMP_DIR problems.

Change History (4)

comment:1 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

I agree using sudo would seem to be unnecessary if you're already root. The port command does already deliberately remove everything from the environment. Not sure why TMP_DIR didn't get removed in your case.

comment:2 Changed 13 years ago by jmroot (Joshua Root)

Keywords: TMP_DIR removed
Summary: TMP_DIR in root login foils building portsTMPDIR in root login foils building ports

It most certainly does not remove everything from the environment. source:/trunk/base/src/macports1.0/macports.tcl#L841

    set keepenvkeys {
        DISPLAY DYLD_FALLBACK_FRAMEWORK_PATH
        DYLD_FALLBACK_LIBRARY_PATH DYLD_FRAMEWORK_PATH
        DYLD_LIBRARY_PATH DYLD_INSERT_LIBRARIES
        HOME JAVA_HOME MASTER_SITE_LOCAL ARCHIVE_SITE_LOCAL
        PATCH_SITE_LOCAL PATH PORTSRC RSYNC_PROXY TMP TMPDIR
        USER GROUP
        http_proxy HTTPS_PROXY FTP_PROXY ALL_PROXY NO_PROXY
        COLUMNS LINES
    }

comment:3 Changed 13 years ago by jmroot (Joshua Root)

Resolution: fixed
Status: newclosed

comment:4 Changed 13 years ago by jmroot (Joshua Root)

Milestone: MacPorts 2.0.2
Note: See TracTickets for help on using tickets.