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

Please do not 'rm -rf <unquoted variable>. Also please do not 'rm -rf' without confirmation, use 'rm -r' instead! #8056

Closed
wants to merge 5 commits into from

Conversation

dagelf
Copy link
Contributor

@dagelf dagelf commented Sep 15, 2024

Background

I just did the "tutorial" and thankfully I implemented this change before I did, because I would've been MOST unhappy if this happened:

[coenraad@r2t2 AutoGPT]$ ./run agent create test
🎉 New agent 'test' created. The code for your new agent is in: agents/test
[coenraad@r2t2 AutoGPT]$ ./run agent start test
⌛ Running setup for agent 'test'...
Path /home/coenraad/AutoGPT/agents/benchmark for agbenchmark does not exist
Press ENTER to remove /home/coenraad/.venv
^C

$ /usr/bin/du $(poetry env info --path) --max-depth=0 -h|sort -h
14G	/home/coenraad/.venv

My connectivity isn't that great, and this environment, being my development environment, has packages accumulated over months. This is not my reproducible production machine, it's my personal dev machine... maybe I shouldn't try out new projects outside of a sandbox.... but a lot of people do, and this can really bite them.

Changes 🏗️

Quoted the "$ENV_PATH". Also made sure the script fails, if the rm command fails.
Also added a double confirmation.
Also added a way to skip the confirmation: touch delete. We can add that to the docs or any CI, if confirmed safe.

This also closes #7404

PR Quality Scorecard ✨

  • Have you used the PR description template?   +2 pts
  • Is your pull request atomic, focusing on a single change?   +5 pts
  • Have you linked the GitHub issue(s) that this PR addresses?   +5 pts
  • Have you documented your changes clearly and comprehensively?   +5 pts
  • Have you changed or added a feature?   -4 pts
    • Have you added/updated corresponding documentation?   +4 pts
    • Have you added/updated corresponding integration tests?   +5 pts
  • Have you changed the behavior of AutoGPT?   -5 pts
    • Have you also run agbenchmark to verify that these changes do not regress performance?   +10 pts

I would be most unhappy if this was removed on my dev machine:

$ /usr/bin/du $(poetry env info --path) --max-depth=0 -h|sort -h
14G	/home/user/.venv
I would be MOST unhappy if this happened on my dev machine;

$ /usr/bin/du $(poetry env info --path) --max-depth=0 -h|sort -h
14G	/home/user/.venv
I would be most unhappy if this was deleted on my dev machine:

$ /usr/bin/du $(poetry env info --path) --max-depth=0 -h|sort -h
14G	/home/user/.venv

Also, not quoting a variable fed to "rm -rf" can lead to catastrophy.
Copy link

PR Reviewer Guide 🔍

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Key issues to review

Potential Data Loss
The script now includes a way to skip confirmation by creating a 'delete' file. This could lead to accidental data loss if the file is created unintentionally.

Copy link

netlify bot commented Sep 15, 2024

Deploy Preview for auto-gpt-docs canceled.

Name Link
🔨 Latest commit 536161f
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/66e693cbf48f9d0008195206

Copy link

codecov bot commented Sep 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (dev@c1f301a). Learn more about missing BASE report.

Additional details and impacted files
@@          Coverage Diff           @@
##             dev    #8056   +/-   ##
======================================
  Coverage       ?   57.86%           
======================================
  Files          ?      106           
  Lines          ?     5765           
  Branches       ?      720           
======================================
  Hits           ?     3336           
  Misses         ?     2316           
  Partials       ?      113           
Flag Coverage Δ
Linux 57.86% <ø> (?)
forge 57.86% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dagelf
Copy link
Contributor Author

dagelf commented Sep 15, 2024

The failing CI test looks like it's unrelated to the change.

Swiftyos
Swiftyos previously approved these changes Sep 16, 2024
Copy link
Contributor

@Swiftyos Swiftyos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dagelf I'm glad you caught this before you deleted all your packages!

This bit of code is pretty unused now and the tutorials are well out of date. The forge will be removed soon too.

That said, and to avoid us wiping others env without their knowledge, this is a good idea. Thank you 🙏

@Swiftyos
Copy link
Contributor

@kcze Can you check the situation with the forge ci please.

cc: @Pwuts

@dagelf
Copy link
Contributor Author

dagelf commented Sep 16, 2024

It there's a CI issue, just touch 'delete' in the directory this is called from to skip the prompts. @kcze cc: @Pwuts

@kcze
Copy link
Contributor

kcze commented Sep 17, 2024

Forge CI fail seems unrelated

It there's a CI issue, just touch 'delete' in the directory this is called from to skip the prompts.

I don't understand, CI issue is unrelated to the functionality this PR introduces

@github-actions github-actions bot added the conflicts Automatically applied to PRs with merge conflicts label Sep 20, 2024
Copy link
Contributor

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

@aarushik93 aarushik93 changed the base branch from master to dev October 14, 2024 15:29
@aarushik93 aarushik93 dismissed Swiftyos’s stale review October 14, 2024 15:29

The base branch was changed.

@aarushik93 aarushik93 requested a review from a team as a code owner October 14, 2024 15:29
@aarushik93 aarushik93 requested review from Bentlybro and kcze and removed request for a team October 14, 2024 15:29
@ntindle
Copy link
Member

ntindle commented Oct 22, 2024

I don't have permission to make branches on your fork, and I'm not comfortable updating your master branch to be in line with ours, so I'm going to close this for now, as it's difficult for me to fix any issues that occur. Feel free to update from the master branch then sync branches, and reopen

@dagelf
Copy link
Contributor Author

dagelf commented Oct 23, 2024

Updated #8417

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conflicts Automatically applied to PRs with merge conflicts Forge Review effort [1-5]: 2 size/s
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

agent setup rm -rf <venv> ... should warn beforehand.
4 participants