* [PATCH] Fix fsck -C {fd} parsing
@ 2015-03-24 20:01 Stanislav Brabec
2015-03-24 22:16 ` Dave Reisner
0 siblings, 1 reply; 4+ messages in thread
From: Stanislav Brabec @ 2015-03-24 20:01 UTC (permalink / raw)
To: util-linux
Both fsck(8) and fsck --help documents progress bar redirection as
-C {fd}
This did not work, and only -C{fd} and "-C {fd}" worked.
---
disk-utils/fsck.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/disk-utils/fsck.c b/disk-utils/fsck.c
index 5842da4..817be97 100644
--- a/disk-utils/fsck.c
+++ b/disk-utils/fsck.c
@@ -1471,7 +1471,7 @@ static void parse_argv(int argc, char *argv[])
else
goto next_arg;
} else if (i+1 < argc && *argv[i+1] != '-') { /* -C <fd> */
- progress_fd = string_to_int(argv[i]);
+ progress_fd = string_to_int(argv[i+1]);
if (progress_fd < 0)
progress_fd = 0;
else {
--
2.3.3
--
Best Regards / S pozdravem,
Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o. e-mail: sbrabec@suse.cz
Lihovarská 1060/12 tel: +49 911 7405384547
190 00 Praha 9 fax: +420 284 084 001
Czech Republic http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] Fix fsck -C {fd} parsing
2015-03-24 20:01 [PATCH] Fix fsck -C {fd} parsing Stanislav Brabec
@ 2015-03-24 22:16 ` Dave Reisner
2015-03-25 1:10 ` Stanislav Brabec
2015-03-25 8:30 ` Karel Zak
0 siblings, 2 replies; 4+ messages in thread
From: Dave Reisner @ 2015-03-24 22:16 UTC (permalink / raw)
To: Stanislav Brabec; +Cc: util-linux
On Tue, Mar 24, 2015 at 09:01:10PM +0100, Stanislav Brabec wrote:
> Both fsck(8) and fsck --help documents progress bar redirection as
> -C {fd}
>
> This did not work, and only -C{fd} and "-C {fd}" worked.
Perhaps rather than break the existing behavior it might be better to
make the documentation match reality.
Cheers,
dR
> ---
> disk-utils/fsck.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/disk-utils/fsck.c b/disk-utils/fsck.c
> index 5842da4..817be97 100644
> --- a/disk-utils/fsck.c
> +++ b/disk-utils/fsck.c
> @@ -1471,7 +1471,7 @@ static void parse_argv(int argc, char *argv[])
> else
> goto next_arg;
> } else if (i+1 < argc && *argv[i+1] != '-') { /* -C <fd> */
> - progress_fd = string_to_int(argv[i]);
> + progress_fd = string_to_int(argv[i+1]);
> if (progress_fd < 0)
> progress_fd = 0;
> else {
> --
> 2.3.3
>
> --
> Best Regards / S pozdravem,
>
> Stanislav Brabec
> software developer
> ---------------------------------------------------------------------
> SUSE LINUX, s. r. o. e-mail: sbrabec@suse.cz
> Lihovarská 1060/12 tel: +49 911 7405384547
> 190 00 Praha 9 fax: +420 284 084 001
> Czech Republic http://www.suse.cz/
> PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76
> --
> To unsubscribe from this list: send the line "unsubscribe util-linux" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Fix fsck -C {fd} parsing
2015-03-24 22:16 ` Dave Reisner
@ 2015-03-25 1:10 ` Stanislav Brabec
2015-03-25 8:30 ` Karel Zak
1 sibling, 0 replies; 4+ messages in thread
From: Stanislav Brabec @ 2015-03-25 1:10 UTC (permalink / raw)
To: Dave Reisner; +Cc: util-linux
Dne 24.3.2015 23:16:15 napsal Dave Reisner:
> On Tue, Mar 24, 2015 at 09:01:10PM +0100, Stanislav Brabec wrote:
> > Both fsck(8) and fsck --help documents progress bar redirection as
> > -C {fd}
> >
> > This did not work, and only -C{fd} and "-C {fd}" worked.
>
> Perhaps rather than break the existing behavior it might be better to
> make the documentation match reality.
It does not break the existing behavior. It just fixes the documented
behavior.
The existing parser was apparently broken: When parsing e. g. -C 3, it
detected the -C standing alone, and then attempts to interpret "-C" as
number instead of parsing of next argument. It fails, so the next
argument is interpreted as stand-alone argument.
--
Best Regards / S pozdravem,
Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o. e-mail: sbrabec@suse.cz
Lihovarská 1060/12 tel: +49 911 7405384547
190 00 Praha 9 fax: +420 284 084 001
Czech Republic http://www.suse.cz/
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Fix fsck -C {fd} parsing
2015-03-24 22:16 ` Dave Reisner
2015-03-25 1:10 ` Stanislav Brabec
@ 2015-03-25 8:30 ` Karel Zak
1 sibling, 0 replies; 4+ messages in thread
From: Karel Zak @ 2015-03-25 8:30 UTC (permalink / raw)
To: Stanislav Brabec, util-linux
On Tue, Mar 24, 2015 at 06:16:15PM -0400, Dave Reisner wrote:
> On Tue, Mar 24, 2015 at 09:01:10PM +0100, Stanislav Brabec wrote:
> > Both fsck(8) and fsck --help documents progress bar redirection as
> > -C {fd}
> >
> > This did not work, and only -C{fd} and "-C {fd}" worked.
Applied, thanks (please, Signed-off-by: next time).
> Perhaps rather than break the existing behavior it might be better to
> make the documentation match reality.
Stanislav is right, it's pretty obvious from code:
> > } else if (i+1 < argc && *argv[i+1] != '-') { /* -C <fd> */
> > - progress_fd = string_to_int(argv[i]);
> > + progress_fd = string_to_int(argv[i+1]);
the "if()" checks for the next item in argv[], but string_to_int()
has been used with argv[i].
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-03-25 8:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-24 20:01 [PATCH] Fix fsck -C {fd} parsing Stanislav Brabec
2015-03-24 22:16 ` Dave Reisner
2015-03-25 1:10 ` Stanislav Brabec
2015-03-25 8:30 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox