Skip to content
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

[report] check for symlink before rmtree when opt estimate-only is use #2728

Merged
merged 1 commit into from Oct 19, 2021
Merged

Conversation

slashdd
Copy link

@slashdd slashdd commented Oct 19, 2021

Check if the dir is also symlink before performing using rmtree()
method, it not, then unlink() should be used.

Call Trace:
Finished running plugins Traceback (most recent call last):
File "./bin/sos", line 22, in
sos.execute()
File "/tmp/sos/sos/init.py", line 186, in execute
self._component.execute()
OSError: Cannot call rmtree on a symbolic link

/usr/lib/python3.8/shutil.py(726)rmtree()
-> raise OSError("Cannot call rmtree on a symbolic link")

Closes: #2727

Signed-off-by: Eric Desrochers eric.desrochers@canonical.com


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?

@packit-as-a-service
Copy link

Congratulations! One of the builds has completed. 🍾

⚠️ Please note that our current plans include removal of these comments in the near future (at least 2 weeks after including this disclaimer), if you have serious concerns regarding their removal or would like to continue receiving them please reach out to us. ⚠️

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-2728
  • And now you can install the packages.

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

@slashdd
Copy link
Author

slashdd commented Oct 19, 2021

With the PR, no more complaints about rmtree() method on symlink.

sudo python3 ./bin/sos report -o systemd --estimate-only

sosreport (version 4.2)

WARNING: unable to set option for disabled or non-existing plugin (networking).

This command will collect system configuration and diagnostic
information from this Ubuntu system.

For more information on Canonical visit:

        Community Website  : https://www.ubuntu.com/
        Commercial Support : https://www.canonical.com

The generated archive may contain data considered sensitive and its
content should be reviewed by the originating organization before being
passed to any third party.

No changes will be made to system configuration.



Estimate-only mode enabled, which overrides some options:
  --threads=4 overriden to 1
  --build enabled
  --no-postproc enabled

Press ENTER to continue, or CTRL-C to quit.

Optionally, please enter the case id that you are generating this report for []: 

 Setting up archive ...
 Setting up plugins ...
 Running plugins. Please wait ...

  Starting 1/1   systemd         [Running: systemd]                                       
  Finished running plugins                                                               
Skipping postprocessing of collected data

Your sosreport build tree has been generated in:
	/tmp/sosreport-nuc7-2021-10-19-cwcosbe


Estimated disk space requirement for whole uncompressed sos report directory: 4.41MiB
Three biggest plugins:  systemd: 4MiB,  sos_logs_reports: 540KiB

Please note the estimation is relevant to the current options.
Be aware that the real disk space requirements might be different.

Check if the dir is also symlink before performing rmtree()
method so that unlink() method can be used instead.

Traceback (most recent call last):
  File "./bin/sos", line 22, in <module>
    sos.execute()
  File "/tmp/sos/sos/__init__.py", line 186, in execute
    self._component.execute()
OSError: Cannot call rmtree on a symbolic link

Closes: #2727

Signed-off-by: Eric Desrochers <eric.desrochers@canonical.com>
@TurboTurtle TurboTurtle merged commit 4293f33 into sosreport:main Oct 19, 2021
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.

[report] estimate struggles with plugins that capture symlinks
3 participants