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
936a9446
Commit
936a9446
authored
8 years ago
by
Yorhel
Browse files
Options
Downloads
Patches
Plain Diff
Add -rr option to disable shell spawning
Fixes
https://dev.yorhel.nl/ncdu/bug/94
parent
e4f211db
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
doc/ncdu.pod
+12
-2
12 additions, 2 deletions
doc/ncdu.pod
src/browser.c
+6
-4
6 additions, 4 deletions
src/browser.c
src/global.h
+1
-1
1 addition, 1 deletion
src/global.h
src/main.c
+1
-1
1 addition, 1 deletion
src/main.c
with
20 additions
and
8 deletions
doc/ncdu.pod
+
12
−
2
View file @
936a9446
...
@@ -35,8 +35,8 @@ I<FILE> is equivalent to C<->, the file is read from standard input.
...
@@ -35,8 +35,8 @@ I<FILE> is equivalent to C<->, the file is read from standard input.
For the sake of preventing a screw-up, the current version of ncdu will assume
For the sake of preventing a screw-up, the current version of ncdu will assume
that the directory information in the imported file does not represent the
that the directory information in the imported file does not represent the
filesystem on which the file is being imported. That is, the refresh
and
file
filesystem on which the file is being imported. That is, the refresh
,
file
deletion options in the browser will be disabled.
deletion
and shell spawning
options in the browser will be disabled.
=item I<dir>
=item I<dir>
...
@@ -97,6 +97,16 @@ option has no effect when C<-o> is used, because there will not be a browser
...
@@ -97,6 +97,16 @@ option has no effect when C<-o> is used, because there will not be a browser
interface in that case. It has no effect when C<-f> is used, either, because
interface in that case. It has no effect when C<-f> is used, either, because
the deletion feature is disabled in that case anyway.
the deletion feature is disabled in that case anyway.
WARNING: This option will only prevent deletion through the file browser. It is
still possible to spawn a shell from ncdu and delete or modify files from
there. To disable that feature as well, pass the C<-r> option twice (see
C<-rr>).
=item -rr
In addition to C<-r>, this will also disable the shell spawning feature of the
file browser.
=item --si
=item --si
List sizes using base 10 prefixes, that is, powers of 1000 (KB, MB, etc), as
List sizes using base 10 prefixes, that is, powers of 1000 (KB, MB, etc), as
...
...
This diff is collapsed.
Click to expand it.
src/browser.c
+
6
−
4
View file @
936a9446
...
@@ -417,8 +417,8 @@ int browse_key(int ch) {
...
@@ -417,8 +417,8 @@ int browse_key(int ch) {
info_show
=
0
;
info_show
=
0
;
break
;
break
;
case
'd'
:
case
'd'
:
if
(
read_only
||
dir_import_active
)
{
if
(
read_only
>=
1
||
dir_import_active
)
{
message
=
read_only
message
=
read_only
>=
1
?
"File deletion disabled in read-only mode."
?
"File deletion disabled in read-only mode."
:
"File deletion not available for imported directories."
;
:
"File deletion not available for imported directories."
;
break
;
break
;
...
@@ -432,8 +432,10 @@ int browse_key(int ch) {
...
@@ -432,8 +432,10 @@ int browse_key(int ch) {
delete_init
(
sel
,
t
);
delete_init
(
sel
,
t
);
break
;
break
;
case
'b'
:
case
'b'
:
if
(
dir_import_active
)
{
if
(
read_only
>=
2
||
dir_import_active
)
{
message
=
"Shell feature not available for imported directories."
;
message
=
read_only
>=
2
?
"Shell feature disabled in read-only mode."
:
"Shell feature not available for imported directories."
;
break
;
break
;
}
}
shell_init
();
shell_init
();
...
...
This diff is collapsed.
Click to expand it.
src/global.h
+
1
−
1
View file @
936a9446
...
@@ -84,7 +84,7 @@ struct dir {
...
@@ -84,7 +84,7 @@ struct dir {
/* program state */
/* program state */
extern
int
pstate
;
extern
int
pstate
;
/* read-only flag */
/* read-only flag
, 1+ = disable deletion, 2+ = also disable shell
*/
extern
int
read_only
;
extern
int
read_only
;
/* minimum screen update interval when calculating, in ms */
/* minimum screen update interval when calculating, in ms */
extern
long
update_delay
;
extern
long
update_delay
;
...
...
This diff is collapsed.
Click to expand it.
src/main.c
+
1
−
1
View file @
936a9446
...
@@ -162,7 +162,7 @@ static void argv_parse(int argc, char **argv) {
...
@@ -162,7 +162,7 @@ static void argv_parse(int argc, char **argv) {
printf
(
"ncdu %s
\n
"
,
PACKAGE_VERSION
);
printf
(
"ncdu %s
\n
"
,
PACKAGE_VERSION
);
exit
(
0
);
exit
(
0
);
case
'x'
:
dir_scan_smfs
=
1
;
break
;
case
'x'
:
dir_scan_smfs
=
1
;
break
;
case
'r'
:
read_only
=
1
;
break
;
case
'r'
:
read_only
++
;
break
;
case
's'
:
si
=
1
;
break
;
case
's'
:
si
=
1
;
break
;
case
'o'
:
export
=
val
;
break
;
case
'o'
:
export
=
val
;
break
;
case
'f'
:
import
=
val
;
break
;
case
'f'
:
import
=
val
;
break
;
...
...
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