Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect (or Cd) should have an option/variant that computes paths relative to the directory of the .vo file #8649

Closed
JasonGross opened this issue Oct 3, 2018 · 2 comments · Fixed by #17392
Labels
kind: enhancement Enhancement to an existing user-facing feature, tactic, etc.
Milestone

Comments

@JasonGross
Copy link
Member

Version

8.8.1

Operating system

Linux

Description of the problem

Currently Redirect does not work with relative paths. If I do Redirect "foo" Check I. interactively, the file foo.out in the current directory gets written. However, if I put it in a .v file that is not at top-level, and invoke coqc on the .v file, it gets written to the current working directory. This makes Redirect effectively unusable in developments. I would like either an option or a variant of Redirect that takes the file path as relative to the location where the .vo file is being output. Alternatively (perhaps better), I'd like a command which is "cd to the directory where the .vo file is being output", or "cd to this directory relative to where the .vo file is being output".

See also #4953

@JasonGross JasonGross added the kind: enhancement Enhancement to an existing user-facing feature, tactic, etc. label Oct 3, 2018
@JasonGross
Copy link
Member Author

(I am reporting this because I just ran into a case where Redirect "/tmp/foo" is unusable: if multiple users are building the same project on the same machine, it will give a "permission denied" error on trying to write to the file in /tmp.)

andres-erbsen added a commit to mit-plv/fiat-crypto that referenced this issue Oct 10, 2018
find . -name '*.v' -print0 | xargs -0 sed -i 's/^\(\s*\)\(Redirect.*\.\)$/\1(* \2 *)/g'

When on a shared machine, the first user would create /tmp/outfile and
then the build would fail for the second user because the file already
exists and is owned by somebody else.

coq/coq#8649

tested ok on top of c4e0929
@andres-erbsen
Copy link
Contributor

At least it seems to be possible to create per-user paths:

Welcome to Coq 8.8.2 (October 2018)

Coq < Cd "~".
/home/browse

I still think that Redirect does not really make sense of a vernac command (#4953) and I am guessing all use cases are (in the long run) better served by redirecting the output of coqc in Makefile (or improving the interaction protocol, as I think was the case with the original motivation for adding redirect).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: enhancement Enhancement to an existing user-facing feature, tactic, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants