Bug 582993

Summary: guestfish eats words when tab completing case (in)sensitive paths
Product: [Community] Virtualization Tools Reporter: Jinxin Zheng <jzheng>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED UPSTREAM QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: mbooth, virt-maint, yuzhang
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-05-25 13:04:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jinxin Zheng 2010-04-16 11:19:45 UTC
Description of problem:
in guestfish mounted a guest image. when two files whose path has the prefixes differ only in their case, trying to tab-complete by their prefix in common would cause the path to be eaten.

Version-Release number of selected component (if applicable):
><fs> version
major: 1
minor: 2
release: 2
extra: 


How reproducible:
always

Steps to Reproduce:
1. launch guestfish, mount a guest image.
2. let's say we have two files: abc and ABC in root filesystem.
><fs> ls /
abc  ABC 
3. do the following
><fs> ls /ab<tab>
  
Actual results:
step 3 leaves us with
><fs> ls /

Expected results:
the prefix word we typed in should stay not touched after we press the <tab> key as the file actually exists.

Additional info:
I came across this issue by tabbing the /dev path.
><fs> ls /dev/<tab>
/dev/mapper               /dev/vda1                 /dev/VolGroup00           /dev/VolGroup00/LogVol01  
/dev/vda                  /dev/vda2                 /dev/VolGroup00/LogVol00  
><fs> ls /dev/v<tab>
><fs> ls /dev/

Comment 1 Richard W.M. Jones 2010-05-25 11:59:19 UTC
Easy to reproduce this, and it's not specific to NTFS, but happens
also on ext3 filesystems.

$ guestfish -N fs:ext3 -m /dev/sda1
><fs> touch /ABC
><fs> touch /abc
><fs> ll /a<tab>

results in the 'a' character disappearing.

Comment 2 Richard W.M. Jones 2010-05-25 13:04:59 UTC
I've pushed the following commit upstream:
http://git.annexia.org/?p=libguestfs.git;a=commitdiff;h=21bd2db7cf259a17cc3922409937b849e4b83c0f

Testing this is complicated.  You need to look at
all combinations of:

(A) No ~/.inputrc file

(B) ~/.inputrc file containing
  set completion-ignore-case on

(C) ~/.inputrc file containing
  set completion-ignore-case off

and

(1) A filesystem containing files /ABC and /abc

(2) A filesystem containing just /ABC

and

(i) Tab-completing /a<tab>

(ii) Tab-completing /A<tab>

However this does work for me, and the default behaviour
(without ~/.inputrc) feels more intuitive particularly on
Windows guests.

Comment 3 Jinxin Zheng 2010-05-26 01:55:59 UTC
(In reply to comment #2)
> I've pushed the following commit upstream:
> http://git.annexia.org/?p=libguestfs.git;a=commitdiff;h=21bd2db7cf259a17cc3922409937b849e4b83c0f
> 
> Testing this is complicated.  You need to look at
> all combinations of:
> 
> (A) No ~/.inputrc file
> 
> (B) ~/.inputrc file containing
>   set completion-ignore-case on
> 
> (C) ~/.inputrc file containing
>   set completion-ignore-case off
> 
> and
> 
> (1) A filesystem containing files /ABC and /abc
> 
> (2) A filesystem containing just /ABC
> 
> and
> 
> (i) Tab-completing /a<tab>
> 
> (ii) Tab-completing /A<tab>
I tested your change following your suggestion. it looks good to me.
setting completion-ignore-case on/off effectively changes the fish's behaviour as supposed to.

> 
> However this does work for me, and the default behaviour
> (without ~/.inputrc) feels more intuitive particularly on
> Windows guests.    
Thanks

Comment 4 Fedora Update System 2010-06-02 21:12:41 UTC
libguestfs-1.2.9-1.el5 has been submitted as an update for Fedora EPEL 5.
http://admin.fedoraproject.org/updates/libguestfs-1.2.9-1.el5

Comment 5 Fedora Update System 2010-06-02 21:26:27 UTC
libguestfs-1.2.9-1.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/libguestfs-1.2.9-1.fc13

Comment 6 Fedora Update System 2010-06-03 08:49:10 UTC
libguestfs-1.2.9-1.el5.1 has been submitted as an update for Fedora EPEL 5.
http://admin.fedoraproject.org/updates/libguestfs-1.2.9-1.el5.1