Fish-shell: recent math changes break on BSD

Created on 9 Jan 2017  ·  3Comments  ·  Source: fish-shell/fish-shell

While testing recent PRs on FreeBSD 12 and Dragonfly BSD I noticed the math test is failing:

Testing file math.in ... fail
Output differs for file math.in. Diff follows:
--- math.tmp.out        2017-01-08 17:03:08.345651000 +0000
+++ math.out    2017-01-08 16:43:30.925313000 +0000
@@ -6,4 +6,4 @@
 4
 2
 .499999
-12332423423534534634589723498734892739848732894729147128947918247129\ 42
+1233242342353453463458972349873489273984873289472914712894791824712942
bug regression

Most helpful comment

BTW, The string command is really awesome as it makes dealing with this, as with so many related problems, much, much cheaper and simpler than it would otherwise be. Thank you, @msteed and company for implementing it.

All 3 comments

The result I've observed plus this discussion, http://stackoverflow.com/questions/31732348/how-to-disable-line-breaks-in-bc, shows that on BSD bc does not recognize the BC_LINE_LENGTH env var (also verified using strings /usr/bin/bc) and uses a default length of 70. Do we want to

1) Reinstate the multi-line joining?

2) Document the limit of 69 digits (plus newline equals 70 chars per line).

Okay, I see we don't have to limit ourselves to the two options I listed above. We can optimize for the usual case and still support really long numbers. PR will be ready for review in a couple of minutes (just waiting for the FreeBSD test to finish).

BTW, The string command is really awesome as it makes dealing with this, as with so many related problems, much, much cheaper and simpler than it would otherwise be. Thank you, @msteed and company for implementing it.

Was this page helpful?
0 / 5 - 0 ratings