classification
Title: Mac installer shell updater script silently fails if default shell is fish
Type: behavior Stage: resolved
Components: Installation, macOS Versions: Python 3.10, Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ned.deily Nosy List: elias, erlendaasland, miss-islington, ned.deily, ronaldoussoren
Priority: normal Keywords: patch

Created on 2016-12-26 18:46 by elias, last changed 2021-01-28 14:56 by ned.deily. This issue is now closed.

Files
File name Uploaded Description Edit
0001-bpo-29076-Add-fish-support-to-macOS-build.patch erlendaasland, 2020-02-28 13:49 0001-bpo-29076-Add-fish-support-to-macOS-build.patch
Pull Requests
URL Status Linked Edit
PR 23302 merged erlendaasland, 2020-11-15 16:50
PR 23937 merged miss-islington, 2020-12-25 11:01
PR 23938 merged miss-islington, 2020-12-25 11:01
Messages (15)
msg284036 - (view) Author: Elias Zamaria (elias) * Date: 2016-12-26 18:46
I have a Mac running OS X 10.11.6, Python 3.5.2, and fish 2.3.1. I installed Python 3.6.0, and everything seemed to work fine. However, I typed "python3" in my shell and it started Python 3.5.2.

I restarted my shell and typed "python3", and it still started Python 3.5.2. I ran "which python3" and it told me "/Library/Frameworks/Python.framework/Versions/3.5/bin/python3".

I ran "echo $PATH" and it told me "/Library/Frameworks/Python.framework/Versions/3.5/bin", among other directories that seem unrelated to Python.

I thought that maybe the installer updated my ~/.bash_profile, assuming that I am using bash like most people, but I looked in that file, and the only things affecting my path that look Python-related are adding the directories "/Library/Frameworks/Python.framework/Versions/2.7/bin" and "/Library/Frameworks/Python.framework/Versions/3.5/bin".

I re-ran the installer, clicked the "Customize" button, made sure that the "Shell profile updater" checkbox was checked, and ran "python3", and it started Python 3.5.2.

I can probably fix this by adding the right directory to my $PATH, but I think it is a bug if the installer doesn't make that change for me, or even try to make the change.
msg284041 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-12-26 20:06
Can you check what the permissions and ownership are on your existing .bash_profile file?  Also, as you suspected, the installer's profile updater script does not currently look for fish initialization files.
msg284049 - (view) Author: Elias Zamaria (elias) * Date: 2016-12-26 23:10
I just ran "ls -l ~/.bash_profile" and got the following output:

-rw-r--r--+ 1 Elias  staff  1057 Jul  2 11:04 /Users/Elias/.bash_profile
msg284050 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-12-26 23:30
Thanks for the info.  The '+' is the ls output indicates there is extended security information for .bash_profile, probably an access control list entry that affects it.  I suspect that might be the reason that .bash_profile does not get updated by the installer script; it seems to work for me but there are certainly a lot of different configurations the script has to deal with.  Try "ls -le .bash_profile'.
msg284052 - (view) Author: Elias Zamaria (elias) * Date: 2016-12-26 23:40
I just ran "ls -le ~/.bash_profile" and got this result:

-rw-r--r--+ 1 Elias  staff  1057 Jul  2 11:04 /Users/Elias/.bash_profile
 0: user:_spotlight inherited allow read,execute,readattr,readextattr,readsecurity
msg284053 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-12-27 01:47
OK, that shouldn't be an issue.  I'm just guessing at this point since nothing has changed in the profile updater script in a long time over many releases.  I'm assuming you are running the installer under the same user name (Elias) and that Elias is an admin user.  Fortunately, you can run the script manually  since a copy is installed in /Applications/Python 3.6.  Try double-clicking on the "Update Shell Profile.command" file there and see what shows up in the ensuing terminal window.  If it now works, try restoring the original file:

mv ~/.bash_profile.pysave ~/.bash_profile

and rerun the installer and, and before quitting the installer, checking the installer log output (CMD-L and then selecting the all messages option) for clues.
msg284054 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2016-12-27 01:57
Ah!  If you have made "fish" your default shell, the updater script should fail with the message "Sorry, I don't know how to patch ... shells".  Perhaps your default shell was still bash back when you previously installed Python 3.5 and 2.7?  If so, then the issue is simply that the updater script doesn't support fish.
msg284586 - (view) Author: Elias Zamaria (elias) * Date: 2017-01-03 18:15
Ned, that sounds plausible. I think I started using fish after I installed Python 3.5, but before I installed Python 3.6.
msg362879 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2020-02-28 13:49
I've created a patch that applies fine to 3.7, 3.8 and 3.9, if anyone still is interested.

(Backporting to 3.6 and 2.7 is probably not going to happen, but at least the patch applies fine to both of them.)


The "Versions" label list should probably be updated to include 3.8 and 3.9.
msg381008 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2020-11-15 09:31
@Erland: The attached patch looks fine to me. Could you convert it to a PR?
msg381021 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2020-11-15 16:43
Sure, I'll create a PR right away.
msg383733 - (view) Author: miss-islington (miss-islington) Date: 2020-12-25 11:02
New changeset 7f162e867c674f57c308a87fffcdcca3540c8933 by Erlend Egeberg Aasland in branch 'master':
bpo-29076: Add fish support to macOS installer (GH-23302)
https://github.com/python/cpython/commit/7f162e867c674f57c308a87fffcdcca3540c8933
msg385867 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2021-01-28 14:54
New changeset e9c6c26aff08e4c7bc6f1e8015cdd8edcc92dbef by Miss Islington (bot) in branch '3.9':
bpo-29076: Add fish support to macOS installer (GH-23302) (GH-23937)
https://github.com/python/cpython/commit/e9c6c26aff08e4c7bc6f1e8015cdd8edcc92dbef
msg385868 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2021-01-28 14:55
New changeset 81b23a9b148b60f8f541e4b06e1d88c58644e3b8 by Miss Islington (bot) in branch '3.8':
bpo-29076: Add fish support to macOS installer (GH-23302) (GH-23938)
https://github.com/python/cpython/commit/81b23a9b148b60f8f541e4b06e1d88c58644e3b8
msg385869 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2021-01-28 14:56
Thanks for the PR!
History
Date User Action Args
2021-01-28 14:56:00ned.deilysetstatus: open -> closed
resolution: fixed
messages: + msg385869

stage: patch review -> resolved
2021-01-28 14:55:05ned.deilysetmessages: + msg385868
2021-01-28 14:54:10ned.deilysetmessages: + msg385867
2020-12-25 11:02:01miss-islingtonsetmessages: + msg383733
2020-12-25 11:01:58miss-islingtonsetpull_requests: + pull_request22788
2020-12-25 11:01:47miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request22787
2020-11-15 16:50:59erlendaaslandsetstage: needs patch -> patch review
pull_requests: + pull_request22193
2020-11-15 16:43:52erlendaaslandsetmessages: + msg381021
2020-11-15 09:31:11ronaldoussorensetmessages: + msg381008
versions: + Python 3.8, Python 3.9, Python 3.10, - Python 2.7, Python 3.6, Python 3.7
2020-02-28 13:49:05erlendaaslandsetfiles: + 0001-bpo-29076-Add-fish-support-to-macOS-build.patch

nosy: + erlendaasland
messages: + msg362879

keywords: + patch
2017-03-03 20:34:14ned.deilysettitle: Py 3.6 Mac installer doesn't update "python3" shell command -> Mac installer shell updater script silently fails if default shell is fish
stage: needs patch
versions: + Python 2.7, Python 3.7
2017-01-03 18:15:43eliassetmessages: + msg284586
2016-12-31 05:17:43terry.reedysettitle: Python 3.6 installer doesn't update "python3" shell command -> Py 3.6 Mac installer doesn't update "python3" shell command
2016-12-27 01:57:18ned.deilysetmessages: + msg284054
2016-12-27 01:47:19ned.deilysetmessages: + msg284053
2016-12-26 23:40:58eliassetmessages: + msg284052
2016-12-26 23:30:46ned.deilysetmessages: + msg284050
2016-12-26 23:10:43eliassetmessages: + msg284049
2016-12-26 20:06:51ned.deilysetmessages: + msg284041
2016-12-26 19:54:57ned.deilysetassignee: ned.deily
2016-12-26 18:46:59eliassettype: behavior
2016-12-26 18:46:40eliascreate