Unable to run doctests with Ubuntu 17.10

35 views
Skip to first unread message

Travis Scrimshaw

unread,
Mar 11, 2018, 12:27:52 AM3/11/18
to sage-devel
Hey everyone,
   I just upgraded my version of Ubunutu from 16.04 LTS to 17.10, and I can no longer run doctests with 8.2.beta8:

travis@apricot:~/sage-build$ ./sage -t src/sage/combinat/partition.py
too many failed tests
, not using stored timings
Traceback (most recent call last):
 
File "/home/travis/sage-build/src/bin/sage-runtests", line 127, in <module>
    err
= DC.run()
 
File "/home/travis/sage-build/local/lib/python2.7/site-packages/sage/doctest/control.py", line 1138, in run
   
self.test_safe_directory()
 
File "/home/travis/sage-build/local/lib/python2.7/site-packages/sage/doctest/control.py", line 609, in test_safe_directory
   
.format(os.getcwd()))
RuntimeError: refusing to run doctests from the current directory '/home/travis/sage-build' since untrusted users could put files in this directory, making it unsafe to run Sage code from

I also tested this with version 8.1.beta3 I happen to also have on my system. I get an error message of the form

sys:1: RuntimeWarning: not adding directory '' to sys.path since it's writable by an untrusted group.
Untrusted users could put files in this directory which might then be imported by your Python code. As a general precaution from similar exploits, you should not execute Python code from this directory

and then it seems to be very poorly handled after that. I also get:

travis@apricot:~/sage$ ./sage
sys
:1: RuntimeWarning: not adding directory '' to sys.path since it's writable by an untrusted group.
Untrusted users could put files in this directory which might then be imported by your Python code. As a general precaution from similar exploits, you should not execute Python code from this directory

which I do not get with 8.2.beta8.

Any ideas on how to fix this? Of course, I could change the permissions of the folder(s), but that feels like bringing a bazooka to a fist fight.

Thanks,
Travis

Jeroen Demeyer

unread,
Mar 11, 2018, 4:25:15 AM3/11/18
to sage-...@googlegroups.com
What are the permissions of the directory where you installed Sage and
what is your umask?

Travis Scrimshaw

unread,
Mar 11, 2018, 6:32:10 PM3/11/18
to sage-devel


On Sunday, March 11, 2018 at 6:25:15 PM UTC+10, Jeroen Demeyer wrote:
What are the permissions of the directory where you installed Sage and
what is your umask?

The file permissions on my desktop (Ubuntu 16.04 LTS) are the same as my laptop (Ubuntu 17.10). However, there is a umask difference

desktop: 0002
laptop: 0022

When I set the umask of my laptop to 0002, then I can run doctests. However, 0002 makes the created files/directories more permissive by making it group writable. So this seems like a bug in Sage to me; at least it contradicts the error message...

Best,
Travis

Jeroen Demeyer

unread,
Mar 11, 2018, 6:44:23 PM3/11/18
to sage-...@googlegroups.com
On 2018-03-11 23:32, Travis Scrimshaw wrote:
> When I set the umask of my laptop to 0002, then I can run doctests.
> However, 0002 makes the created files/directories /more/ permissive by
> making it group writable. So this seems like a bug in Sage to me; at
> least it contradicts the error message...

It doesn't really contradict the error message, it's just how you look
at it. I am checking permissions relative to the umask.

If your umask is 0002, it means that you consider your group trusted. If
your umask is 0022, then your group is untrusted.

Travis Scrimshaw

unread,
Mar 11, 2018, 6:58:56 PM3/11/18
to sage-devel

Ah, I see; that makes sense. Thank you for the pointer to umask.

I've been trying to figure out what changed between these Ubuntu versions that led to this change (I know I can fix it by adding a umask 0002 to my ~/.profile ), but I cannot find yet why. Anyways, that's not for sage-devel.

Best,
Travis

Reply all
Reply to author
Forward
0 new messages