Title: Surprising behaviour with compileall -s STRIPDIR parameter · Issue #105931 · python/cpython · GitHub
Open Graph Title: Surprising behaviour with compileall -s STRIPDIR parameter · Issue #105931 · python/cpython
X Title: Surprising behaviour with compileall -s STRIPDIR parameter · Issue #105931 · python/cpython
Description: The '-s' stripdir parameter to compileall has very unusual semantics that could lead to unexpected and potentially confusing outcomes. For example, when run like this: python -m compileall -s/path/to/build/dst -p /lib /path/to/build/src/...
Open Graph Description: The '-s' stripdir parameter to compileall has very unusual semantics that could lead to unexpected and potentially confusing outcomes. For example, when run like this: python -m compileall -s/path/...
X Description: The '-s' stripdir parameter to compileall has very unusual semantics that could lead to unexpected and potentially confusing outcomes. For example, when run like this: python -m compileall ...
Opengraph URL: https://github.com/python/cpython/issues/105931
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Surprising behaviour with compileall -s STRIPDIR parameter","articleBody":"The '-s' stripdir parameter to compileall has very unusual semantics that could lead to unexpected and potentially confusing outcomes.\r\n\r\nFor example, when run like this: `python -m compileall -s/path/to/build/dst -p /lib /path/to/build/src/file.py`\r\n\r\nThe source file path written to the compiled file will be: `/lib/src/file.py`. In other words the source file path is partially stripped even though the strip prefix doesn't fully match the source file path. Since this was introduced in #16012 I'd like to get @frenzymadness to comment if this was intentional, because it seems that it could be a source of really confusing bugs for end users who accidentally misspell something in their invocation and get a partially stripped result.\r\n\r\nIt gets weirder than that however, when run like this: `python -m compileall -s/path/to/another/src -p /lib /path/to/build/src/file.py`\r\n\r\nThe source file path written to the compiled file will be: `/lib/build/file.py`. The matching directories are removed around the non-matching ones. Even if there was some reason for the first behaviour it seems this second one is absolutely not a good idea.\r\n\r\nI'm happy to fix this once it is confirmed this behaviour is unintentional.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-108671\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/hetmankp","@type":"Person","name":"hetmankp"},"datePublished":"2023-06-20T06:47:41.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/105931/cpython/issues/105931"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:94f04c1a-f8cf-c8e1-593a-f17ac748e133 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9488:8D103:EE1A6B:13F331C:696ACA68 |
| html-safe-nonce | 04f6dabf763a0de41794bde22bfd54fae3423c105bae45a860c7cc1145b8e5e9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NDg4OjhEMTAzOkVFMUE2QjoxM0YzMzFDOjY5NkFDQTY4IiwidmlzaXRvcl9pZCI6IjEzNDQzODYxODc3NDM5MDY0MDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b7ac8d10262e5ae05691ad01b85f849903ffc8ae10656257e3149b01da7f4a12 |
| hovercard-subject-tag | issue:1764755945 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/105931/issue_layout |
| twitter:image | https://opengraph.githubassets.com/133196322bc029ee5c99eaa1e5f4724d23386c70263fd2b1ccdda77714eac2e0/python/cpython/issues/105931 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/133196322bc029ee5c99eaa1e5f4724d23386c70263fd2b1ccdda77714eac2e0/python/cpython/issues/105931 |
| og:image:alt | The '-s' stripdir parameter to compileall has very unusual semantics that could lead to unexpected and potentially confusing outcomes. For example, when run like this: python -m compileall -s/path/... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | hetmankp |
| hostname | github.com |
| expected-hostname | github.com |
| None | c785f4ce187e9e7331257791b36ddee01625bb8e292a9b4fe2c16d4c006abf5d |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c718a376fcf780eb22089171adb84a543f660bf7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width