Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 346509

Summary: app-shells/fish-{1.23.1,1.23.0} - The fish_indent command is broken
Product: Gentoo Linux Reporter: James Bowlin <bowlin>
Component: Current packagesAssignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it <maintainer-needed>
Status: RESOLVED FIXED    
Severity: major    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Patch to fix fish_indent " >" goes to "1>" bug

Description James Bowlin 2010-11-23 10:13:01 UTC
The fish_indent command is supposed to provide consistent formating for writing fish functions.  Currently is mangles redirects converting " >" to "1>" and then further prepending "1"s converting "1>" to "11>" and so on.



Reproducible: Always

Steps to Reproduce:
1.  Start fish shell
2.  run: functions help | grep ">"
3.  run: functions help | fish_indent | grep ">"

Notice that " >" was converted to "1>" by fish_indent.

Actual Results:  
Oops.  Sorry, I can't easily reproduce the mangled results because I've already fixed the bug on my system.


I've fixed this bug on my machine and will upload the patch file.  I've already sent the patch upstream.  It is possible my patch breaks something else but so far the patched version is working better than the broken version.

IMO this is a big deal because it breaks the funced (function edit) feature if the edited function contains one of four io redirects.  You end up creating mangled versions of functions that have priority over the working versions thus causing a lot of mysterious breakage.  If you try to use funced to fix the breakage, you usually just make things worse.  It is impossible to use funced to fix the breakage.

An alternative to the patch I will upload is to create the following funced function:

function fish_indent
	command fish_indent | sed 's/1\+>/ >/'
end

This is a quick and dirty fix because it will transform all "1>"s in the function being indented to " >" even the ones that were intentional.
Comment 1 James Bowlin 2010-11-23 10:17:51 UTC
Created attachment 255177 [details, diff]
Patch to fix fish_indent " >" goes to "1>" bug

This patch fixes the fish_indent bug I reported.  It is possible that it introduces a more subtle bug because I don't understand the purpose of the line I commented out.  But the patched version doesn't cause the widespread breakage I was experiencing with the unpatched version.  IMO it is a vast improvement even if it is not a total fix.
Comment 2 Michael Weber (RETIRED) gentoo-dev 2010-11-27 23:27:08 UTC
Have you spoken to upstream about this?

+*fish-1.23.1-r1 (27 Nov 2010)
+
+  27 Nov 2010; Michael Weber <xmw@gentoo.org> +fish-1.23.1-r1.ebuild,
+  +files/fish-1.23.1-fish_indent.patch:
+  Revbump to optionally include identation patch from James Bowlin
+  <bowlin@mindspring.com> (bug 346509). Thanks
+
Comment 3 James Bowlin 2010-11-28 00:39:18 UTC
Yes, I contacted upstream and joined their mailing list.  My patch sucks (but it is better than the unpatched version).  They are working on a much much better patch.  There is active development going on in other areas too.  I joined in to make the help system more robust especially on the virtual consoles.  I expect the next release to be a big improvement.  Better patches are available now but I suggest we wait a few days for the patch development to stabilize.

If you are in a hurry (or just curious), I think you can get patches from their mailing list archive: http://dir.gmane.org/gmane.comp.shells.fish.user