Skip to content

Create temporary files in the target directory#2753

Merged
kientzle merged 2 commits intolibarchive:masterfrom
KlaraSystems:des/temp-files
Oct 29, 2025
Merged

Create temporary files in the target directory#2753
kientzle merged 2 commits intolibarchive:masterfrom
KlaraSystems:des/temp-files

Conversation

@dag-erling
Copy link
Copy Markdown
Contributor

Whenever we need to create a temporary file while writing to disk on a POSIX system, try to create it in the same directory as the final file instead of the current working directory. The target directory can reasonably be expected to be writable (and if it isn't, creating the file will fail anyway), but the current working directory may not be.

While here, consistently use __archive_mkstemp(), and increase the template from six to eight random characters.

Cf. 2e73ea3#commitcomment-167829103

This function performs the equivalent of POSIX dirname(3) on a
struct archive_string.
@dag-erling dag-erling force-pushed the des/temp-files branch 2 times, most recently from b31f54c to 678f1df Compare October 14, 2025 17:48
Whenever we need to create a temporary file while writing to disk on a
POSIX system, try to create it in the same directory as the final file
instead of the current working directory.  The target directory can
reasonably be expected to be writable (and if it isn't, creating the
file will fail anyway), but the current working directory may not be.

While here, consistently use __archive_mkstemp(), and increase the
template from six to eight random characters.

Fixes:		2e73ea3 ("Fix max path-length metadata writing (libarchive#2243)")
Fixes:		e12c955 ("Unify temporary directory handling")
@kientzle kientzle merged commit d2e8617 into libarchive:master Oct 29, 2025
19 checks passed
mmatuska pushed a commit to mmatuska/libarchive that referenced this pull request Nov 17, 2025
Create temporary files in the target directory

(cherry picked from commit d2e8617)
brainhoard-github pushed a commit to distro-core-curated-mirrors/poky-contrib that referenced this pull request Nov 24, 2025
Pick patch [2] as listed in [1].
To apply it cleanly, add two additional patches from branch patch/3.8.

[1] https://github.com/libarchive/libarchive/releases/tag/v3.8.3
[2] libarchive/libarchive#2753

(From OE-Core rev: 11f782c1ae9962a2faa98bff3566e49fbf6db017)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
brainhoard-github pushed a commit to distro-core-curated-mirrors/poky-contrib that referenced this pull request Nov 24, 2025
Pick patch [2] as listed in [1].
To apply it cleanly, add three additional patches from branch patch/3.8.

[1] https://github.com/libarchive/libarchive/releases/tag/v3.8.3
[2] libarchive/libarchive#2753

(From OE-Core rev: 201eed780c73335c9278db17fe39fb453e16af08)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
jpuhlman pushed a commit to MontaVista-OpenSourceTechnology/poky that referenced this pull request Nov 24, 2025
Source: poky
MR: 296373
Type: Integration
Disposition: Merged from poky-nut
ChangeID: 5c9a4d8765576f2170dfd8ca38e4325aaf535295
Description:

Pick patch [2] as listed in [1].
To apply it cleanly, add two additional patches from branch patch/3.8.

[1] https://github.com/libarchive/libarchive/releases/tag/v3.8.3
[2] libarchive/libarchive#2753

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Jeremy A. Puhlman <jpuhlman@mvista.com>
halstead pushed a commit to openembedded/openembedded-core that referenced this pull request Nov 26, 2025
Pick patch [2] as listed in [1].
To apply it cleanly, add two additional patches from branch patch/3.8.

[1] https://github.com/libarchive/libarchive/releases/tag/v3.8.3
[2] libarchive/libarchive#2753

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
brainhoard-github pushed a commit to distro-core-curated-mirrors/poky-contrib that referenced this pull request Nov 26, 2025
Pick patch [2] as listed in [1].
To apply it cleanly, add two additional patches from branch patch/3.8.

[1] https://github.com/libarchive/libarchive/releases/tag/v3.8.3
[2] libarchive/libarchive#2753

(From OE-Core rev: 11f782c1ae9962a2faa98bff3566e49fbf6db017)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
halstead pushed a commit to openembedded/openembedded-core that referenced this pull request Dec 1, 2025
Pick patch [2] as listed in [1].
To apply it cleanly, add three additional patches from branch patch/3.8.

[1] https://github.com/libarchive/libarchive/releases/tag/v3.8.3
[2] libarchive/libarchive#2753

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
halstead pushed a commit to yoctoproject/poky that referenced this pull request Dec 1, 2025
Pick patch [2] as listed in [1].
To apply it cleanly, add three additional patches from branch patch/3.8.

[1] https://github.com/libarchive/libarchive/releases/tag/v3.8.3
[2] libarchive/libarchive#2753

(From OE-Core rev: 201eed780c73335c9278db17fe39fb453e16af08)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
halstead pushed a commit to yoctoproject/poky that referenced this pull request Dec 1, 2025
Pick patch [2] as listed in [1].
To apply it cleanly, add two additional patches from branch patch/3.8.

[1] https://github.com/libarchive/libarchive/releases/tag/v3.8.3
[2] libarchive/libarchive#2753

(From OE-Core rev: 11f782c1ae9962a2faa98bff3566e49fbf6db017)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
jpuhlman pushed a commit to MontaVista-OpenSourceTechnology/poky that referenced this pull request Dec 12, 2025
Source: poky
MR: 302777
Type: Integration
Disposition: Merged from poky
ChangeID: 4030876
Description:

Pick patch [2] as listed in [1].
To apply it cleanly, add three additional patches from branch patch/3.8.

[1] https://github.com/libarchive/libarchive/releases/tag/v3.8.3
[2] libarchive/libarchive#2753

(From OE-Core rev: 201eed780c73335c9278db17fe39fb453e16af08)

Signed-off-by: Peter Marko <peter.marko@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Jeremy A. Puhlman <jpuhlman@mvista.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants