bc version has issue with \r when run from cmd

Duncan Roe duncan_roe@optusnet.com.au
Mon Oct 24 12:17:00 GMT 2016

On Sun, Oct 23, 2016 at 06:19:31PM -0400, Andrew Schulman wrote:
> > >From: "L. A. Walsh" <cygwin at tlinx dot org>
> > >Date: Sat, 22 Oct 2016 15:52:42 -0700
> >
> > To L.A. Walsh.
> >
> > I understand all that but what i'm saying is that version 1.06  (not
> > 1.06.95, which cygwin is using, but 1.06, which Gow uses), So, version
> > 1.06   Doesn't have a problem with the fact that cmd sends a \r   So,
> > if one doesn't want to call it a bug,  then one can call it a lost
> > feature, useful feature of 1.06 (allowing bc to conveniently also be
> > used from cmd), and that beneficial flexible feature was lost in
> > 1.06.95
> Hi. I adopted the bc package about a year ago, since fish uses it and I maintain
> fish for Cygwin.
> I think L.A. is right that because this is an issue of integration between
> Cygwin and cmd, it's in the category of a nice-to-have feature. But I get that
> it would be useful for you, and maybe for others too.
> I haven't looked at the bc source code. It could take some time to find where
> the issue is.  A place to start would be to compare the code archives:
> http://ftp.gnu.org/gnu/bc/bc-1.06.tar.gz
> http://alpha.gnu.org/gnu/bc/bc-1.06.95.tar.bz2
> If you were to localize the problem in the source code and even propose a patch,
> that would make it a lot more likely to get the problem fixed. Heck, you might
> even get a gold star. I maintain the gold star page too :)
> Andrew
Hi Andrew,

I don't think it's a change to bc. I built and tried bc 1.06 under Linux and it
behaves the same (1.06.95 was released about 10 years ago BTW):

  21:44:51$ ./bc --version
  bc 1.06
  21:53:24$ echo -e "scale=10; 4*a(1)\r"|./bc -l
  (standard_in) 1: illegal character: ^M
  21:59:04$ echo -e "scale=10; 4*a(1)"|./bc -l

On debugging ./bc, I found this:

  Breakpoint 2, yyparse () at /usr/gnu/share/bison.simple:254
  254     /usr/gnu/share/bison.simple: No such file or directory.
  (gdb) fin
  Run till exit from #0  yyparse () at /usr/gnu/share/bison.simple:254
  (standard_in) 1: illegal character: ^M
  main (argc=1, argv=0xbfffeb34) at main.c:262
  262       if (compile_only)
  Value returned is $1 = 0

So it would seem that the new error is a consequence of some update to flex or
bison in the last 10 years. Does Gow have a patched flex or bison? Or maybe
their bc build is just very old?

Cheers ...  Duncan.

Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

More information about the Cygwin mailing list