[Bash-completion-devel] [bash-completion-Bugs][313480] _filedir a$b -> h unit test failure

bash-completion-bugs at alioth.debian.org bash-completion-bugs at alioth.debian.org
Fri Sep 7 19:38:23 UTC 2012


bash-completion-Bugs item #313480, was changed at 2012-09-07 23:38 by Igor Murzov
You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=313480&group_id=100114

>Status: Closed
Priority: 3
Submitted By: Ville Skyttä  (scop-guest)
Assigned to: Nobody (None)
Summary: _filedir a$b -> h unit test failure 
Distribution: None
Originally reported in: None
Milestone: None
>Status: Fix Committed
Original bug number: 


Initial Comment:
bash 4.2.20(1)-release

$ ./runUnit --debug _filedir.exp
[...]
Running ./unit/_filedir.exp ...
FAIL: completing f a\$b/ should return h
FAIL: f "a\$b/ should show completion
FAIL: completing f2 a\$b/ should return h
[...]

That test case looks quite weird to me (what are those \b's for?), help needed.  dbg.log contains stuff like:


send: sending "f a\$b/\t" to { exp7 }

expect: does "" (spawn_id exp7) match exact string "f a\$b/"? no
f a\$b/
expect: does "f a\$b/" (spawn_id exp7) match exact string "f a\$b/"? yes
expect: set expect_out(0,string) "f a\$b/"
expect: set expect_out(spawn_id) "exp7"
expect: set expect_out(buffer) "f a\$b/"
Gate keeper glob pattern f/home/scop/cvs/bash-completion/test/fixtures/_filedir/a\\\$b/h $'/home/scop/cvs/bash-completion/test/fixtures/_filedir/a\\\$b/h '. Activating booster.
Gate keeper glob pattern for '^/@$' is '/@'. Activating booster.

expect: does "" (spawn_id exp7) match regular expression "^\u0008\u0008\u0008\u0008\u0008/home/scop/cvs/bash-completion/test/fixtures/_filedir/a\\\$b/h $"? Gate "\u0008\u0008\u0008\u0008\u0008/home/scop/cvs/bash-completion/test/fixtures/_filedir/a\\\$b/h "? gate=no
"^/@$"? Gate "/@"? gate=no
h 
expect: does "h " (spawn_id exp7) match regular expression "^\u0008\u0008\u0008\u0008\u0008/home/scop/cvs/bash-completion/test/fixtures/_filedir/a\\\$b/h $"? Gate "\u0008\u0008\u0008\u0008\u0008/home/scop/cvs/bash-completion/test/fixtures/_filedir/a\\\$b/h "? gate=no
"^/@$"? Gate "/@"? gate=no
expect: timed out
FAIL: completing f a\$b/ should return h


----------------------------------------------------------------------

>Comment By: Igor Murzov (garik-guest)
Date: 2012-09-07 23:38

Message:
Fixed in commit http://anonscm.debian.org/gitweb/?p=bash-completion/bash-completion.git;a=commit;h=23ac38333e469eac47d35dae7c640bff4a6b5203

----------------------------------------------------------------------

Comment By: Igor Murzov (garik-guest)
Date: 2012-04-25 20:56

Message:
You are right, Freddy. Completion works the way you described for me too with bash-4.1. I hadn't noticed this expansion before. However bash-4.2 doesn't do this expansion anymore.

----------------------------------------------------------------------

Comment By: Freddy Vulto (fvu-guest)
Date: 2012-04-24 00:31

Message:
The \b's (or \u0008's) are for the backspaces I see in my dbg.log, generated by bash completion:

    ^H^H^H^H^H/home/freddy/proj/bashCompletion/bash-completion.git/test/fixtures/_filedir/a\$b/h ^M
    expect: does "\u0008\u0008\u0008\u0008\u0008/home/freddy/proj/bashCompletion/bash-completion.git/test/fixtures/_filedir/a\$b/h " (spawn_id exp9) match       +regular expression "^\u0008\u0008\u0008\u0008\u0008/home/freddy/proj/bashCompletion/bash-completion\.git/test/fixtures/_filedir/a\\\$b/h $"? Gate           +"\u0008\u0008\u0008\u0008\u0008/home/freddy/proj/bashCompletion/bash-completion.git/test/fixtures/_filedir/a\\\$b/h "? gate=yes re=yes

This is on Debian with bash-4.1.5.

It looks like bash erases the parameter-to-complete, using backspaces.  I can also see this happing doing a manual completion:

   fixtures/_filedir$ f a\$b/ # Press tab, and it becomes:
   fixtures/_filedir$ f /full-path-to/fixtures/_filedir/a\$b/h 

The parameter `a\$b/' gets erased using five backspaces and the full path to `a\$b/h' is filled in.  Isn't this the case for you, even for bash-4.1?

----------------------------------------------------------------------

Comment By: Ville Skyttä  (scop-guest)
Date: 2012-04-21 11:15

Message:
+1 -- if the cruft is needed, some comments about why it's needed would be needed too :)

----------------------------------------------------------------------

Comment By: Igor Murzov (garik-guest)
Date: 2012-04-21 01:34

Message:
I suspect, that nobody actually knows what all this extra cruft is needed for. Probably original author of the these tests saw that completion worked fine and just copied what expect expected to the tests to make them pass. Looks like some related bug was fixed in bash-4.2 and no tricks are needed now for these tests. So I suggest to simply remove all the cruft from these test.

----------------------------------------------------------------------

Comment By: Ville Skyttä  (scop-guest)
Date: 2012-04-19 23:51

Message:
Same thing here with 4.2.24, untested with earlier.

----------------------------------------------------------------------

Comment By: Igor Murzov (garik-guest)
Date: 2012-04-18 19:42

Message:
I have bash-4.2.024 now and removing all the cruft fixes the tests for me:

diff --git a/test/unit/_filedir.exp b/test/unit/_filedir.exp
index b8cc200..a736e6e 100644
--- a/test/unit/_filedir.exp
+++ b/test/unit/_filedir.exp
@@ -88,8 +88,7 @@ foreach name {f f2} {
 
     set test "completing $name a\\\$b/ should return h"
     set cmd "$name a\\\$b/"
-    assert_complete_dir "\b\b\b\b\b$::srcdirabs/fixtures/_filedir/a\\\\\$b/h" \
-        $cmd "$::srcdir/fixtures/_filedir" $test
+    assert_complete_dir h $cmd "$::srcdir/fixtures/_filedir" $test
 
 
     sync_after_int
@@ -199,7 +198,7 @@ foreach name {f f2} {
 
 
     set cmd "$name \"a\\\$b/"; #"
-    assert_complete_dir "\b\b\b\b\b$::srcdirabs/fixtures/_filedir/a\\\\\$b/h\\\"" $cmd "$::srcdir/fixtures/_filedir"
+    assert_complete_dir {h"} $cmd "$::srcdir/fixtures/_filedir"; #"
 
 
     sync_after_int
-- 

But applying this patch breaks tests for bash-4.1.

----------------------------------------------------------------------

Comment By: Ville Skyttä  (scop-guest)
Date: 2011-12-29 11:54

Message:
It's just a test failure as far as I can tell, I haven't run into any unexpected completion problems.

----------------------------------------------------------------------

Comment By: Igor Murzov (garik-guest)
Date: 2011-12-29 02:42

Message:
Ville, does bash complete filenames containing '$' as expected on Fedora 16? It's not clear from your message if this is only failed test or the real issue.

Test passes for me with:
* bash-4.1.010
* tcl-8.5.9
* expect-5.44.1.15
* dejagnu-1.5

----------------------------------------------------------------------

Comment By: Ville Skyttä  (scop-guest)
Date: 2011-12-26 19:46

Message:
I've tried to bisect this but found nothing that would have broken it. I've also tried with bash 4.1.5 (Debian bash-static) on this box, same results. This system was recently upgraded from Fedora 14 to Fedora 16, bringing updates to bash, expect, tcl, and dejagnu, but downgrading those back to the Fedora 14 versions didn't help either.

----------------------------------------------------------------------

You can respond by visiting: 
https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=313480&group_id=100114



More information about the Bash-completion-devel mailing list