Macaulay2 / Macaulay2/M2

Add temporaryDirectory, alongside a way to remove a directory and its contents

Open
#4,548 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bugs directory Core
Dominant language
Macaulay2
Stars
435
Forks
297
Avg merge
4d 20h
Merged PRs (30d)
11

Description

This issue was triaged from bugs/dan/0.5-temporaryDirectory, one of the 857 files removed from the pre-GitHub bugs/ tree by d2c8d27826 and catalogued in #36. The commentary below was written by Claude (Claude Opus 5, via Claude Code), not by @d-torrance, whose account posted it -- please weigh it accordingly.

The original file, verbatim
Provide this function to the user:

    	temporaryDirectory = () -> while true do try (dn := temporaryFileName(); makeDirectory dn; return dn)

and also a function for removing it and its contents
Where it stands today

Not provided. temporaryDirectory does not exist, though removeDirectory does — so of the pair the
file asks for, only the removal half is available, and it removes an empty directory rather than a
directory and its contents.

The file supplies the implementation
temporaryDirectory = () -> while true do try (dn := temporaryFileName(); makeDirectory dn; return dn)

The retry loop is the point: temporaryFileName can collide, and makeDirectory on an existing path
fails, so the loop is what makes the result safe to use.

Why both halves are wanted

A package that needs scratch space today either invents its own loop or writes into a name from
temporaryFileName without creating a directory, and cleaning up afterwards requires walking the
contents by hand. Both are the sort of thing that should exist once in Core rather than once per package.

Notes for whoever picks this up

The removal half wants care: a recursive delete taking a directory name is a foot-gun, so it is worth
restricting it to directories this function created, or requiring the path to lie under the temporary
directory root.

open · disposition issue · source of truth: bug-triage/catalog.tsv

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing temporaryFileName, makeDirectory, and removeDirectory entry points in Core and review how temporary paths are handled. Define the safe behavior for creating a unique temporary directory and removing its contents, then verify both operations and their failure cases with the project's relevant tests.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.