Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nccf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
702
Provoz
nccf
Commits
a389443c
Commit
a389443c
authored
4 years ago
by
Yorhel
Browse files
Options
Downloads
Patches
Plain Diff
Add --exclude-firmlinks and follow firmlinks by default
What a mess.
https://code.blicky.net/yorhel/ncdu/issues/153#issuecomment-764
parent
c340980b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/ncdu.pod
+7
-5
7 additions, 5 deletions
doc/ncdu.pod
src/main.c
+13
-5
13 additions, 5 deletions
src/main.c
with
20 additions
and
10 deletions
doc/ncdu.pod
+
7
−
5
View file @
a389443c
...
...
@@ -179,12 +179,9 @@ this option will not follow symlinks to directories and will count each
symlinked file as a unique file (i.e. unlike how hard links are handled). This
is subject to change in later versions.
=item --
follow
-firmlinks
=item --
exclude
-firmlinks
(MacOS only) follow firmlinks. WARNING: This may cause directories to be
scanned and counted multiple times. Firmlink cycles are current (1.15) not
detected, so it may also cause ncdu to get stuck in an infinite loop and
eventually run out of memory.
(MacOS only) Exclude firmlinks.
=item --exclude-kernfs
...
...
@@ -429,6 +426,11 @@ Item counts are stored in a signed 32-bit integer without overflow detection.
If you have a directory with more than 2 billion files, quite literally
anything can happen.
On macOS 10.15 and later, running ncdu on the root directory without
`--exclude-firmlinks` may cause directories to be scanned and counted multiple
times. Firmlink cycles are currently (1.15.1) not detected, so it may also
cause ncdu to get stuck in an infinite loop and eventually run out of memory.
Please report any other bugs you may find at the bug tracker, which can be
found on the web site at https://dev.yorhel.nl/ncdu
...
...
This diff is collapsed.
Click to expand it.
src/main.c
+
13
−
5
View file @
a389443c
...
...
@@ -42,7 +42,7 @@ long update_delay = 100;
int
cachedir_tags
=
0
;
int
extended_info
=
0
;
int
follow_symlinks
=
0
;
int
follow_firmlinks
=
0
;
int
follow_firmlinks
=
1
;
int
confirm_quit
=
0
;
static
int
min_rows
=
17
,
min_cols
=
60
;
...
...
@@ -139,7 +139,8 @@ static void argv_parse(int argc, char **argv) {
{
'L'
,
0
,
"-L,--follow-symlinks"
},
{
'C'
,
0
,
"--exclude-caches"
},
{
2
,
0
,
"--exclude-kernfs"
},
{
3
,
0
,
"--follow-firmlinks"
},
{
3
,
0
,
"--follow-firmlinks"
},
/* undocumented, this behavior is the current default */
{
4
,
0
,
"--exclude-firmlinks"
},
{
's'
,
0
,
"--si"
},
{
'Q'
,
0
,
"--confirm-quit"
},
{
'c'
,
1
,
"--color"
},
...
...
@@ -173,7 +174,7 @@ static void argv_parse(int argc, char **argv) {
printf
(
" --exclude-kernfs Exclude Linux pseudo filesystems (procfs,sysfs,cgroup,...)
\n
"
);
#endif
#if HAVE_SYS_ATTR_H && HAVE_GETATTRLIST && HAVE_DECL_ATTR_CMNEXT_NOFIRMLINKPATH
printf
(
" --
follow
-firmlinks
Follow
firmlinks on macOS
\n
"
);
printf
(
" --
exclude
-firmlinks
Exclude
firmlinks on macOS
\n
"
);
#endif
printf
(
" --confirm-quit Confirm quitting ncdu
\n
"
);
printf
(
" --color SCHEME Set color scheme (off/dark)
\n
"
);
...
...
@@ -204,19 +205,26 @@ static void argv_parse(int argc, char **argv) {
cachedir_tags
=
1
;
break
;
case
2
:
case
2
:
/* --exclude-kernfs */
#if HAVE_LINUX_MAGIC_H && HAVE_SYS_STATFS_H && HAVE_STATFS
exclude_kernfs
=
1
;
break
;
#else
fprintf
(
stderr
,
"This feature is not supported on your platform
\n
"
);
exit
(
1
);
#endif
case
3
:
case
3
:
/* --follow-firmlinks */
#if HAVE_SYS_ATTR_H && HAVE_GETATTRLIST && HAVE_DECL_ATTR_CMNEXT_NOFIRMLINKPATH
follow_firmlinks
=
1
;
break
;
#else
fprintf
(
stderr
,
"This feature is not supported on your platform
\n
"
);
exit
(
1
);
#endif
case
4
:
/* --exclude-firmlinks */
#if HAVE_SYS_ATTR_H && HAVE_GETATTRLIST && HAVE_DECL_ATTR_CMNEXT_NOFIRMLINKPATH
follow_firmlinks
=
0
;
break
;
#else
fprintf
(
stderr
,
"This feature is not supported on your platform
\n
"
);
exit
(
1
);
#endif
case
'c'
:
if
(
strcmp
(
val
,
"off"
)
==
0
)
{
uic_theme
=
0
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment