-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix bug when displaying example errors #3460
Conversation
Why concatenate as opposed to stack? |
I played around with that, too. I stuck with concatenate & toString -- _bar.errors
-- ***********
-- -- -*- M2-comint -*- hash: 1330311532778
--
-- i1 : 1/0
-- stdio:1:1:(3): error: division by zero
-- _foo.errors
-- ***********
-- -- -*- M2-comint -*- hash: 1330311532778
--
-- i1 : 1/0
-- stdio:1:1:(3): error: division by zero stack -- _bar.errors
-- ***********
-- -- -*- M2-comint -*- hash: 1330311532778
--
-- i1 : 1/0
-- stdio:1:1:(3): error: division by zero
--
-- _foo.errors
-- ***********
-- -- -*- M2-comint -*- hash: 1330311532778
--
-- i1 : 1/0
-- stdio:1:1:(3): error: division by zero I have no strong opinion one way or the other. |
I think I slightly prefer the extra line? And also, what do you think about removing the first two lines. Is knowing the hash useful? |
We were trying to concatenate a list of nets, but "concatenate" expects a list of strings. So we use "stack" instead.
017cba2
to
bed7072
Compare
I switched it to use We need the hash information to determine whether we should regenerate cached examples on subsequent calls to |
Oh sorry I know why we use the hash, I meant is printing it useful for debugging? Like we could just skip printing the first two lines. |
Ah ok. We only see the hash for this example because it appears just before the error occurred. In general, it prints up to 9 lines before the error (assuming we can locate it using a regex): i3 : installPackage("Foo", FileName => "~/tmp/Foo.m2", Verbose => true)
-- installing package Foo in ../.Macaulay2/local/ with layout #1
-- using package sources found in ./
-- storing raw documentation in ../.Macaulay2/local/lib/x86_64-linux-gnu/Macaulay2/Foo/cache/rawdocumentation-dcba-8.db
-- new raw documentation, not already in database, for foo
-- closed the database
-- making example result files in ../.Macaulay2/local/share/doc/Macaulay2/Foo/example-output/
-- making example results for "foo"
ulimit -c unlimited; ulimit -t 700; ulimit -m 850000; ulimit -s 8192; ulimit -n 512; cd /tmp/M2-1902730-0/1-rundir/; GC_MAXIMUM_HEAP_SIZE=400M "/usr/bin/M2-binary" --no-randomize --no-readline --silent --stop --print-width 77 --srcdir "/home/profzoom/src/macaulay2/M2/M2" -e 'needsPackage("Foo",Reload=>true,FileName=>"/home/profzoom/tmp/Foo.m2")' <"/tmp/M2-1902730-0/0_foo.m2" >>"/home/profzoom/.Macaulay2/local/share/doc/Macaulay2/Foo/example-output/_foo.errors" 2>&1
/home/profzoom/.Macaulay2/local/share/doc/Macaulay2/Foo/example-output/_foo.errors:0:1:(3):[10]: (output file) error: Macaulay2 exited with status code 1
/tmp/M2-1902730-0/0_foo.m2:0:1: (input file)
M2: *** Error 1
-- 1.08838s elapsed
-- storing example results in ../.Macaulay2/local/share/doc/Macaulay2/Foo/example-output/_foo.out
-- warning: missing file /home/profzoom/.Macaulay2/local/share/doc/Macaulay2/Foo/example-output/_foo.out
-- _foo.errors
-- ***********
-- tristique nisl. Praesent augue. Fusce commodo. Vestibulum
-- convallis, lorem a tempus semper, dui dui euismod elit, vitae
-- placerat urna tortor vitae lacus. Nullam libero mauris,
-- consequat quis, varius et, dictum id, arcu. Mauris mollis
-- tincidunt felis. Aliquam feugiat tellus ut neque. Nulla
-- facilisis, risus a rhoncus fermentum, tellus tellus lacinia
-- purus, et dictum nunc justo sit amet elit.
--
-- i3 : 1/0
-- stdio:26:1:(3): error: division by zero
--
stdio:3:14:(3): error: installPackage: 1 error(s) occurred in running examples for package Foo |
We were trying to concatenate a list of nets, but
concatenate
expects a list of strings.Before
Consider the following simple package:
Of course, we get an error when installing it, but it's the wrong error!
After