Skip to content
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

Merged
merged 2 commits into from
Sep 25, 2023
Merged

strings: better validation #262

merged 2 commits into from
Sep 25, 2023

Conversation

mknos
Copy link
Contributor

@mknos 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
@briandfoy briandfoy self-assigned this Sep 25, 2023
@briandfoy briandfoy added Type: enhancement improve a feature that already exists Priority: low get to this whenever Program: strings The strings program labels Sep 25, 2023
'o' => 1,
'x' => 1,
);
die($usage) unless $EXPECT{$opt_t};
Copy link
Owner

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

Copy link
Owner

@briandfoy briandfoy left a 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);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@briandfoy briandfoy added the Status: changes requested adjust the pull request as noted in comments label Sep 25, 2023
@briandfoy
Copy link
Owner

I'm going to merge this and fix up those die. No big whoop.

@briandfoy briandfoy merged commit d12232b into briandfoy:master Sep 25, 2023
1 check passed
@briandfoy
Copy link
Owner

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.

@briandfoy briandfoy added Status: accepted The fix is accepted Status: released there is a new release with this fix and removed Priority: low get to this whenever Status: changes requested adjust the pull request as noted in comments Status: accepted The fix is accepted labels Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Program: strings The strings program Status: released there is a new release with this fix Type: enhancement improve a feature that already exists
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants