Commit Graph

9 Commits

Author SHA1 Message Date
Eric Miotto
a10313ec51 Reduce surface for command injection in some Python scripts
Namely, in scripts that alter the search paths for dylibs, ensure to
invoke `/usr/bin/xcrun` directly to run `dyld_info` and
`install_name_tool`, and validate that each argument is a valid path.

Addresses rdar://160463033
2025-09-16 07:18:32 -07:00
Kavon Farvardin
e9ba998723 emit a message when falling-back to xcrun dyldinfo 2022-09-15 15:36:30 -07:00
Dario Rexin
de91842938 [Build] Update scripts to use dyld_info (#60532)
* [Build] Update scripts to use dyld_info

dyldinfo has been deprecated and will no longer be available on newer Xcode releases. It has been replaced with dyld_info. To stay compatible with older releases, we are still falling back to dyldinfo, if dyld_info is not available.

rdar://98570807

* Apply suggestions from code review

Co-authored-by: Guillaume Lessard <glessard@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Guillaume Lessard <glessard@users.noreply.github.com>
2022-08-12 17:48:05 -07:00
Daniel Duan
3dfc40898c [NFC] Remove Python 2 imports from __future__ (#42086)
The `__future__` we relied on is now,  where the 3 specific things are
all included [since Python 3.0](https://docs.python.org/3/library/__future__.html):

* absolute_import
* print_function
* unicode_literals
* division

These import statements are no-ops and are no longer necessary.
2022-04-13 14:01:30 -07:00
Karoy Lorentey
d0e377e737 [utils] Use Python 2 compatible name for text=True 2022-03-08 12:03:56 -08:00
Karoy Lorentey
bcddc9b7b9 [utils] Force subprocess output to be read in text mode
In Python 3, subprocess output is read as binary data by default, which isn’t what we want.

Instead of reading process output as byte strings, then manually decoding them into strings, simply pass `text=True` to functions in the `subprocess` module, so that we get properly decoded strings right out the box.

This fixes places that forget to do the decoding step — most especially, the `update-checkout` script. That script prints Git output as byte strings, which leads to unreadable results.

Additionally, in shell.run, use the same pipe for capturing both stdout and stderr. The distinction is pretty pointless in this use case; however, keeping the two channels separate means that we lose the original ordering of printed messages, which does matter.
2022-03-07 16:59:36 -08:00
John McCall
a7f4534a77 Harden swift-rpathize against possible first-column output from dyldinfo 2020-10-22 23:42:31 -04:00
tbkka
c5176c0315 Update swift-rpathize.py to work with Python 3.8 and Python 2.7 (#34332)
* Update swift-rpathize.py to work with Python 3.8 and Python 2.7

In Python 2, str() is also a kind of bytes blob
In Python 3, str() is a Unicode string that's unrelated

* Avoid `l` as a variable name

Python-lint correctly warns about single-character variables that can be confused with numbers
2020-10-20 09:14:17 -07:00
John McCall
1cc3a57e91 Test the just-built dylibs when building unittests on Darwin 2020-10-15 00:36:36 -04:00