Re: pic anomalies

2020-01-01 Thread Ingo Schwarze
Hi Ralph, Ralph Corderoy wrote on Mon, Dec 30, 2019 at 06:31:34PM +: > Ingo Schwarze wrote: >> * line 1896, while (*form): >>Testing char as if it were boolean seems dubious style to me; >>"while (*form != '\0')" would seem clearer because it makes the >>data type obvious on firs

Re: pic anomalies

2019-12-31 Thread Ingo Schwarze
Hi Doug, Doug McIlroy wrote on Tue, Dec 31, 2019 at 10:39:53AM -0500: > It looks like Ralph has turned up a really strange bug in pic > that suppresses pic's usual diagnosis of a bare % in a format. > > The example can be boiled down to > sprintf("%g% %",1) > which produces > 1%

Re: pic anomalies

2019-12-31 Thread Doug McIlroy
> Getting back on topic, are we sure we want to deviate from GNU pic's > current behaviour without checking historical norms of other pics? > > $ printf '%s\n' \ > .PS 'print sprintf("%.17g %.0f% % %%", 3.14, 42, 99)' .PE | > > pic >/dev/null > 3.1401 42% % %% > > Th

Re: pic anomalies

2019-12-30 Thread Colin Watson
On Mon, Dec 30, 2019 at 06:31:34PM +, Ralph Corderoy wrote: > It's idiomatic in C to write just `foo' to test it against its `zero > value' whether it's an int, pointer, etc. This argument holds less well in this case because do_sprintf has several other comparisons to '\0'; so I'd be inclined

Re: pic anomalies

2019-12-30 Thread Ralph Corderoy
Hi Ingo, > * line 1896, while (*form): >Testing char as if it were boolean seems dubious style to me; >"while (*form != '\0')" would seem clearer because it makes the >data type obvious on first sight. It's idiomatic in C to write just `foo' to test it against its `zero value' whethe

Re: pic anomalies

2019-12-30 Thread Colin Watson
On Mon, Dec 30, 2019 at 01:39:38PM +0100, Ingo Schwarze wrote: > An extremely small number of tests (14 tests grand total) is scattered > all around the groff source tree, for example: > > - contrib/gdiffmk/tests/gdiffmk_tests.sh > - contrib/hdtbl/examples/test-hdtbl.sh.in > - contrib/mom/examp

Re: pic anomalies

2019-12-30 Thread Ingo Schwarze
Hi Larry, Larry McVoy wrote on Sun, Dec 29, 2019 at 03:23:33PM -0800: > On a different topic, is there any sort of test suite for pic > and the other parts of roff? I'm not aware of any tests for pic(1), anywhere. An extremely small number of tests (14 tests grand total) is scattered all around

Re: pic anomalies

2019-12-30 Thread Ingo Schwarze
Hi Colin and Larry, Colin Watson wrote on Sun, Dec 29, 2019 at 11:17:26PM +: > LGTM as far as it goes. thanks to both of you for checking, i have put it in. > If I were doing it I think I'd take the opportunity to simplify it > a little further into this sort of structure: As i said, i dis

Re: pic anomalies

2019-12-29 Thread Larry McVoy
On Sun, Dec 29, 2019 at 11:17:26PM +, Colin Watson wrote: > if (*form == '%') { > form++; > result += '%'; > } > else { > ... > snprintf(sprintf_buf, sizeof(sprintf_buf), > one_format.contents(), v[i++]); > result += sprintf_buf; > } > one_format.clear

Re: pic anomalies

2019-12-29 Thread Colin Watson
On Sun, Dec 29, 2019 at 04:33:59PM +0100, Ingo Schwarze wrote: > Regarding the bugfix in the code, thanks to Larry McVoy for > providing feedback directly to me. In particular, he suggested > that while my fix wasn't incorrect, the two lines immediately > following it can be simplified, making the

Re: pic anomalies

2019-12-29 Thread Ingo Schwarze
Hi, i pushed the documentation improvements because they were ready and esr@ OK'ed them. Regarding the bugfix in the code, thanks to Larry McVoy for providing feedback directly to me. In particular, he suggested that while my fix wasn't incorrect, the two lines immediately following it can be si

Re: pic anomalies

2019-12-28 Thread Michael Kerrisk (man-pages)
Hello Federico, hello (again) Doug, This isn't a manual page that I maintain. See http://man7.org/linux/man-pages/man1/pic.1.html#COLOPHON. I suspect "3. An error in pic itself". Thanks, Michael On Fri, 27 Dec 2019 at 19:31, Federico Lucifredi wrote: > > Hello Doug, > for (1), I am CCing Mi

Re: pic anomalies

2019-12-28 Thread Ingo Schwarze
Hi Ralph, Ralph Corderoy wrote on Sat, Dec 28, 2019 at 11:48:19AM +: > Ingo Schwarze wrote: >> +Only the flags >> +.RB ' # ', >> +.RB ' \- ', >> +.RB ' + ', > Why use an ASCII quote on both sides? My bad, i'm no longer used to writing with the 1979 UNIX v7 man(7) macros; but now that you as

Re: pic anomalies

2019-12-28 Thread Ralph Corderoy
Hi Ingo, > +Only the flags > +.RB ' # ', > +.RB ' \- ', > +.RB ' + ', Why use an ASCII quote on both sides? pic(1) uses Unicode's ‘’ in similar context. -- Cheers, Ralph.

Re: pic anomalies

2019-12-27 Thread Eric S. Raymond
Ingo Schwarze : > Hi Eric, > > Eric S. Raymond wrote on Fri, Dec 27, 2019 at 09:48:16PM -0500: > > > Yeah, that was a typo or markup error on my part. I intended %%. > > Whoever takes on the pic bug is encouraged to fix this in the same > > commit. > > > > I apologize for not being able to take

Re: pic anomalies

2019-12-27 Thread Ingo Schwarze
Hi Eric, Eric S. Raymond wrote on Fri, Dec 27, 2019 at 09:48:16PM -0500: > Yeah, that was a typo or markup error on my part. I intended %%. > Whoever takes on the pic bug is encouraged to fix this in the same > commit. > > I apologize for not being able to take this one myself. I like > pic wel

Re: pic anomalies

2019-12-27 Thread Eric S. Raymond
Doug McIlroy : > The description of sprintf in the man page pic(1) does not > reveal that only a few format codes are permitted. > > Eric Raymond's "Making Pictures With GNU PIC" says only > %,%e,%f,%g are permitted. But what does a bare % mean? > > In fact pic rejects a bare %. However it does

Re: pic anomalies

2019-12-27 Thread Federico Lucifredi
My bad — I should have checked the ownership of the page itself. Maintaining man (1) makes me the recipient of many similar bug reports that need redirection, and I have a fast trigger finger as a result. Thanks for setting me straight. Best-F Sent from my iPhone. > On Dec 27, 2019, at 2:18

Re: pic anomalies

2019-12-27 Thread Steffen Nurpmeso
Ingo Schwarze wrote in <20191227212705.gi66...@athene.usta.de>: |Hi Doug, | |Steffen Nurpmeso wrote on Fri, Dec 27, 2019 at 06:45:23PM +0100: | |> Should be handled by [...] | |I believe the first patch that got sent to the list is incorrect. | |The parser in src/pre-pic/pic.y already pars

Re: pic anomalies

2019-12-27 Thread Ingo Schwarze
Hi Doug, Steffen Nurpmeso wrote on Fri, Dec 27, 2019 at 06:45:23PM +0100: > Should be handled by [...] I believe the first patch that got sent to the list is incorrect. The parser in src/pre-pic/pic.y already parses '%%' correctly, so there is no need to change the parsing. Only the assignment

Re: pic anomalies

2019-12-27 Thread Ingo Schwarze
Hi Federico, Federico Lucifredi wrote on Fri, Dec 27, 2019 at 01:31:00PM -0500: > for (1), I am CCing Michael Kerrisk fortunately, you forgot to, unless you used Bcc:. > and the procedure to report issues on the man pages is tracked here > https://www.kernel.org/doc/man-pages/reporting_bugs.htm

Re: pic anomalies

2019-12-27 Thread Federico Lucifredi
Hello Doug, for (1), I am CCing Michael Kerrisk — and the procedure to report issues on the man pages is tracked here https://www.kernel.org/doc/man-pages/reporting_bugs.html (In brief: email mtk.manpa...@gmail.com and CC linux-...@vger.kernel.org). Best -Federico > On Dec 27, 2019, at 1

Re: pic anomalies

2019-12-27 Thread Steffen Nurpmeso
Doug McIlroy wrote in <201912271608.xbrg84jr128...@tahoe.cs.dartmouth.edu>: |The description of sprintf in the man page pic(1) does not |reveal that only a few format codes are permitted. | |Eric Raymond's "Making Pictures With GNU PIC" says only |%,%e,%f,%g are permitted. But what does a bar