# HG changeset patch # User Franz Glasner # Date 1727450871 -7200 # Node ID aa21ec8b86c50e3efcf825a00f91b4dc3d2e041e # Parent 0c7917469e04eec14f738fdb6317e6fbde7fccf8 common.subr: allow and handle a trailing shash in directory arg in "_get_mounts_at_directory()" diff -r 0c7917469e04 -r aa21ec8b86c5 share/local-bsdtools/common.subr --- 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}"