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 1232224 - Fails to "get", "print" the file and complete the file name using TAB when the file name has the special characters include "][|=()!,\ ".
Summary: Fails to "get", "print" the file and complete the file name using TAB when th...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: augeas
Version: ---
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: pre-dev-freeze
: ---
Assignee: Pino Toscano
QA Contact: YongkuiGuo
URL:
Whiteboard:
Depends On: 1186316 1232167
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-06-16 10:20 UTC by Dominic Cleal
Modified: 2020-04-28 16:49 UTC (History)
9 users (show)

Fixed In Version: augeas-1.12.0-5.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1232167
Environment:
Last Closed: 2020-04-28 16:49:27 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github hercules-team augeas pull 631 0 None closed A couple of augtool completion fixes 2021-01-28 09:55:22 UTC
Red Hat Product Errata RHBA-2020:1824 0 None None None 2020-04-28 16:49:37 UTC

Description Dominic Cleal 2015-06-16 10:20:49 UTC
+++ This bug was initially created as a clone of Bug #1232167 +++

Description of problem:
This bug is introduced by bug 1186318.
Fails to get, print the file and complete the file name using TAB key when file name has the special characters include "][|=()!,\ ".

Version-Release number of selected component (if applicable):
augeas-1.0.0-10.el6

How reproducible:
Always

Steps to Reproduce:
Step to reproduce:
1. Under /etc/sysconfig/network-scripts, create a file with the special characters include "][|=()!,\ ".
# ls /etc/sysconfig/network-scripts/ifcfg-weird*
/etc/sysconfig/network-scripts/ifcfg-weird\ [!]|=, (used to fail) 

Note: there is a whitespace at the end of the name.

2. Initialize the augtool and print the entries 
# augtool
augtool> print /files/etc/sysconfig/network-scripts/
/files/etc/sysconfig/network-scripts
/files/etc/sysconfig/network-scripts/ifcfg-weird\\\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ 
/files/etc/sysconfig/network-scripts/ifcfg-weird\\\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /DEVICE = "\"eth0\""
/files/etc/sysconfig/network-scripts/ifcfg-weird\\\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /BOOTPROTO = "\"dhcp\""
/files/etc/sysconfig/network-scripts/ifcfg-weird\\\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /HWADDR = "\"6C:AE:8B:20:80:82\""
/files/etc/sysconfig/network-scripts/ifcfg-weird\\\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /IPV6INIT = "\"yes\""
/files/etc/sysconfig/network-scripts/ifcfg-weird\\\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /MTU = "\"1500\""
/files/etc/sysconfig/network-scripts/ifcfg-weird\\\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /NM_CONTROLLED = "\"yes\""
/files/etc/sysconfig/network-scripts/ifcfg-weird\\\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /ONBOOT = "\"yes\""
/files/etc/sysconfig/network-scripts/ifcfg-weird\\\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /TYPE = "\"Ethernet\""
/files/etc/sysconfig/network-scripts/ifcfg-weird\\\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /UUID = "\"6d1866d3-83bf-473d-a934-190213c8ca11\""
...

augtool> match /files/etc/sysconfig/network-scripts/*
/files/etc/sysconfig/network-scripts/ifcfg-weird\\\ \[\!\]\|\=\,\ \(used\ to\ fail\)\  = (none)
...

### So augtool can Initialize successfully.

3. Failed to use "tab" to auto complete the nodes in the file.
augtool> get /files/etc/sysconfig/network-scripts/ifcfg-weird\\\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ 
### tap "tab" fails to get the nodes

4. When there are two similar files, "tab" fails to auto complete the file name.
# ls /etc/sysconfig/network-scripts/ifcfg-weird*
/etc/sysconfig/network-scripts/ifcfg-weird [!] (used to fail)
/etc/sysconfig/network-scripts/ifcfg-weird\ [!]|=, (used to fail)

augtool> ls /files/etc/sysconfig/network-scripts/ifcfg-weird\
### tap "tab" now
boot/  etc/   root/  usr/

It should display the two possible files instead these four directory. Seams that it happens when the taped file path taped includes the escape flag.


5. Fails to execute the print, ls, match or other commands when use the file directly.
augtool> print /files/etc/sysconfig/network-scripts/ifcfg-weird\\\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ 
error: Failed to execute command
unknown escape sequence

augtool> get /files/etc/sysconfig/network-scripts/ifcfg-weird\\\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /DEVICE
error: Failed to execute command
unknown escape sequence



Actual results:
Described as above.

Expected results:
The scenarios in step 3, 4 and 5 should also be handled properly.

Additional info:

Comment 3 Pino Toscano 2019-05-17 14:44:37 UTC
I should have fixed at least the cases (3), and (5):
https://github.com/hercules-team/augeas/pull/631

Let's see whether the fixes are actually good enough.

Comment 4 Pino Toscano 2019-06-25 10:54:33 UTC
This bug is not critical, as it affects the tab-completion in augtool only for paths with certain special characters (which are not common).
Hence, moving it to RHEL 8.

Comment 6 Pino Toscano 2020-02-04 14:25:17 UTC
Fixed upstream with commits
94e327a5ca76f579a2f19d393b9836b427c470df
a144fb0dc4dfd8d5b3b733df861deb089a1d5a2c
which are in augeas > 1.12.0.

Comment 8 YongkuiGuo 2020-02-11 09:54:19 UTC
Failed to verify this bug with package:
augeas-1.12.0-5.el8.x86_64

Steps:

1.
# touch  /etc/sysconfig/network-scripts/ifcfg-weird\ [!]\|\=\,\ \(used\ to\ fail\)\ 
# ls /etc/sysconfig/network-scripts/ifcfg-weird*
'/etc/sysconfig/network-scripts/ifcfg-weird [!]|=, (used to fail) '

2.
# augtool
augtool> print /files/etc/sysconfig/network-scripts/
...
/files/etc/sysconfig/network-scripts/ifcfg-weird\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ 
/files/etc/sysconfig/network-scripts/ifcfg-weird\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /TYPE = "\"Ethernet\""
/files/etc/sysconfig/network-scripts/ifcfg-weird\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /PROXY_METHOD = "\"none\""
/files/etc/sysconfig/network-scripts/ifcfg-weird\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /BROWSER_ONLY = "\"no\""
/files/etc/sysconfig/network-scripts/ifcfg-weird\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /BOOTPROTO = "\"dhcp\""
/files/etc/sysconfig/network-scripts/ifcfg-weird\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /DEFROUTE = "\"yes\""
/files/etc/sysconfig/network-scripts/ifcfg-weird\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /IPV4_FAILURE_FATAL = "\"no\""
/files/etc/sysconfig/network-scripts/ifcfg-weird\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /IPV6INIT = "\"yes\""
/files/etc/sysconfig/network-scripts/ifcfg-weird\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /IPV6_AUTOCONF = "\"yes\""
/files/etc/sysconfig/network-scripts/ifcfg-weird\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /IPV6_DEFROUTE = "\"yes\""
/files/etc/sysconfig/network-scripts/ifcfg-weird\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /IPV6_FAILURE_FATAL = "\"no\""
/files/etc/sysconfig/network-scripts/ifcfg-weird\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /IPV6_ADDR_GEN_MODE = "\"stable-privacy\""
/files/etc/sysconfig/network-scripts/ifcfg-weird\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /NAME = "\"eno1\""
/files/etc/sysconfig/network-scripts/ifcfg-weird\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /UUID = "\"7d07c305-94ea-462d-9722-6f1348d64e10\""
/files/etc/sysconfig/network-scripts/ifcfg-weird\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /DEVICE = "\"eno5\""
/files/etc/sysconfig/network-scripts/ifcfg-weird\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /ONBOOT = "\"yes\""

3. Tap "tab" and get the nodes correctly
augtool> get /files/etc/sysconfig/network-scripts/ifcfg-weird\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /
BOOTPROTO           DEFROUTE            IPV4_FAILURE_FATAL  IPV6_AUTOCONF       IPV6_FAILURE_FATAL  NAME                PROXY_METHOD        UUID
BROWSER_ONLY        DEVICE              IPV6_ADDR_GEN_MODE  IPV6_DEFROUTE       IPV6INIT            ONBOOT              TYPE

4.
#touch  /etc/sysconfig/network-scripts/ifcfg-weird\ [!]\ \(used\ to\ fail\)\
# ll /etc/sysconfig/network-scripts/ifcfg-weird*
-rw-r--r--. 1 root root   0 Feb 11 04:43 '/etc/sysconfig/network-scripts/ifcfg-weird [!] (used to fail) '
-rw-r--r--. 1 root root 308 Feb 11 04:11 '/etc/sysconfig/network-scripts/ifcfg-weird [!]|=, (used to fail) '
# augtool
augtool> ls /files/etc/sysconfig/network-scripts/ifcfg-weird\ \[\!\]\                 --- tap "tab" and complete the file name correctly
ifcfg-weird\ \[\!\]\ \(used\ to\ fail\)\          ifcfg-weird\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /

5.Failed to run the 'print','get' commands
augtool> print /files/etc/sysconfig/network-scripts/ifcfg-weird\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /   --- no output
augtool> get /files/etc/sysconfig/network-scripts/ifcfg-weird\ \[\!\]\|\=\,\ \(used\ to\ fail\)\ /DEVICE
/files/etc/sysconfig/network-scripts/ifcfg-weird \[\!\]\|\=\, \(used to fail\) /DEVICE (o)          --- The return value is wrong.


The step 5 is not fixed.

Comment 9 Pino Toscano 2020-02-11 15:38:56 UTC
I noticed that the problem seems to be when the last character of a filename is a space.
So if you change the test from:
/etc/sysconfig/network-scripts/ifcfg-weird\ [!]\|\=\,\ \(used\ to\ fail\)\ 
to:
/etc/sysconfig/network-scripts/ifcfg-weird\ [!]\|\=\,\ \(used\ to\ fail\)
then for me it works, as it is similar to the test cases I used when fixing this upstream.

Considering that:
- spaces in filenames, especially in configuration files, are rare
- spaces at the end of filenames are even more rare
- spaces in other places of filenames are supported
I'd validate this without this the space at the end, eventually opening a bug if we care enough.
(I personally would ignore this case until anybody shows a legit use case for it.)

What do you think?

Comment 10 YongkuiGuo 2020-02-12 02:24:58 UTC
(In reply to Pino Toscano from comment #9)
> I noticed that the problem seems to be when the last character of a filename
> is a space.
> So if you change the test from:
> /etc/sysconfig/network-scripts/ifcfg-weird\ [!]\|\=\,\ \(used\ to\ fail\)\ 
> to:
> /etc/sysconfig/network-scripts/ifcfg-weird\ [!]\|\=\,\ \(used\ to\ fail\)
> then for me it works, as it is similar to the test cases I used when fixing
> this upstream.
> 

Yes, it works.

# augtool
augtool> print  /files/etc/sysconfig/network-scripts/ifcfg-weird\ \[\!\]\|\=\,\ \(used\ to\ fail\)
/files/etc/sysconfig/network-scripts/ifcfg-weird\ \[\!\]\|\=\,\ \(used\ to\ fail\)
/files/etc/sysconfig/network-scripts/ifcfg-weird\ \[\!\]\|\=\,\ \(used\ to\ fail\)/DEVICE = "\"eth0\"" 
augtool> get  /files/etc/sysconfig/network-scripts/ifcfg-weird\ \[\!\]\|\=\,\ \(used\ to\ fail\)/DEVICE
/files/etc/sysconfig/network-scripts/ifcfg-weird \[\!\]\|\=\, \(used to fail\)/DEVICE = "eth0


> Considering that:
> - spaces in filenames, especially in configuration files, are rare
> - spaces at the end of filenames are even more rare
> - spaces in other places of filenames are supported
> I'd validate this without this the space at the end, eventually opening a
> bug if we care enough.
> (I personally would ignore this case until anybody shows a legit use case
> for it.)
> 
> What do you think?

I agree. I also think it‘s absolutely rare and unnecessary to add spaces at the end of filenames. And sometimes it's difficult to distinguish from the other same name files which don't have spaces in the end.

Comment 11 Pino Toscano 2020-02-12 09:52:17 UTC
(In reply to YongkuiGuo from comment #10)
> I agree. I also think it‘s absolutely rare and unnecessary to add spaces at
> the end of filenames. And sometimes it's difficult to distinguish from the
> other same name files which don't have spaces in the end.

In that case, what about declaring it as verified?

Also, I noticed that the test case without the whitespace at the end is tested by the test-xpath which is part of the test suite: see the tests/xpath.tests file with the data for that test.

Comment 12 YongkuiGuo 2020-02-12 10:40:42 UTC
According to comments 8,9,10, I will verify this bug.

Comment 13 YongkuiGuo 2020-02-12 10:43:01 UTC
(In reply to Pino Toscano from comment #11)
> Also, I noticed that the test case without the whitespace at the end is
> tested by the test-xpath which is part of the test suite: see the
> tests/xpath.tests file with the data for that test.

Oh, i see that. Thanks.

Comment 15 errata-xmlrpc 2020-04-28 16:49:27 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/RHBA-2020:1824


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