From 5156456c794f18f24521dfcd6248871057e6f832 Mon Sep 17 00:00:00 2001 From: "David A. Wheeler" Date: Sun, 3 Aug 2014 15:29:05 -0400 Subject: [PATCH] flawfinder: Improve error-handling. Warn of non-existent files (esp long dash) - Provide a separate warning for filenames listed on the command line but do not actually exist. - Provide a SPECIAL warning for filenames that begin with the UTF-8 sequence of long dashes. Users might copy-and-paste from the pdf version of the man page, and that might produce long dashes (instead of normal dashes). This problem can be hard to detect, so specially warning about it should help. --- flawfinder | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/flawfinder b/flawfinder index 90b1642..62aef6e 100755 --- a/flawfinder +++ b/flawfinder @@ -1596,6 +1596,12 @@ def process_file_args(files, patch_infos): # built-in doesn't give us enough control over symbolic links. # So, we'll walk the filesystem hierarchy ourselves: maybe_process_file(f, patch_infos) + elif not os.path.exists(f): + if not quiet: + if h(f).startswith("\342\210\222"): + print_warning("Skipping non-existent filename starting with UTF-8 long dash " + h(f)) + else: + print_warning("Skipping non-existent file " + h(f)) else: if not quiet: print_warning("Skipping non-regular file " + h(f))