Skip to content

[component] Grab tmpdir from policy#4062

Merged
TurboTurtle merged 1 commit into
sosreport:mainfrom
arif-ali:sos-arif-tmpdir-component
Jun 20, 2025
Merged

[component] Grab tmpdir from policy#4062
TurboTurtle merged 1 commit into
sosreport:mainfrom
arif-ali:sos-arif-tmpdir-component

Conversation

@arif-ali

Copy link
Copy Markdown
Member

Rather than using /var/tmp by default, grab the tmp_dir from the policy. The default will be from tempfile.gettempdir() from the sos.policies, so should be getting it from the OS default.

Closes: #4061


Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines

  • Is the commit message split over multiple lines and hard-wrapped at 72 characters?
  • Is the subject and message clear and concise?
  • Does the subject start with [plugin_name] if submitting a plugin patch or a [section_name] if part of the core sosreport code?
  • Does the commit contain a Signed-off-by: First Lastname email@example.com?
  • Are any related Issues or existing PRs properly referenced via a Closes (Issue) or Resolved (PR) line?
  • Are all passwords or private data gathered by this PR obfuscated?

Rather than using /var/tmp by default, grab the tmp_dir from the
policy. The default will be from tempfile.gettempdir() from the
sos.policies, so should be getting it from the OS default.

Closes: sosreport#4061

Signed-off-by: Arif Ali <arif.ali@canonical.com>
@arif-ali arif-ali added Status/Needs Review This issue still needs a review from project members Kind/Bug Something is not working, and this fixes the issue labels Jun 20, 2025
@packit-as-a-service

Copy link
Copy Markdown

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/sosreport-sos-4062
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

2 similar comments
@packit-as-a-service

Copy link
Copy Markdown

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/sosreport-sos-4062
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@packit-as-a-service

Copy link
Copy Markdown

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/sosreport-sos-4062
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@TurboTurtle TurboTurtle added Reviewed/Ready for Merge Has been reviewed, ready for merge and removed Status/Needs Review This issue still needs a review from project members labels Jun 20, 2025
@TurboTurtle TurboTurtle merged commit 57bbc89 into sosreport:main Jun 20, 2025
38 checks passed
@martinpitt

Copy link
Copy Markdown

This change made sosreport unpredictable, and putting reports into /tmp (tmpfs) by default is conceptually wrong. Please see #4074 for details.

martinpitt added a commit to martinpitt/cockpit that referenced this pull request Jul 9, 2025
sos 4.6.2 changed the tmp dir policy [1] from a static /var/tmp to a
dynamic per-distro policy, which happens to be /tmp on Debian/Ubuntu
right now. This is wrong, and there is no official way to query it [2].

To cope, query the sos policy for the tmp-dir, and only fall back to
static /var/tmp if that fails.

[1] sosreport/sos#4062
[2] sosreport/sos#4074
martinpitt added a commit to martinpitt/cockpit that referenced this pull request Jul 9, 2025
sos 4.6.2 changed the tmp dir policy [1] from a static /var/tmp to a
dynamic per-distro policy, which happens to be /tmp on Debian/Ubuntu
right now. This is wrong, and there is no official way to query it [2].

To cope, query the sos policy for the tmp-dir, and only fall back to
static /var/tmp if that fails.

[1] sosreport/sos#4062
[2] sosreport/sos#4074
martinpitt added a commit to martinpitt/cockpit that referenced this pull request Jul 9, 2025
sos 4.6.2 changed the tmp dir policy [1] from a static /var/tmp to a
dynamic per-distro policy, which happens to be /tmp on Debian/Ubuntu
right now. This is wrong, and there is no official way to query it [2].

To cope, query the sos policy for the tmp-dir, and only fall back to
static /var/tmp if that fails.

[1] sosreport/sos#4062
[2] sosreport/sos#4074
martinpitt added a commit to martinpitt/cockpit that referenced this pull request Jul 9, 2025
sos 4.6.2 changed the tmp dir policy [1] from a static /var/tmp to a
dynamic per-distro policy, which happens to be /tmp on Debian/Ubuntu
right now. This is wrong, and there is no official way to query it [2].

To cope, query the sos policy for the tmp-dir, and only fall back to
static /var/tmp if that fails.

[1] sosreport/sos#4062
[2] sosreport/sos#4074
martinpitt added a commit to cockpit-project/cockpit that referenced this pull request Jul 9, 2025
sos 4.6.2 changed the tmp dir policy [1] from a static /var/tmp to a
dynamic per-distro policy, which happens to be /tmp on Debian/Ubuntu
right now. This is wrong, and there is no official way to query it [2].

To cope, query the sos policy for the tmp-dir, and only fall back to
static /var/tmp if that fails.

[1] sosreport/sos#4062
[2] sosreport/sos#4074
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Kind/Bug Something is not working, and this fixes the issue Reviewed/Ready for Merge Has been reviewed, ready for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ubuntu/debian] sos report created sos into /var/tmp and not /tmp

3 participants