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 1480672 - Inconsistent behaviour of -I switch with "ls"
Summary: Inconsistent behaviour of -I switch with "ls"
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: bash
Version: 6.10
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Siteshwar Vashisht
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-08-11 17:07 UTC by roundsoftstudio
Modified: 2017-08-11 17:21 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-11 17:21:34 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Several commands with "ls -I" (92.90 KB, image/jpeg)
2017-08-11 17:07 UTC, roundsoftstudio
no flags Details

Description roundsoftstudio 2017-08-11 17:07:54 UTC
Created attachment 1312196 [details]
Several commands with "ls -I"

Description of problem:
ls -I produces inconsistent outputs when the filter is not written with quotes

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

How reproducible:
Very easy to reproduce


Steps to Reproduce:
1. Touch several files with several of them starting with the same pattern
   $ touch mybody
   $ touch thisisMY205
   $ touch thisisMYTRALALA
   $ touch THERING
   $ …

2. Write down some "ls -I" commands with wildcards
   
3. Conclude that ls -I malfunctions when the filter for excluding files matches at least 2 files.

Actual results:
   $ ls -I mybody*
   thisisMY205 thisisMYTRALALA THERING

   $ ls -I thisis*
   thisisMYTRALALA

   $ ls -I "thisis*"
   mybody THERING


Expected results:
  $ ls -I thisis*
  mybody THERING

Comment 2 Kamil Dudka 2017-08-11 17:21:34 UTC
If you do not quote the operand of -I, it is expanded by the shell before running the 'ls' command and only the first word produced by the expansion is used as the operand of -I.  The remaining words produced by the expansion are seen by 'ls' as the list of files to be listed.  You can consider using the -x option of bash to see the exact command being invoked.

This is just how bash (as well as any other POSIX-compatible shell) works.  Nothing to fix here...


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