Ticket #10264 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

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 Work issues:
Report Upstream: N/A Reviewers: Mitesh Patel
Authors: Jeroen Demeyer Merged in: sage-4.6.1.alpha2
Dependencies: Stopgaps:

Description (last modified by jdemeyer) (diff)

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

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

Change History

comment:1 Changed 3 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 3 years ago by jdemeyer

  • Description modified (diff)

Changed 3 years ago by jdemeyer

comment:3 follow-up: ↓ 4 Changed 3 years ago by mpatel

Ticket #9970 is a duplicate, I think.

comment:4 in reply to: ↑ 3 Changed 3 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 3 years ago by jdemeyer

  • Merged in set to sage-4.6.1.alpha2

comment:6 Changed 3 years ago by jdemeyer

  • Cc mpatel added

Mitesh, can you review this?

comment:7 Changed 3 years ago by mpatel

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

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 3 years ago by jdemeyer

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