Bug 2168766 - stratisd does not recognize special character for pool_name while creating pool
Summary: stratisd does not recognize special character for pool_name while creating pool
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: stratis-cli
Version: 9.2
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Stratis Team
QA Contact: Storage QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-02-10 03:07 UTC by Lin Li
Modified: 2023-02-13 22:57 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-02-13 22:57:37 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-148235 0 None None None 2023-02-10 03:07:53 UTC

Description Lin Li 2023-02-10 03:07:24 UTC
Description of problem:
stratisd does not recognize special character for pool_name while creating pool

Version-Release number of selected component (if applicable):
stratis --version
3.4.1


How reproducible:
always

Steps to Reproduce:
1.setup multipath and stratis 
2.[root@storageqe-25 ~]# ls /dev/mapper/
360a98000324669436c2b45666c567858  rhel_storageqe--25-swap
360a98000324669436c2b45666c56785a  stratis-1-private-b6f55aa3552743a7bcdb5748daf98901-flex-mdv
360a98000324669436c2b45666c567861  stratis-1-private-b6f55aa3552743a7bcdb5748daf98901-flex-thindata
360a98000324669436c2b45666c567863  stratis-1-private-b6f55aa3552743a7bcdb5748daf98901-flex-thinmeta
control                            stratis-1-private-b6f55aa3552743a7bcdb5748daf98901-physical-originsub
rhel_storageqe--25-home            stratis-1-private-b6f55aa3552743a7bcdb5748daf98901-thinpool-pool
rhel_storageqe--25-root

3.[root@storageqe-25 ~]# stratis pool create !@#$^&*()(*&+_ /dev/mapper/360a98000324669436c2b45666c567858
-bash: !@#: event not found

4.[root@storageqe-25 ~]# stratis pool create *&+_ /dev/mapper/360a98000324669436c2b45666c567858
-bash: +_: command not found

5.[root@storageqe-25 ~]# stratis pool create aaa*&+_ /dev/mapper/360a98000324669436c2b45666c567858
-bash: +_: command not found

6.[root@storageqe-25 ~]# stratis pool create aaa*&48548654+_ /dev/mapper/360a98000324669436c2b45666c567858[1] 256252
-bash: 48548654+_: command not found

7.[root@storageqe-25 ~]# stratis pool create aaa*&48548654 /dev/mapper/360a98000324669436c2b45666c567858
[1] 256315
-bash: 48548654: command not found

Actual results:
stratisd does not recognize special character for pool_name while creating pool


Expected results:
stratisd can recognize special character for pool_name while creating pool


Additional info:
[root@storageqe-25 ~]# stratis pool create -h
usage: stratis pool create [-h] [--key-desc KEY_DESC] [--clevis {nbde,tang,tpm2}] [--tang-url TANG_URL] [--no-overprovision]
                           [--trust-url | --thumbprint THUMBPRINT]
                           pool_name blockdevs [blockdevs ...]

positional arguments:
  pool_name             Name of new pool
  blockdevs             Create the pool using these block devs

[root@storageqe-25 ~]# stratis --version
3.4.1

Comment 1 mulhern 2023-02-10 04:04:05 UTC
We do reject some pool names, for various reasons. But what I see right here is bash not being able to parse your command line in the way that you intend it to be understood. In general, it is interpreting the "&" in what you intend to be the pool name as a command instruction. Surround the pool names with quotation marks, and likely bash will interpret them as intended and pass them to stratis-cli.

Comment 2 Lin Li 2023-02-10 04:24:32 UTC
There is no related information in man page. Is it fesible to add naming rules for fool name in man page?

Comment 3 mulhern 2023-02-10 04:42:57 UTC
It would not be a high priority.

If the format of the name is unacceptable, stratisd will return an error with some explanation:

$ stratis pool create "aaa*&48548654" /dev/mapper/360a98000324669436c2b45666c567858
Execution failed:
stratisd failed to perform the operation that you requested. It returned the following information via the D-Bus: 1: Name contains characters not allowed in udev symlinks: aaa*&48548654.

Comment 4 Lin Li 2023-02-10 06:09:13 UTC
So is this a bug?

Comment 5 Bryan Gurney 2023-02-10 16:46:53 UTC
I would test again with escape sequences in the shell, to ensure that the special characters make it into the pool name:

(Example from stratis-3.5 in Fedora 37, but try it in RHEL 9:)

$ sudo stratis pool create dollarsign\$name /dev/vdb1
Execution failed:
stratisd failed to perform the operation that you requested. It returned the following information via the D-Bus: 1: Name contains characters not allowed in udev symlinks: dollarsign$name. 


$ sudo stratis pool create ampersand\&name /dev/vdb1Execution failed:
stratisd failed to perform the operation that you requested. It returned the following information via the D-Bus: 1: Name contains characters not allowed in udev symlinks: ampersand&name. 

It may be the case that most of those characters are already filtered out by stratisd commit 394dda53a598 ("Add regex to exclude characters filtered by udev").

However, note that UTF-8 characters should work:

$ sudo stratis pool create 水池1 /dev/vdb1

$ stratis pool list
Name                 Total / Used / Free    Properties                                   UUID   Alerts
水池1   8.00 GiB / 526.31 MiB / 7.49 GiB   ~Ca,~Cr, Op   c3483467-8f36-4a51-bcdb-1ad588e71d18   WS001

$ stratis pool explain WS001
Every device belonging to the pool has been fully allocated. To increase the allocable space, add additional data devices to the pool.

(This is an 8 GiB test device on a virtual machine, so the "WS001" alert is expected to appear.)

Comment 6 mulhern 2023-02-13 22:57:37 UTC
I don't think it is a bug. We place some restrictions on the characters allowed in a pool name, but they are few and motivated by practical machine limits. Also, we return reasonably good error messages when the name contains unsupported characters as shown in the example.


Note You need to log in before you can comment on or make changes to this bug.