FHIR Chat · Truely dangerous script · committers

Stream: committers

Topic: Truely dangerous script


view this post on Zulip Harold Solbrig (Feb 19 2019 at 22:52):

Folks: A word of warning. I just ran clean.sh in the fhir base directory. If guides/ccda2/output doesn't exist this delightful little script ends up changing two directories up from the fhir directory, executing a batch delete then (as guides/ccda2/qa doesn't exist) goes three MORE directories up and tries again. One way or another it ends up executing a "find . -type f -delete" in your root directory. We're testing the limits of the Mac time machine at the moment, but my machine will never be the same...

view this post on Zulip Lloyd McKenzie (Feb 19 2019 at 23:14):

I thought we had fixed this. @Grahame Grieve @Josh Mandel ?

view this post on Zulip Harold Solbrig (Feb 19 2019 at 23:15):

Man, I sure wish you had...
... on a clean disk you can seek forever

view this post on Zulip Harold Solbrig (Feb 19 2019 at 23:16):

https://github.com/HL7/fhir/blob/master/clean.sh

view this post on Zulip Grahame Grieve (Feb 19 2019 at 23:37):

there was a complaint about it, and I thought someone was going to do it.. but don't remember who

view this post on Zulip Grahame Grieve (Feb 19 2019 at 23:46):

https://github.com/HL7/fhir/pull/452

view this post on Zulip Grahame Grieve (Feb 19 2019 at 23:46):

@Josh Mandel can you check my changes? I can't test if they work

view this post on Zulip Josh Mandel (Feb 20 2019 at 16:06):

So historically the todo was just to delete this script and use git clean.

view this post on Zulip Josh Mandel (Feb 20 2019 at 16:08):

The current version still has some troubling bits, like find -name *class -delete, so if it's run in the wrong place it'll delete any files with class at the end of the name, rather than .class. And overall, running it from the wrong place could delete files outside of the fhir repo checkout, which is not great.

view this post on Zulip Eric Haas (Feb 20 2019 at 17:02):

that script cleaned my mac as well and I set up time machine afterwards and made sure .gitignores did not ignore my python scripts after that . So I would suggest it be removed.

view this post on Zulip Harold Solbrig (Feb 20 2019 at 17:04):

I've learned a lot about what you can and can't do with time machine. I'm back and limping but dread the day I have to reboot. No way to be sure that I've restored everything I need until then

view this post on Zulip Eric Haas (Feb 20 2019 at 17:06):

I had most of my work on Github and work on a pc too so that was a savior.

view this post on Zulip Harold Solbrig (Feb 20 2019 at 17:07):

Yup, although time machine doesn't do hidden files without some cooercion. It was /usr that really hit me hard...

view this post on Zulip Harold Solbrig (Feb 20 2019 at 17:07):

I'm thinking that I may just start working inside docker containers (VM's). A whole lot safer

view this post on Zulip Grahame Grieve (Feb 20 2019 at 20:11):

I would not like to use git clean because this deletes only generated files, not all files. A very different thing.

view this post on Zulip Grahame Grieve (Feb 20 2019 at 20:14):

we should add a confirm step : This will delete all generated files in [dir]: Continue [y/N] but I don't know how to do that in bash. Does someone want to do that?

view this post on Zulip Elliot Silver (Feb 20 2019 at 20:34):

I think the "select" shell statement lets you do this.

view this post on Zulip Grahame Grieve (Feb 20 2019 at 20:38):

is that a 'I'll do it'?

view this post on Zulip John Moehrke (Feb 20 2019 at 20:55):

is that a 'I'll do it'?

I second the motion for @Elliot Silver to fix.. :-)

view this post on Zulip Elliot Silver (Feb 20 2019 at 20:57):

I think my first act as a committer should start somewhere other than a “truly dangerous script” — for your sake as much as mine.

view this post on Zulip Harold Solbrig (Feb 20 2019 at 20:58):

I'll volunteer to catch it. (Seeings as how I coined the term...)

view this post on Zulip Lloyd McKenzie (Feb 20 2019 at 21:01):

Can you just get rid of all navigation that changes directory up? Put the root folder in a variable and then express all paths as absolute paths based on that root? That would seem safer than a check that people might not look at properly

view this post on Zulip Harold Solbrig (Feb 20 2019 at 21:03):

Yup - although a confirm would be good anyway...

view this post on Zulip Grahame Grieve (Feb 20 2019 at 21:05):

I already made those kind of changes

view this post on Zulip Harold Solbrig (Feb 20 2019 at 21:13):

Saw that, which makes it easier. Want to add a double check and fix it to catch the ".bak" and ".class" files as well as the IG bits that made it go wacko in the first place.

view this post on Zulip Harold Solbrig (Feb 20 2019 at 21:14):

Tell you what, I'm going to test it in a VM however...

view this post on Zulip Grahame Grieve (Feb 20 2019 at 21:20):

well, I already removed the wacko bits. the remaining concern is that you aren't running it in the right folder

view this post on Zulip Harold Solbrig (Feb 20 2019 at 21:21):

What of the ccda2/qa and temp directories. That said, happy to let it be...

view this post on Zulip Grahame Grieve (Feb 20 2019 at 21:21):

I removed those references. make sure you have the latest copty

view this post on Zulip Harold Solbrig (Feb 20 2019 at 21:28):

Should they be removed?

view this post on Zulip Grahame Grieve (Feb 20 2019 at 21:39):

yes they are not used anymore

view this post on Zulip Grahame Grieve (Feb 20 2019 at 21:39):

I mean, those directories do not exist anymore

view this post on Zulip Harold Solbrig (Feb 20 2019 at 21:41):

Gotcha. IMO we're in good enough shape and have other things to do -- I'll catch the '.' on bak and class and call it good

view this post on Zulip Grahame Grieve (Feb 20 2019 at 21:41):

k

view this post on Zulip Harold Solbrig (Feb 20 2019 at 21:42):

If those directories had existed, I'd still have my computer...

view this post on Zulip Harold Solbrig (Feb 20 2019 at 21:59):

Done

view this post on Zulip Eric Haas (Feb 21 2019 at 18:07):

This experience was a teaching moment for me. Never run a bash script I didn't write or test. Never run anything called 'clean' :-)


Last updated: Apr 12 2022 at 19:14 UTC