-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
strings: better validation #262
Conversation
mknos
commented
Sep 25, 2023
- Option -t expects a single letter, but this version accepted stupid things like -t bedding
- $offset_format is only used if $opt_t is set; default usage does not print offset
- Directory arguments were silently failing; now print an error message for them
* The argument of option -t is a single letter * This version accepted things like -t bedding * $offset_format is only used if $opt_t is set; default usage does not print offset * Directory arguments were silently failing; now print an error message for them
'o' => 1, | ||
'x' => 1, | ||
); | ||
die($usage) unless $EXPECT{$opt_t}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's warn and exit with the right value here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the die and we're good
@@ -76,6 +81,7 @@ $chunksize = 4096; # whatever | |||
|
|||
for my $filename ( @ARGV ) | |||
{ | |||
die("'$filename' is a directory\n") if (-d $filename); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
I'm going to merge this and fix up those |
I backtracked on the directories silently failing. The strings I have on FreeBSD silently ignore. If you have an example that doesn't, let me know. |