{
    "content": [
        {
            "type": "text",
            "text": "# Dpkg::Path (perldoc)\n\n## NAME\n\nDpkg::Path - some common path handling functions\n\n## DESCRIPTION\n\nIt provides some functions to handle various path.\n\n## Sections\n\n- **NAME**\n- **DESCRIPTION**\n- **FUNCTIONS** (6 subsections)\n- **CHANGES**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Dpkg::Path",
        "section": "",
        "mode": "perldoc",
        "summary": "Dpkg::Path - some common path handling functions",
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "FUNCTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "get_pkg_root_dir",
                        "lines": 6
                    },
                    {
                        "name": "relative_to_pkg_root",
                        "lines": 2
                    },
                    {
                        "name": "guess_pkg_root_dir",
                        "lines": 6
                    },
                    {
                        "name": "check_files_are_the_same",
                        "lines": 4
                    },
                    {
                        "name": "canonpath",
                        "lines": 8
                    },
                    {
                        "name": "check_directory_traversal",
                        "lines": 23
                    }
                ]
            },
            {
                "name": "CHANGES",
                "lines": 18,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Dpkg::Path - some common path handling functions\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "It provides some functions to handle various path.\n",
                "subsections": []
            },
            "FUNCTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "get_pkg_root_dir",
                        "content": "This function will scan upwards the hierarchy of directory to find out the directory\nwhich contains the \"DEBIAN\" sub-directory and it will return its path. This directory is\nthe root directory of a package being built.\n\nIf no DEBIAN subdirectory is found, it will return undef.\n"
                    },
                    {
                        "name": "relative_to_pkg_root",
                        "content": "Returns the filename relative to getpkgrootdir($file).\n"
                    },
                    {
                        "name": "guess_pkg_root_dir",
                        "content": "This function tries to guess the root directory of the package build tree. It will first\nuse getpkgrootdir(), but it will fallback to a more imprecise check: namely it will\nuse the parent directory that is a sub-directory of the debian directory.\n\nIt can still return undef if a file outside of the debian sub-directory is provided.\n"
                    },
                    {
                        "name": "check_files_are_the_same",
                        "content": "This function verifies that both files are the same by checking that the device numbers\nand the inode numbers returned by stat()/lstat() are the same. If $resolvesymlink is\ntrue then stat() is used, otherwise lstat() is used.\n"
                    },
                    {
                        "name": "canonpath",
                        "content": "This function returns a cleaned path. It simplifies double //, and remove /./ and /../\nintelligently. For /../ it simplifies the path only if the previous element is not a\nsymlink. Thus it should only be used on real filenames.\n\n$newpath = resolvesymlink($symlink)\nReturn the filename of the file pointed by the symlink. The new name is canonicalized by\ncanonpath().\n"
                    },
                    {
                        "name": "check_directory_traversal",
                        "content": "This function verifies that the directory $dir does not contain any symlink that goes\nbeyond $basedir (which should be either equal or a parent of $dir).\n\n$cmdpath = findcommand($command)\nReturn the path of the command if defined and available on an absolute or relative path\nor on the $PATH, undef otherwise.\n\n$controlfile = getcontrolpath($pkg, $filetype)\nReturn the path of the control file of type $filetype for the given package.\n\n@controlfiles = getcontrolpath($pkg)\nReturn the path of all available control files for the given package.\n\n$file = findbuildfile($basename)\nSelects the right variant of the given file: the arch-specific variant\n(\"$basename.$arch\") has priority over the OS-specific variant (\"$basename.$os\") which\nhas priority over the default variant (\"$basename\"). If none of the files exists, then\nit returns undef.\n\n@files = findbuildfile($basename)\nReturn the available variants of the given file. Returns an empty list if none of the\nfiles exists.\n"
                    }
                ]
            },
            "CHANGES": {
                "content": "Version 1.05 (dpkg 1.20.4)\nNew function: checkdirectorytraversal().\n\nVersion 1.04 (dpkg 1.17.11)\nUpdate semantics: findcommand() now handles an empty or undef argument.\n\nVersion 1.03 (dpkg 1.16.1)\nNew function: findbuildfile()\n\nVersion 1.02 (dpkg 1.16.0)\nNew function: getcontrolpath()\n\nVersion 1.01 (dpkg 1.15.8)\nNew function: findcommand()\n\nVersion 1.00 (dpkg 1.15.6)\nMark the module as public.\n",
                "subsections": []
            }
        }
    }
}