ocaml / ocaml/dune

allow dashes (and possibly other valid path symbols) in the site names

Open
#6,017 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

config package management
Dominant language
OCaml
Stars
1.9k
Forks
500
Avg merge
15h 21m
Merged PRs (30d)
277

Description

Desired Behavior

The following shall be accepted:

(install
  (files stdio.lisp)
  (package bap-primus-lisp)
  (section (site (bap site-lisp))))

Instead, it fails with

File "plugins/primus_lisp/site-lisp/dune", line 4, characters 22-31:
4 |   (section (site (bap site-lisp))))
                          ^^^^^^^^^
Error: "site-lisp" is an invalid site name.
Module names must be non-empty and composed only of the following characters:
'A'..'Z', 'a'..'z', '_', ''' or '0'..'9'.
Hint: site_lisp would be a correct site name

The justification is that dashes are commonly used as word separators in UNIX paths and allowing dashes (and other symbols) will make it easier (and possible) to integrate with the existing packages.

I understand that the site name will be used as an OCalm identifier, but paths could be normalized, e.g., dashes could be translated to underscores, e.g., val Sites.site_lisp : string = ".../share/bap/site-lisp.

Alternatively, the syntax of the site specification could be extended to accept a path string, e.g.,

(package
  (name bap)
  (sites (lib plugins)
         (share lisp)
         (share (site_lisp as "site-lisp")) ;; like this
         (share semantics)))

Though a quick glance to the implementation suggests that it will be a much more invasive change. It also opens a pandora's box of path canonicalization and security issues, e.g., (site_lisp as "/etc/passwd").

Also, if you have any immediate workarounds for installing files at other packages locations that are not constrained with the site module, I will be happy to hear about them.

Contributor guide

Open the contributing guide

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 with plugins/primus_lisp/site-lisp/dune and the failing site-name validation shown in the report. Trace how the site name becomes Sites.site_lisp, then determine whether the supported change is allowing dashes with normalization or adding the proposed path-string syntax. Done means the reported site declaration is accepted without compromising path safety.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.