Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
changeset 645:aa21ec8b86c5
common.subr: allow and handle a trailing shash in directory arg in "_get_mounts_at_directory()"
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Fri, 27 Sep 2024 17:27:51 +0200 |
| parents | 0c7917469e04 |
| children | 1d5f87e68078 |
| files | share/local-bsdtools/common.subr |
| diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/share/local-bsdtools/common.subr Fri Sep 27 17:23:01 2024 +0200 +++ b/share/local-bsdtools/common.subr Fri Sep 27 17:27:51 2024 +0200 @@ -437,7 +437,7 @@ #: #: Args: #: $1 (str, optional): The directory where to start for mounts and sub-mounts. -#: It must be an absolute path and may not have a trailing slash ``/``. +#: It must be an absolute path. #: The root directory :file:`/` is allowed. #: A `null` value is treated as if the root directory :file:`/` #: is given as argument. @@ -488,8 +488,14 @@ _mp1='/' _mp2='/' ;; + *//*) + fatal 1 "given directory must not contain consequtive slashes" + ;; /*/) - fatal 1 "a trailing slash in directory path given" + # Remove trailing slash for equality check + _mp1="${_directory%/}" + # Hold the trailing slash as-is for the directory check + _mp2="${_directory}" ;; /*) _mp1="${_directory}"
