From 816d01ae8669b3da69566cedfb027972b0da8b67 Mon Sep 17 00:00:00 2001 From: Jonathon Reinhart Date: Thu, 2 Dec 2021 21:20:16 -0500 Subject: [PATCH 1/2] staticx: Initialize tmpdir in StaticxGenerator.__init__ add_library() can be called before generate(), in which case .tmpdir will be None. This bug was introduced in 57a147f0bb when add_library() was first used outside of generate(). This fixes #216 --- staticx/api.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/staticx/api.py b/staticx/api.py index fc1e7f0..69aef90 100755 --- a/staticx/api.py +++ b/staticx/api.py @@ -41,7 +41,7 @@ def __init__(self, prog, strip=False, compress=True, debug=False, cleanup=True): # Temporary output file (bootloader copy) self.tmpoutput = None self.tmpprog = None - self.tmpdir = None + self.tmpdir = mkdtemp(prefix='staticx-archive-') f = NamedTemporaryFile(prefix='staticx-archive-', suffix='.tar') self.sxar = SxArchive(fileobj=f, mode='w', compress=self.compress) @@ -130,7 +130,6 @@ def generate(self, output): # Build the archive to be appended - self.tmpdir = mkdtemp(prefix='staticx-archive-') with self.sxar as ar: run_hooks(self) From 27f07b705dfa90499c2a327e2d56baf2f3f59d05 Mon Sep 17 00:00:00 2001 From: Jonathon Reinhart Date: Thu, 2 Dec 2021 21:38:29 -0500 Subject: [PATCH 2/2] Update changlog for #217 --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c46a3d8..0653778 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,11 @@ This project adheres to [Semantic Versioning](https://semver.org/). ## [Unreleased] ### Changed -- Change --debug option to appear in CLI help output +- Change `--debug` option to appear in CLI help output + +### Fixed +- Fix bug sometimes causing a crash when `-l` is used ([#217]) + ## [0.13.5] - 2021-10-26 ### Fixed @@ -293,3 +297,4 @@ Initial release [#204]: https://github.com/JonathonReinhart/staticx/pull/204 [#208]: https://github.com/JonathonReinhart/staticx/pull/208 [#210]: https://github.com/JonathonReinhart/staticx/pull/210 +[#217]: https://github.com/JonathonReinhart/staticx/pull/217