Opened 13 years ago

Closed 12 years ago

Last modified 11 years ago

#16199 closed defect (fixed)

MacPorts-1-1.6.0 postflight shell recognition failure

Reported by: nick.colclasure@… Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: base Version: 1.6.0
Keywords: MacPorts-1-1.6.0 shell recognition postflight Cc:

Description (last modified by jmroot (Joshua Root))

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  7254  100  7254    0     0   8476      0 --:--:-- --:--:-- --:--:-- 19737
The MacPorts Project, postflight script version 1.6.1: checking the shell environment for user "root".
'''Unknown shell (sh)! Please set your MacPorts compatible environment manually.'''
Synchronizing the MacPorts installation with the project's rsync server...
Synchronizing local ports tree from rsync://
receiving file list ... done

sent 32 bytes  received 323800 bytes  23987.56 bytes/sec
total size is 18646973  speedup is 57.58

MacPorts base version 1.600 installed
receiving file list ... done

sent 32 bytes  received 6472 bytes  1858.29 bytes/sec
total size is 3962384  speedup is 609.22

Downloaded MacPorts base version 1.600

The MacPorts installation is not outdated and so was not updated
selfupdate done!

I ran basename $SHELL and it returned bash.

Change History (11)

comment:1 Changed 13 years ago by raimue (Rainer Müller)

Did you switch to the root user by using su? You should use sudo because otherwise the script can't determine for which user it should setup the .profile.

comment:2 Changed 13 years ago by nick.colclasure@…

yes, and it still doesn't work.

comment:3 Changed 13 years ago by raimue (Rainer Müller)

The postflight script is not using the SHELL environment variable, because in it is always run with the same shell.

The following command is used to determine the login shell for the current user.

dscl . -read /users/${USER} shell

Probably your login shell is set to something different than what your terminal starts?

comment:4 Changed 13 years ago by nick.colclasure@…

dscl . -read /users/${USER} shell shell: /bin/bash

comment:5 Changed 13 years ago by raimue (Rainer Müller)

Could you please show how you ran the command?

comment:6 Changed 13 years ago by nick.colclasure@…

$ dscl . -read /users/${USER} shell a direct copy of yours above. I also changed the preferences and chose the option "Execute this command (specify complete path) with the path specified as /bin/bash

comment:7 Changed 13 years ago by raimue (Rainer Müller)

No, sorry. I meant how you invoked the postflight script. But after some testing I was now able to reproduce the issue anyway.

A simple reproduction recipe for the problem:

echo 'echo $USER $SUDO_USER' >
chmod +x
sudo ./

This gives for me

root raim

The postflight script reads $USER which is set to 'root' when running with sudo. But in $USER is probably exported to the installing user. Maybe it should just respect $SUDO_USER, if available.


bash postflight
sudo port -v selfupdate

No sudo for postflight this time, most probably you will see an error message that selfupdate failed. But that's no big deal and we just do it afterwards.

comment:8 Changed 13 years ago by nick.colclasure@…

Thanks, problem solved.

comment:9 Changed 12 years ago by tobypeterson

Milestone: MacPorts base bugsMacPorts Future

Milestone MacPorts base bugs deleted

comment:10 in reply to:  8 Changed 12 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Resolution: fixed
Status: newclosed

Replying to nick.colclasure@…:

Thanks, problem solved.

Since the problem seems to have been resolved, this ticket will be closed.
If it was closed in error, please reopen.

comment:11 Changed 11 years ago by jmroot (Joshua Root)

Description: modified (diff)
Milestone: MacPorts Future
Note: See TracTickets for help on using tickets.