diff --git a/pgrep.c b/pgrep.c index c9bc36e8..6708f87a 100644 --- a/pgrep.c +++ b/pgrep.c @@ -888,7 +888,7 @@ static void parse_opts (int argc, char **argv) if (argc - optind == 1) { opt_pattern = argv[optind]; - if ((!opt_full) && (strlen(opt_pattern) > 16)) + if ((!opt_full) && (strlen(opt_pattern) > 15)) xwarnx(_("pattern that contains program name longer than 15 characters will result in zero matches\n" "Try `%s -f' option for thorough search."), program_invocation_short_name); diff --git a/testsuite/pgrep.test/pgrep.exp b/testsuite/pgrep.test/pgrep.exp index ef267835..493d1a55 100644 --- a/testsuite/pgrep.test/pgrep.exp +++ b/testsuite/pgrep.test/pgrep.exp @@ -118,6 +118,9 @@ set test "pgrep does not match substring with exact" spawn $pgrep -x $testproc_trim expect_blank $test +set test "pgrep with long match gives warning" +spawn $pgrep gnome-session-bi +expect_pass "$test" "pattern that contains program name longer than 15 characters will result in zero matches" # Cleanup kill_testproc