Opened 9 years ago

Closed 9 years ago

#12487 closed defect (fixed)

sdist in /tmp/sage-sdist-$$/sage-VERSION

Reported by: jdemeyer Owned by: leif
Priority: major Milestone: sage-5.0
Component: scripts Keywords:
Cc: Merged in: sage-5.0.beta6
Authors: Jeroen Demeyer Reviewers: Volker Braun
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

Currently, sage-sdist uses

/tmp/sage-VERSION

as temporary directory, leading to all sorts of race conditions.

I propose to use instead

/tmp/sage-sdist-$$/sage-VERSION

Attachments (1)

12487.patch (5.2 KB) - added by jdemeyer 9 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 9 years ago by jdemeyer

  • Authors set to Jeroen Demeyer
  • Status changed from new to needs_review

comment:2 Changed 9 years ago by vbraun

  • Reviewers set to Volker Braun

Why not go all the way and use

TOP=`mktemp "${TMPDIR:-/tmp}/sage-sdist-XXXXX"`

This would then also be safe on multi-user systems regardless of umask.

comment:3 follow-up: Changed 9 years ago by jdemeyer

I just don't know about the portability of "mktemp"...

comment:4 in reply to: ↑ 3 Changed 9 years ago by jhpalmieri

The various options for mktemp are not very portable, but the above command seems to work on linux, Darwin, and OpenSolaris.

comment:5 Changed 9 years ago by jdemeyer

  • Status changed from needs_review to needs_work

Well, we need the "-d" option for directory, but that seems to work also.

Changed 9 years ago by jdemeyer

comment:6 Changed 9 years ago by jdemeyer

  • Status changed from needs_work to needs_review

Volker, I made the change you suggested. Needs review.

comment:7 Changed 9 years ago by vbraun

  • Status changed from needs_review to positive_review

Apparently mktemp isn't POSIX (!?!) but then without it you can't securely create temp files (without the temp directory hack). So everybody in his right mind will have a version of mktemp, I'd say.

comment:8 Changed 9 years ago by jdemeyer

  • Merged in set to sage-5.0.beta6
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.