-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Invalid use of subproceess.Popen
API with wrapped file objects
#3101
Merged
+21
−8
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LZMAFile
objectsubproceess.Popen
API with wrapped file objects
achimnol
requested changes
Nov 15, 2024
achimnol
approved these changes
Nov 15, 2024
lablup-octodog
pushed a commit
that referenced
this pull request
Nov 15, 2024
…#3101) Co-authored-by: Joongi Kim <[email protected]> Backported-from: main (24.12) Backported-to: 24.09 Backport-of: 3101
lablup-octodog
pushed a commit
that referenced
this pull request
Nov 15, 2024
…#3101) Co-authored-by: Joongi Kim <[email protected]> Backported-from: main (24.12) Backported-to: 23.09 Backport-of: 3101
This was referenced Nov 15, 2024
lablup-octodog
pushed a commit
that referenced
this pull request
Nov 15, 2024
…#3101) Co-authored-by: Joongi Kim <[email protected]> Backported-from: main (24.12) Backported-to: 24.03 Backport-of: 3101
github-merge-queue bot
pushed a commit
that referenced
this pull request
Nov 15, 2024
…#3101) (#3105) Co-authored-by: Kyujin Cho <[email protected]> Co-authored-by: Joongi Kim <[email protected]>
achimnol
added a commit
that referenced
this pull request
Nov 15, 2024
…#3101) Co-authored-by: Joongi Kim <[email protected]> Backported-from: main (24.12) Backported-to: 24.09 Backport-of: 3101
achimnol
added a commit
that referenced
this pull request
Nov 15, 2024
…#3101) Co-authored-by: Joongi Kim <[email protected]> Backported-from: main (24.12) Backported-to: 23.09 Backport-of: 3101
github-merge-queue bot
pushed a commit
that referenced
this pull request
Nov 15, 2024
…#3101) (#3103) Co-authored-by: Kyujin Cho <[email protected]> Co-authored-by: Joongi Kim <[email protected]>
github-merge-queue bot
pushed a commit
that referenced
this pull request
Nov 16, 2024
…#3101) (#3104) Co-authored-by: Kyujin Cho <[email protected]> Co-authored-by: Joongi Kim <[email protected]>
lablup-octodog
pushed a commit
that referenced
this pull request
Nov 16, 2024
lablup-octodog
pushed a commit
that referenced
this pull request
Nov 16, 2024
lablup-octodog
pushed a commit
that referenced
this pull request
Nov 16, 2024
github-merge-queue bot
pushed a commit
that referenced
this pull request
Nov 16, 2024
Co-authored-by: Joongi Kim <[email protected]>
github-merge-queue bot
pushed a commit
that referenced
this pull request
Nov 16, 2024
Co-authored-by: Joongi Kim <[email protected]>
achimnol
added a commit
that referenced
this pull request
Nov 16, 2024
Co-authored-by: Joongi Kim <[email protected]>
Yaminyam
pushed a commit
that referenced
this pull request
Feb 12, 2025
…#3101) Co-authored-by: Joongi Kim <[email protected]>
Yaminyam
pushed a commit
that referenced
this pull request
Feb 12, 2025
Yaminyam
pushed a commit
that referenced
this pull request
Feb 12, 2025
…#3101) Co-authored-by: Joongi Kim <[email protected]>
Yaminyam
pushed a commit
that referenced
this pull request
Feb 12, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix
LZMAFile
andGZipFile
instances incorrectly fed toasyncio.create_subprocess_exec()
'sstdin
parameter.The following code looks legitimately working and it actually executes:
Under the hood, the
subprocess.Popen
constructor callsf.fileno()
method that returns the file descriptor representing the raw file stream before decompression.These confusing behavior made
create_subprocess_exec()
not to hand out the extracted tarball to thedocker load
command, but rather passing original uncompressed.xz
(or.gz
) file, asPopen
tries to locate make use of the file descriptor (which returned byfileno()
method) rather than usingIOBase
's high-levelread()
API whereLZMAFile
andGZipFile
performs decompression.We should have done either:
(for files whose sizes are controlled by us), or:
(for files that may have arbitrarily large sizes).
Even though it is definitely not an intended situation, as
docker load
also accepts tarballs compressed with either XZ or GZip algorithm (ref) - which has effectively hidden this long-standing bug, at least for more than 5 years...Checklist: (if applicable)