Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2168766

Summary: stratisd does not recognize special character for pool_name while creating pool
Product: Red Hat Enterprise Linux 9 Reporter: Lin Li <lilin>
Component: stratis-cliAssignee: Stratis Team <stratis-team>
Status: CLOSED NOTABUG QA Contact: Storage QE <storage-qe>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 9.2CC: amulhern, bgurney, cwei, dkeefe
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-02-13 22:57:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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.