Fix fsck -C {fd} parsing
PATCH 1/1 Fix fsck -C {fd} parsing
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(-)
disk-utils/fsck.c +1 -1
@@ -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 {
Signature · 13 lines
2.3.3 -- Best Regards / S pozdravem, Stanislav Brabec software developer --------------------------------------------------------------------- SUSE LINUX, s. r. o. e-mail: [email protected] 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
Quoted 4 lines · Stanislav Brabec
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
Quoted 35 lines
--- disk-utils/fsck.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)disk-utils/fsck.c +1
-1@@ -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 {Signature · 17 lines
2.3.3 -- Best Regards / S pozdravem, Stanislav Brabec software developer --------------------------------------------------------------------- SUSE LINUX, s. r. o. e-mail: [email protected] 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Dne 24.3.2015 23:16:15 napsal Dave Reisner:
Quoted 8 lines · Stanislav Brabec
Quoted 4 lines
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.
Signature · 9 lines
Best Regards / S pozdravem, Stanislav Brabec software developer --------------------------------------------------------------------- SUSE LINUX, s. r. o. e-mail: [email protected] Lihovarská 1060/12 tel: +49 911 7405384547 190 00 Praha 9 fax: +420 284 084 001 Czech Republic http://www.suse.cz/
Quoted 5 lines · Dave Reisner
Quoted 4 lines · Stanislav Brabec
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).
Quoted 2 lines
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:
Quoted 3 lines
disk-utils/fsck.c static void parse_argv(int argc, char *argv[]) · line 1474
Quoted 3 lines
disk-utils/fsck.c +1
-1}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
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com