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 1182955 - The prompt for removal of LV accepts more characters than the stated y/n
Summary: The prompt for removal of LV accepts more characters than the stated y/n
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: lvm2
Version: 7.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Zdenek Kabelac
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-01-16 10:13 UTC by Nenad Peric
Modified: 2021-09-03 12:53 UTC (History)
9 users (show)

Fixed In Version: lvm2-2.02.175-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 15:16:02 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2018:0853 0 None None None 2018-04-10 15:17:48 UTC

Description Nenad Peric 2015-01-16 10:13:28 UTC
Description of problem:

If you try to remove an active LV you will be prompted with:

Do you really want to remove active logical volume <volname>? [y/n]:

But it accepts whole words which do not make sense, and which could lead to accidental removal of an LV sometimes. 
If there us a y/n prompt it should I hope accept only y/n.

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

lvm2-2.02.114-5.el7.x86_64

How reproducible:

Everytime

Steps to Reproduce:

Try to remove an active LV:

[root@virt-140 ~]# lvremove vg/stripe
Do you really want to remove active logical volume stripe? [y/n]: maybe
  Logical volume "stripe" successfully removed


Actual results:

The LV gets removed as soon as it finds a 'y' wherever in the supplied word or even sentence. 

Expected results:

It should only accept single character 'y' and 'n' (or uppercase) as written in the prompt. Or additionally whole words 'yes' or 'no'. 
Anything else makes no sense, since by accidentally pasting a clipboard which has a 'y' and enter in it, the LV would get removed.

Additional info:

Comment 2 Zdenek Kabelac 2015-01-16 10:19:29 UTC
Prompts are not read by 'words', just single letters from  'stdin'   (so i.e. script could push in letters')

So the stdin stream is not split into words and IMHO it may possibly cause some other regressions if some users are pushing letters into lvm2's stdin input and they would be split by some control characters into some sections ?

For now  first appearance of  letter  'y'  or 'n' wins.

Comment 3 Nenad Peric 2015-01-21 21:21:14 UTC
(In reply to Zdenek Kabelac from comment #2)

Still, if we ask for a one letter confirmation, we should stay by those rules and accept y or n, alternatively Y or N.

> For now  first appearance of  letter  'y'  or 'n' wins.

That is not completely true. If you provide a sentence with both 'y' and 'n' none wins, and the prompt is repeated. For example:

Do you really want to remove active logical volume <volname>? [y/n]: maybe, I don't know

it will just repeat the prompt, so the first 'y' did not really win in this case (it matched an 'n' in "don't know" as well).

Comment 5 Alasdair Kergon 2016-06-09 23:39:17 UTC
The current proposal is to tidy this up as follows:

1) We will accept '^[ ^t]*([Yy]([Ee]([Ss]|)|)|[Nn]([Oo]|))[ ^t]*$'
   - optional whitespace before and after
   - y / ye / yes
   - n / no
   - case-independent

2) We will confirm the selection made e.g. by printing [y] [n] or [?] on stderr

Comment 6 Zdenek Kabelac 2017-08-25 12:37:07 UTC
Already upstream with commit 35612bd27c203774948c84005c9fb9237746c34a
(lvm2 2.02.156)

Comment 9 Roman Bednář 2017-10-16 10:32:35 UTC
Marking verified with latest rpms. Prompt now only accepts options specified in Comment 5.


Do you really want to remove active logical volume vg/lv? [y/n]: maybe
  WARNING: Invalid input 'maybe'.
Do you really want to remove active logical volume vg/lv? [y/n]: yesno
  WARNING: Invalid input 'yesno'.
Do you really want to remove active logical volume vg/lv? [y/n]:    no 
  Logical volume vg/lv not removed.
[root@virt-371 yum.repos.d]# lvremove vg/lv
Do you really want to remove active logical volume vg/lv? [y/n]:        ye
  Logical volume "lv" successfully removed



3.10.0-727.el7.x86_64

lvm2-2.02.175-2.el7    BUILT: Fri Oct 13 13:31:22 CEST 2017
lvm2-libs-2.02.175-2.el7    BUILT: Fri Oct 13 13:31:22 CEST 2017
lvm2-cluster-2.02.175-2.el7    BUILT: Fri Oct 13 13:31:22 CEST 2017
device-mapper-1.02.144-2.el7    BUILT: Fri Oct 13 13:31:22 CEST 2017
device-mapper-libs-1.02.144-2.el7    BUILT: Fri Oct 13 13:31:22 CEST 2017
device-mapper-event-1.02.144-2.el7    BUILT: Fri Oct 13 13:31:22 CEST 2017
device-mapper-event-libs-1.02.144-2.el7    BUILT: Fri Oct 13 13:31:22 CEST 2017
device-mapper-persistent-data-0.7.3-2.el7    BUILT: Tue Oct 10 11:00:07 CEST 2017
cmirror-2.02.175-2.el7    BUILT: Fri Oct 13 13:31:22 CEST 2017

Comment 12 errata-xmlrpc 2018-04-10 15:16:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2018:0853


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