[SERVER-60769] Fix the adding of python links after fetching venv Created: 18/Oct/21  Updated: 29/Oct/23  Resolved: 18/Oct/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.2.0, 5.1.0-rc2

Type: Bug Priority: Major - P3
Reporter: Mikhail Shchatko Assignee: Mikhail Shchatko
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.1
Sprint: STM 2021-11-01
Participants:
Linked BF Score: 94
Story Points: 0

 Comments   
Comment by Githook User [ 21/Oct/21 ]

Author:

{'name': 'Mikhail Shchatko', 'email': 'mikhail.shchatko@mongodb.com', 'username': 'MikhailShchatko'}

Message: SERVER-60769 Don't make unnecessary symlinks in python venv

(cherry picked from commit 77c15c09579a523cf0aa557e395e47488b4f2bdf)
Branch: v5.1
https://github.com/mongodb/mongo/commit/6d06448fc1e78b176229b741eeb66bfb3ed62d96

Comment by Githook User [ 21/Oct/21 ]

Author:

{'name': 'Mikhail Shchatko', 'email': 'mikhail.shchatko@mongodb.com', 'username': 'MikhailShchatko'}

Message: SERVER-60769 Don't make unnecessary symlinks in python venv
Branch: master
https://github.com/mongodb/mongo/commit/77c15c09579a523cf0aa557e395e47488b4f2bdf

Comment by Mikhail Shchatko [ 21/Oct/21 ]

billy.donahue to avoid potential problems I'll remove that part entirely.

Comment by Billy Donahue [ 20/Oct/21 ]

I think there are lingering problems with this fix.

If the glob python3.* doesn't match any files, then it will remain unexpanded and will be passed verbatim to ls as an argument. ls doesn't understand glob patterns. I don't think there's any reason to use ls. The glob is trying to match non-directory files and symlinks named with dotted versions like python3.9.
A set +o errexit was added by SERVER-60769, immediately above the ls to suppress these failures but there was no reason for ls to be invoked at all, and the errexit option will cause other potential errors to be ignored.

set +o errexit
python3_dot_locs=$(ls python3.*)
for p in $python3_dot_locs; do
  rm "$p"
  ln -s python3 "$p"
done

IIUC, this loop is iterating over all dot-versioned python3.x executables and removing them. It then creates symlinks from python3 to all of those python3.x names, regardless of what the true version number of that source python3 is! So we are going to be creating symlinks with misleading names. I would never want a symlink called python3.7 to refer to an interpreter for a language that isn't Python v3.7.

Comment by Githook User [ 18/Oct/21 ]

Author:

{'name': 'Mikhail Shchatko', 'email': 'mikhail.shchatko@mongodb.com', 'username': 'MikhailShchatko'}

Message: SERVER-60769 Fix the adding of python links after fetching venv

(cherry picked from commit 77ee92d37be79b990fcf73c3b14659bffb0ff4fa)
Branch: v5.1
https://github.com/mongodb/mongo/commit/0e7fb3eba83ef0bbd1721d93ca14015e3099e50b

Comment by Githook User [ 18/Oct/21 ]

Author:

{'name': 'Mikhail Shchatko', 'email': 'mikhail.shchatko@mongodb.com', 'username': 'MikhailShchatko'}

Message: SERVER-60769 Fix the adding of python links after fetching venv
Branch: master
https://github.com/mongodb/mongo/commit/77ee92d37be79b990fcf73c3b14659bffb0ff4fa

Generated at Thu Feb 08 05:50:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.