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

Exclude common core dump file names by default #8

Merged
merged 1 commit into from
Feb 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ const defaultRules = [
'*.orig',
'package-lock.json',
'archived-packages/**',
'core',
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm worried about this one being a bit too general. Are core dumps seriously just called core? 😱

Copy link
Contributor Author

@addaleax addaleax Feb 25, 2018

Choose a reason for hiding this comment

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

@zkat That’s the default at least for Linux (although it’s configurable), and Wikipedia agrees by calling it the “traditional” naming of core dumps.

It’s also practical – some people configure their core dump names to have the PID or something like that in them, but that isn’t a sensible default because it can mean your disk filling up with core dumps. Just overwriting a file named core every time makes quite a bit of sense…

Copy link
Contributor

Choose a reason for hiding this comment

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

On OS X and other BSD-family Unixes, it's common for core dumps to be in /var/cores or /cores, with a name of core.${pid}. But in those cases, they're not in cwd, so it's less of an issue for this case.

I'm personally fine with ignoring core by default, as long as it can be explicitly included by a later rule, but it'd be good to see how often this happens empirically by looking at the registry, and how many files named core are not actually core dumps.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, actually, I think some versions of SmartOS drop the core file as core.${pid} in cwd? Might be worth also adding core.+([0-9]) as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@isaacs yup, done! 👍

Copy link
Contributor

@larsgw larsgw Feb 16, 2019

Choose a reason for hiding this comment

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

Some people do encounter problems with this. Is there any way to make sure directories named core don't get removed? Something like !core/ + !**/core/ should work (the latter because just core/ doesn't work in subdirectories), but maybe there's a better way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@larsgw Yeah, that makes sense and I don’t see a better way off the top of my head either. Do you want to open a PR for that?

Copy link
Contributor

Choose a reason for hiding this comment

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

Here you go #25

Choose a reason for hiding this comment

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

I have a "common" utils repo required through git in almost all my microservices, (basically, types and some classes to ease the communication between them). Suddenly, all my classes and types from the "core" service disappeared in my services.

I think this behaviour should be undone as it breaks functional code, and is included in a minor update.

'*.core',
'*.vgcore',
'vgcore.*',
'core.+([0-9])',
]

// a decorator that applies our custom rules to an ignore walker
Expand Down