cms-dev / cms-dev/cms

Add support for C# compiled by .NET SDK

Open
#1,243 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature_request sandbox
Dominant language
Python
Stars
1k
Forks
412
Avg merge
6d 10h
Merged PRs (30d)
3

Description

I tried adding support for C# compiled by .NET SDK 7.0. I have a very preliminary version running in the Czech national olympiad, but before I submit a pull request, I would like to discuss some problems I stumbled upon and agree on how they should be solved properly.

(1) Permission problems. The dotnet compiler creates a whole forest of intermediate directories, often with restrictive permissions. This hits the issue #1242. I worked around this by creating a temporary directory within /box and symlinking it as obj in the current directory.

(2) User lookup problem. The compiler expects that the current UID has an entry in /etc/passwd. With a typical installation of Isolate (as installed by CMS installation scripts), the sandbox users don't have their entries. As CMS bind-mounts /etc in compilation sandboxes, this can be worked around by adding all sandbox users to /etc/passwd of the host system. I wonder if this has a nicer solution...

(3) To use dotnet build, one must create a *.cproj project file first. I figured out how to do it, but not how to integrate it nicely with the CMS language modules: they allow generating compilation commands, but I would rather need to call a Python function which would generate the file and put it in the sandbox directory. I worked around it by calling a helper script, but then we have to install the helper script to a location which is available inside the sandbox (e.g., /usr/local/bin), which is different from where we install the CMS itself (in my case, it's a virtual environment).

(4) I need to modify some parameters of the sandbox: increase the maximum number of open files, pass some extra environment variables, possibly bind-mount more directories. I did it by adding these options to all languages, but it would be really nice to have them per-language. I handled environment variables in the helper script for the time being.

I would appreciate any ideas on how to solve these problems in an upstreamable way.

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

Read the CMS language modules and sandbox configuration entry points first, along with issue #1242. The work is not yet a defined implementation: it needs an agreed upstreamable approach for permissions, user lookup, project-file generation, and per-language sandbox settings.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, python
Domain
build-system, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.