| Commit message (Collapse) | Author | Age |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The usual idiom for fatal error reporting in man-db is `error (FATAL,
...)` (there are a few cases using different exit codes, but they're
less common). Unfortunately, there's no easy way to tell the compiler
that this call doesn't return, because `error (0, ...)` *does* return.
As a result, some call sites required extra work to give the compiler
this information, which can sometimes make a difference to static
analysis.
To simplify this, add a new `fatal` helper function which always exits
`FATAL` (i.e. 2) and never returns. This is declared with `_Noreturn`
so that the compiler can straightforwardly know what's going on.
* bootstrap.conf (gnulib_modules): Add verror.
(XGETTEXT_OPTIONS): Add --flag=fatal:2:c-format.
* lib/fatal.c, lib/fatal.h: New files.
* lib/Makefile.am (libman_la_SOURCES): Add fatal.c and fatal.h.
* src/tests/Makefile.am (AM_CPPFLAGS): Add -I$(top_srcdir)/lib.
(get_mtime_LDADD): Add $(top_builddir)/lib/libman.la.
* lib/pathsearch.c (pathsearch, directory_on_path): Use fatal.
* lib/sandbox.c (can_load_seccomp, make_seccomp_filter, _sandbox_load):
Likewise.
* lib/security.c (gripe_set_euid): Likewise.
* lib/xregcomp.c (xregcomp): Likewise.
* libdb/db_lookup.c (gripe_corrupt_data, dblookup_pattern): Likewise.
* libdb/db_ver.c (dbver_wr): Likewise.
* src/accessdb.c (main): Likewise.
* src/catman.c (parse_for_sec): Likewise.
* src/check_mandirs.c (chown_if_possible): Likewise.
* src/man-recode.c (recode): Likewise.
* src/man.c (open_cat_stream, format_display, gripe_converting_name):
Likewise.
* src/manconv.c (add_output): Likewise.
* src/manp.c (add_dir_to_path_list): Likewise.
* src/tests/get-mtime.c (main): Likewise.
* src/whatis.c (do_apropos): Likewise.
* src/zsoelim.l (<so>\"?[^ \t\n\"]+\"?): Likewise.
* libdb/db_lookup.c (gripe_corrupt_data, gripe_replace_key): Declare as
_Noreturn.
* src/accessdb.c (main): Remove now-unnecessary assertion.
* src/man.c (gripe_converting_name): Remove now-unnecessary abort.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Header includes should be in the same translation unit as the code that
uses them rather than being ambient across the whole project.
* include/manconfig.h: Remove obsolete header comment about program
paths.
* include/manconfig.h: Remove includes of "xvasprintf.h", <stddef.h>,
"xalloc.h", and "xstrndup.h", as well as "struct pipeline" declaration.
Update all files that relied on these to include/declare them directly
instead as needed.
* include/manconfig.h (MAN_DB, mkdbname): Move to ...
* libdb/mydbm.h: ... here.
|
|
(Debian bug #461319).
* src/whatis.c (lower): Move to ...
* lib/lower.c: ... here, with optimisation from name_to_key. New
file.
* lib/lower.h: New file.
* src/whatis.c (word_fnmatch): Move to ...
* lib/wordfnmatch.c: ... here, with more generic argument names. New
file.
* lib/wordfnmatch.h: New file.
* src/whatis.c (main): Factor regcomp error handling out to ...
* lib/xregcomp.c: ... here. New file.
* lib/xregcomp.h: New file.
* lib/Makefile.am (libman_a_SOURCES): Add lower.c, lower.h,
wordfnmatch.c, wordfnmatch.h, xregcomp.c, and xregcomp.h.
* po/POTFILES.in: Add lib/xregcomp.c; remove src/globbing.c.
* libdb/db_lookup.c (name_to_key): Use lower.
(dblookup_pattern): New function.
* libdb/db_storage.h (dblookup_pattern): Add prototype.
* src/globbing.c (end_pattern): Rename to ...
(make_pattern): ... this. Create the whole pattern rather than
merely appending section or extension components. Handle regexes
if the new opts argument has the LFF_REGEX bit set.
(match_in_directory): Take an opts disjunction rather than a
boolean ignore_case argument; ignore_case is replaced by the
LFF_MATCHCASE bit being unset. Handle regexes if opts has the
LFF_REGEX bit set.
(look_for_file): Take an opts disjunction rather than a boolean
match_case argument; match_case is replaced by the LFF_MATCHCASE
bit being set. Handle regexes if opts has the LFF_REGEX bit set.
Handle shell wildcards if opts has the LFF_WILDCARD bit set (which
simply means not shell-escaping unesc_name). Call make_pattern
rather than end_pattern (with appropriate adjustments).
* src/globbing.h (enum look_for_file_opts): New enumeration.
(look_for_file): Update prototype.
* src/globbing_test.c (options, parse_opt): Accept -r/--regex and
-w/--wildcard.
(main): Update look_for_file arguments, including passing
LFF_REGEX or LFF_WILDCARD if the corresponding options are used.
* src/check_mandirs.c (purge_whatis, purge_missing), src/zsoelim.l
(zsoelim_open_file): Update look_for_file arguments.
* src/whatis.c (main): Only free preg if a regular expression was
compiled into it in the first place.
* src/man.c (options, parse_opt): Accept --regex, --wildcard, and
--names-only. Reset corresponding variables with -D. Refuse to
accept both --regex and --wildcard.
(try_section): Update look_for_file arguments, including passing
LFF_REGEX or LFF_WILDCARD if the corresponding options are used.
(try_db): Use dblookup_pattern if --regex or --wildcard is used,
with corresponding options.
* man/man1/man.man1 (SYNOPSIS, Finding manual pages): Document
--regex, --wildcard, and --names-only.
|