[5/9] e2fscrub: add the -n option which shows what commands e2scrub would execute
diff mbox series

Message ID 20190321020218.5154-5-tytso@mit.edu
State Accepted
Headers show
Series
  • [1/9] e2scrub: check to make sure lvm2 is installed
Related show

Commit Message

Theodore Y. Ts'o March 21, 2019, 2:02 a.m. UTC
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 scrub/e2scrub.8.in | 5 +++++
 scrub/e2scrub.in   | 6 ++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

Comments

Darrick J. Wong March 21, 2019, 3:59 a.m. UTC | #1
On Wed, Mar 20, 2019 at 10:02:14PM -0400, Theodore Ts'o wrote:
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  scrub/e2scrub.8.in | 5 +++++
>  scrub/e2scrub.in   | 6 ++++--
>  2 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/scrub/e2scrub.8.in b/scrub/e2scrub.8.in
> index ff03523e3..7342876a3 100644
> --- a/scrub/e2scrub.8.in
> +++ b/scrub/e2scrub.8.in
> @@ -38,6 +38,11 @@ If the filesystem is not repaired,
>  will be run before the next mount.
>  .SH OPTIONS
>  .TP
> +\fB-n\fR
> +Print what commands
> +.B e2scrub
> +would execute (but don't actually execute them).
> +.TP
>  \fB-r\fR
>  Remove the e2scrub snapshot and exit without checking anything.
>  .TP
> diff --git a/scrub/e2scrub.in b/scrub/e2scrub.in
> index 51a909373..301574968 100644
> --- a/scrub/e2scrub.in
> +++ b/scrub/e2scrub.in
> @@ -37,6 +37,7 @@ print_help() {
>  	echo "Usage: $0 [OPTIONS] mountpoint | device"
>  	echo
>  	echo "mountpoint must be on a LVM-managed block device"
> +	echo "-n: Show what commands e2scrub would execute."
>  	echo "-r: Remove e2scrub snapshot and exit, do not check anything."
>  	echo "-t: Run fstrim if successful."
>  	echo "-V: Print version information and exit."
> @@ -68,8 +69,9 @@ exitcode() {
>  	exit "${ret}"
>  }
>  
> -while getopts "rtV" opt; do
> -	case "${opt}" in
> +while getopts "nrtV" opt; do
> +    case "${opt}" in
> +	"n") DBG="echo Would execute: " ;;
>  	"r") reap=1;;
>  	"t") fstrim=1;;
>  	"V") print_version; exitcode 0;;
> -- 
> 2.19.1
>
Lukas Czerner March 21, 2019, 10:57 a.m. UTC | #2
On Wed, Mar 20, 2019 at 10:02:14PM -0400, Theodore Ts'o wrote:
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> ---
>  scrub/e2scrub.8.in | 5 +++++
>  scrub/e2scrub.in   | 6 ++++--
>  2 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/scrub/e2scrub.8.in b/scrub/e2scrub.8.in
> index ff03523e3..7342876a3 100644
> --- a/scrub/e2scrub.8.in
> +++ b/scrub/e2scrub.8.in
> @@ -38,6 +38,11 @@ If the filesystem is not repaired,
>  will be run before the next mount.
>  .SH OPTIONS
>  .TP
> +\fB-n\fR
> +Print what commands
> +.B e2scrub
> +would execute (but don't actually execute them).

We should be a bit more clear that it's not all the commands that will
be printed but not executed. Some of commands, like lsblk and lvs will
actually be executed so it's not like you can run this without proper
privledges.

It sounds nit-picky, and obvious to us, but I am sure someone will
complaing about this.

-Lukas

> +.TP
>  \fB-r\fR
>  Remove the e2scrub snapshot and exit without checking anything.
>  .TP
> diff --git a/scrub/e2scrub.in b/scrub/e2scrub.in
> index 51a909373..301574968 100644
> --- a/scrub/e2scrub.in
> +++ b/scrub/e2scrub.in
> @@ -37,6 +37,7 @@ print_help() {
>  	echo "Usage: $0 [OPTIONS] mountpoint | device"
>  	echo
>  	echo "mountpoint must be on a LVM-managed block device"
> +	echo "-n: Show what commands e2scrub would execute."
>  	echo "-r: Remove e2scrub snapshot and exit, do not check anything."
>  	echo "-t: Run fstrim if successful."
>  	echo "-V: Print version information and exit."
> @@ -68,8 +69,9 @@ exitcode() {
>  	exit "${ret}"
>  }
>  
> -while getopts "rtV" opt; do
> -	case "${opt}" in
> +while getopts "nrtV" opt; do
> +    case "${opt}" in
> +	"n") DBG="echo Would execute: " ;;
>  	"r") reap=1;;
>  	"t") fstrim=1;;
>  	"V") print_version; exitcode 0;;
> -- 
> 2.19.1
>
Theodore Y. Ts'o March 21, 2019, 2:32 p.m. UTC | #3
On Thu, Mar 21, 2019 at 11:57:51AM +0100, Lukas Czerner wrote:
> On Wed, Mar 20, 2019 at 10:02:14PM -0400, Theodore Ts'o wrote:
> > Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> > ---
> >  scrub/e2scrub.8.in | 5 +++++
> >  scrub/e2scrub.in   | 6 ++++--
> >  2 files changed, 9 insertions(+), 2 deletions(-)
> > 
> > diff --git a/scrub/e2scrub.8.in b/scrub/e2scrub.8.in
> > index ff03523e3..7342876a3 100644
> > --- a/scrub/e2scrub.8.in
> > +++ b/scrub/e2scrub.8.in
> > @@ -38,6 +38,11 @@ If the filesystem is not repaired,
> >  will be run before the next mount.
> >  .SH OPTIONS
> >  .TP
> > +\fB-n\fR
> > +Print what commands
> > +.B e2scrub
> > +would execute (but don't actually execute them).
> 
> We should be a bit more clear that it's not all the commands that will
> be printed but not executed. Some of commands, like lsblk and lvs will
> actually be executed so it's not like you can run this without proper
> privledges.
> 
> It sounds nit-picky, and obvious to us, but I am sure someone will
> complaing about this.

Good point, I'll fix this.

					- Ted

Patch
diff mbox series

diff --git a/scrub/e2scrub.8.in b/scrub/e2scrub.8.in
index ff03523e3..7342876a3 100644
--- a/scrub/e2scrub.8.in
+++ b/scrub/e2scrub.8.in
@@ -38,6 +38,11 @@  If the filesystem is not repaired,
 will be run before the next mount.
 .SH OPTIONS
 .TP
+\fB-n\fR
+Print what commands
+.B e2scrub
+would execute (but don't actually execute them).
+.TP
 \fB-r\fR
 Remove the e2scrub snapshot and exit without checking anything.
 .TP
diff --git a/scrub/e2scrub.in b/scrub/e2scrub.in
index 51a909373..301574968 100644
--- a/scrub/e2scrub.in
+++ b/scrub/e2scrub.in
@@ -37,6 +37,7 @@  print_help() {
 	echo "Usage: $0 [OPTIONS] mountpoint | device"
 	echo
 	echo "mountpoint must be on a LVM-managed block device"
+	echo "-n: Show what commands e2scrub would execute."
 	echo "-r: Remove e2scrub snapshot and exit, do not check anything."
 	echo "-t: Run fstrim if successful."
 	echo "-V: Print version information and exit."
@@ -68,8 +69,9 @@  exitcode() {
 	exit "${ret}"
 }
 
-while getopts "rtV" opt; do
-	case "${opt}" in
+while getopts "nrtV" opt; do
+    case "${opt}" in
+	"n") DBG="echo Would execute: " ;;
 	"r") reap=1;;
 	"t") fstrim=1;;
 	"V") print_version; exitcode 0;;