Opened 8 years ago

Closed 8 years ago

#10264 closed defect (fixed)

Doctest for r.chdir() should use realpath

Reported by: jdemeyer Owned by: mvngu
Priority: critical Milestone: sage-4.6.1
Component: doctest coverage Keywords:
Cc: mpatel Merged in: sage-4.6.1.alpha2
Authors: Jeroen Demeyer Reviewers: Mitesh Patel
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by jdemeyer)

The following test from sage/interfaces/r.py breaks when $TMPDIR (by default /tmp) is a symbolic link:

        EXAMPLES::

            sage: import tempfile
            sage: tmpdir = tempfile.mkdtemp()
            sage: r.chdir(tmpdir)

        On Linux, we could use ``tmpdir == sageobj(r.getwd())``
        to test this, but Mac prepends ``/private/`` to such
        directories, so we check that the directory name string
        is in the working directory string instead::

            sage: tmpdir in sageobj(r.getwd())
            True

Attachments (1)

10264_tmpdir_realpath.patch (1.2 KB) - added by jdemeyer 8 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 8 years ago by jdemeyer

  • Status changed from new to needs_review

Tested on Linux with

$ sudo ln -s /tmp /special
$ env TMPDIR=/special sage -t sage/interfaces/r.py

Tested on OS X 10.4 (where /tmp is a symlink to /private/tmp) with

$ sage -t sage/interfaces/r.py

comment:2 Changed 8 years ago by jdemeyer

  • Description modified (diff)

Changed 8 years ago by jdemeyer

comment:3 follow-up: Changed 8 years ago by mpatel

Ticket #9970 is a duplicate, I think.

comment:4 in reply to: ↑ 3 Changed 8 years ago by mpatel

Replying to mpatel:

Ticket #9970 is a duplicate, I think.

Or a different problem with the same doctest.

comment:5 Changed 8 years ago by jdemeyer

  • Merged in set to sage-4.6.1.alpha2

comment:6 Changed 8 years ago by jdemeyer

  • Cc mpatel added

Mitesh, can you review this?

comment:7 Changed 8 years ago by mpatel

  • Reviewers set to Mitesh Patel
  • Status changed from needs_review to positive_review

The patch looks good. I tested it successfully on bsd.math (OS X 10.6), sage.math (Ubuntu 8.04.4 LTS), and fulvia.skynet (SunOS 5.10) with TMPDIR unset, set to a path with no symbolic links, and set to a path with a link.

comment:8 Changed 8 years ago by jdemeyer

  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.