Lintian::Util(3) | Debian Package Checker | Lintian::Util(3) |
Lintian::Util - Lintian utility functions
use Lintian::Util;
This module contains a number of utility subs that are nice to have, but on their own did not warrant their own module.
Most subs are imported only on request.
May cause an exception if there are issues reading from the pipe.
Caveat: This will block until the pipe is closed from the "write"-end, so only use it with pipes where the "write"-end will eventually close their end by themselves (or something else will make them close it).
ALGO can be 'md5' or shaX, where X is any number supported by Digest::SHA (e.g. 'sha256').
This sub is a convenience wrapper around Digest::{MD5,SHA}.
ALGO can be 'md5' or shaX, where X is any number supported by Digest::SHA (e.g. 'sha256').
This sub is a convenience wrapper around Digest::{MD5,SHA}.
If the string does not appear to be a valid permission, it will cause a trappable error.
Examples:
# Good perm2oct('-rw-r--r--') == 0644 perm2oct('-rwxr-xr-x') == 0755 # Bad perm2oct('broken') # too short to be recognised perm2oct('-resurunet') # contains unknown permissions
On failure, this sub emits a trappable error.
Note: The handle may be a pipe from an external processes.
As the name suggests, this is a path "normalization" rather than a true path resolution (for that use Cwd::realpath). Particularly, it assumes none of the path segments are symlinks.
normalize_pkg_path will return "q{}" (i.e. the empty string) if PATH is normalized to the root dir and "undef" if the path cannot be normalized without escaping the package root.
normalize_pkg_path will return "q{}" (i.e. the empty string) if the target is the root dir and "undef" if the path cannot be normalized without escaping the package root.
CAVEAT: This function is not always sufficient to test if it is safe to open a given symlink. Use is_ancestor_of for that. If you must use this function, remember to check that the target is not a symlink (or if it is, that it can be resolved safely).
This function will resolve the paths; any failure to resolve the path will cause a trappable error.
2020-11-27 | Lintian v2.104.0 |