Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions python/yugabyte_db_thirdparty/library_checking.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ def compile_re_list(re_list: List[str]) -> Any:


def get_needed_libs(file_path: str) -> List[str]:
env = {"PATH": os.getenv("PATH")}
return capture_all_output(
['patchelf', '--print-needed', file_path],
env=env,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to remove all environment variables except PATH?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't per se, but in my use case the PATH variable was not being picked up unless I explicitly included it, like so

allowed_exit_codes={1},
extra_msg_on_nonzero_exit_code="Warning: could not determine libraries directly "
f"needed by {file_path}")
Expand Down Expand Up @@ -317,6 +319,9 @@ def __init__(self) -> None:
"^.* => /lib/",
"^.* => /usr/lib/x86_64-linux-gnu/",
"^.* => /opt/yb-build/brew/linuxbrew",
"^.* => /nix/store/",
"/bin/sh:",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to understand where this pattern comes from.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/nix/store is where everything in nixos lives including libraries, the /bin/sh: pattern is to exclude warnings generated by the tooling attempting to use /bin/sh which was doing something weird on nixos IIRC

"^.*/nix/store/",
f"^.* => {re.escape(YB_THIRDPARTY_DIR)}"
]

Expand Down