-
Notifications
You must be signed in to change notification settings - Fork 181
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
Delete the contents of the /tmp directory #76
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I've dropped in a few comments.
bin/rename-project
Outdated
The contents of the /tmp directory need to be deleted because they contain | ||
references to the old project name and can cause errors if they're not removed. | ||
|
||
Some of the files to be deleted are owned by users that only exist in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This project will run your container as a non-root user, files that land in tmp/
will be owned by the user of the process. We shouldn't need to ever use sudo
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I only added sudo
because without it I got error messages about needing sudo
.
I'll give it a shot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you show the output of ls -la tmp/
when it produced an error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I don't see any error! ¯\(ツ)/¯
I didn't preserve that session, so OOL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if you ran any Docker commands with sudo
. That would have an effect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I don't use sudo
unless forced. 🙂
bin/rename-project
Outdated
# the `.keep` file. | ||
# ----------------------------------------------------------------------------- | ||
function delete_tmp { | ||
sudo rm -rf ./tmp/* && touch ./tmp/.keep |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going back to message in discussion #75, can you address this?
I'd suggest recursively deleting all of the contents in the tmp directory except for the .keep file since tmp/.keep is committed to version control. This will leave the original modified times on the directory and keep file too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The touch
ed tmp/.keep
does have a different modified time, but it doesn't show up as a modified file in git
.
Do you think the modified time matters, since the modified time of the rest of the files are either the time when the repo was cloned, or the time when the rename script was run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if we leave the tmp/
directory in tact with the original modified time of the file, it's worth doing the same for the keep file. Something like find tmp/ ! -name ".keep" -delete
should do the trick but I didn't test it. We would want to make sure the solution works with both the macOS and GNU version of find
.
bin/rename-project
Outdated
sudo rm -rf ./tmp/* && touch ./tmp/.keep | ||
} | ||
|
||
while true; do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can get by without needing a prompt for this.
bin/rename-project
Outdated
@@ -51,6 +51,38 @@ find . -type f -exec \ | |||
-pe "s/${FIND_MODULE_NAME}/${MODULE_NAME}/g;" {} + | |||
# ----------------------------------------------------------------------------- | |||
|
|||
cat << 'EOF' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all of this can go away and you can drop a 1 liner to delete the contents of the directory in this section of the script The core of the script which renames a few things.
and then adjust this comment to be something like The core of the script.
Given this rename script is likely used shortly after creating the project and temporary files are temporary, there's nothing of value to protect or warn against.
74be6ff
to
3dc988f
Compare
I just pushed changes that I think simplify things the way that you want, though I haven't changed to a |
3dc988f
to
d0bc06e
Compare
|
Do you have a source around needing to set mindepth for it to work on macOS? I don't have a Mac to test.
I think we can remove the comments all together and adjust it to: #76 (comment) Other than these 2 things, you can delete this text from the readme file too:
|
macOS didn't need
OK. I'll modify the PR to reflect this. |
Sounds good, we can keep it in. I made a test directory and filled it with |
d0bc06e
to
e21d804
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beyond the review comment, can you also update the changelog file?
You can add the following bullet under A whole bunch of changes related to Rails 7.1.0
which is under the unreleased changes:
- Update
rename-project
script to auto-delete temporary files
Then it's good to go for being merged.
I don't seem to have any problems with anything else in the tmp except the server.pid not getting cleaned up on a crash or computer restart. I added this function and haven't had issues now i use |
Cached files in the /tmp directory can cause errors after renaming the project--nuke them so they don't cause grief.
e21d804
to
4336f30
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks a lot for powering through this!
Cached files in the /tmp directory can cause errors after renaming the project--nuke them so they don't cause grief.