-
Notifications
You must be signed in to change notification settings - Fork 6
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
register.rkt
breaks build in some environments
#73
Comments
Thanks for the report and the insights! I'll use byte-strings for paths in the library. (Though I can't see a case where using the local representation would fail, because that would mean sharing a file written for one OS to another OS where DrR is running, which seems rather implausible, and asking for trouble, if at all possible. That's an easy fix anyway.) This register business is annoying indeed, I need to replace it. I didn't know about Regarding cleaning up, the racket uninstall doesn't clean up the prefs and config directories either, because otherwise preferences would be lost when installing a new version (which asks for uninstalling the previous one). I'm not sure what you are suggesting here though. From my point of view as a user, sharing the QS library between Racket versions and installations is the intended behaviour. If you have other use cases, let me know. |
@spdegabrielle FYI |
Cases where strings don't work are admittedly strange, but there are paths which are not representable as strings:
For scripts that are not installed using the Racket package system, that sharing seems right. The scenario I was envisioning is that a user of Racket 8.9 does
That's part of why I think that, for scripts distributed in Racket packages, "registration" should use a mechanism like
I'd be willing to draft a PR, potentially. The aspects I'm least sure of are what constitutes Quickscript's "public API" and what the compatibility considerations are. |
👍
👍
This is correct indeed, see here
Awesome!
Since this mechanism is broken anyway, I think it's fair to consider changing it a bug fix. There are only 3 cases I know of that use this registration mechanism: quickscript itself, quickscript-extra, quickscript-competition-2020, which are all managed by Stephen and myself. |
In that case, maybe we can greatly simplify the library mechanism. It seems like we need:
Are there any other kinds of locations needed? It seems like we could defer almost all configuration to the package system, especially if we make it convenient. |
Things may be a little more complicated than this though. There's one other piece that needs to be taken into account: shadow scripts Currently, script directories in the library are simply a set of 'known' paths. If we are to use the Or maybe you're thinking of something else? |
I just ran into an issue with quickscripts and the issues of finding scripts in another context and it may also be relevant to the discussion here. Specifically, in my development (git-based) build of drracket, I recently got this error:
What seems to be happening here is that an old version installed in my /Applications directory (that is, a system wide place where applications are installed in macos) I have installed the It could make sense if qi had been installed in a global place (but then the path in the error message, pointing at qi, would have been different), but since it wasn't, it seems like quickscript shouldn't be looking for quickscripts there. |
Quickscripts are intended to be shared among all Racket versions and installations. This has historically meant that the first thing that happens when you upgrade is a wrong version error because scripts were compiled for a different version of racket Register is intended to install ‘open terminal here’ and ‘eyes’ commands as part of the base install. Sadly this does not work (I thought I tested it successfully but I managed to fool myself) i will do an immediate PR to remove register.rkt Going forward I am wondering if installation via the package system should be retired given there is an alternate installation mechanism? |
It seems to me that quickscripts via pkgs is very useful! Perhaps there should be a distinction between quickscripts that come in via the user using the GUI and quickscripts that come in via a pkg installation. If they are coming with the package, then they follow the same rules for finding code in the package (which can be accomplished by using the setup/get-info library) and if they are being installed by the user directly via the quickscript GUI in DrRacket, they can be more global? |
I'm assuming you mean using #lan info
[...]
(define scripts '(("scripts/" ()))) ; script directories relative to the collection path (like scribblings) If I understand correctly this doesn't resolve the Guix problem because Guix expects packages to be immutable for good reasons. I agree installation via package is useful and I was wrong the alternate method of installation is Package installation of scripts is not without it's problems; I mentioned that starting DrRacket after an upgrade is met with compilation errors; another problem is It is a constant disappointment to me that new users of DrRacket almost never discover the scripts functionality that @Metaxal created for DrRacket. I'm always looking for social and technical solutions to this problem. The Qi-Quickscripts package is one approach. Quickscripts competition(2020) was another. I really thought I hit on a winner with Add register.rkt eyes and open terminal - real scripts that are useful and demonstrate some of the capabilities 'out of the box' - but as I mentioned before I failed to test it effectively and fooled myself into thinking register.rkt would work on the quickscript package itself. :-( I'm home tonight so - instead of watching television - I'll compose an 'Opinionated guide to scripting DrRacket', and try work out how I can get the core library to copy scripts direct into the user |
I think we should solve these problems "not by piling feature on top of feature, but by removing the weaknesses and restrictions that make additional features appear necessary." It seems like we have identified several problems with
The solution to these problems seems to be making better use of existing features—in particular, the To the extent that I understand it, I think a better approach here would also solve this aspect of #73 (comment):
The scenario I'm imaging when that would happen is that you install some package providing Quickscripts, which would install its dependencies as usual, and then you update Racket, but you don't run While I think a replacement for
I think this issue affects scripts in |
Just to be clear, I think that:
Additionally, note that
|
and also I'm definitely happy to discuss a new proposal even if it doesn't check all the boxes for now! |
While the main issue raised in this report is fixed by fe3040d, I'll keep this thread open as it goes much deeper than just quickscript's own |
Idea (based on the above): Then it open a dialog to ask the user if they want to add the found collection to the list of paths in the library, with a dialog box and checkboxes. This way we retain most of the previous code and the flexibility of the library while avoiding the faulty |
I've started prototyping something somewhat similar in spirit.
I think it would be better to avoid requiring a separate step to actually make scripts available that were installed from a package. That would complicate matters for a sysadmin or distributor trying to make certain scripts available by default. If a user doesn't want specific scripts, they already have the option to exclude them. |
I could also imagine |
Since this is going to involve a change to the saved library format, how would you feel about adopting the |
I think it is a good idea to use the framework preferences system (it is
heavily used by DrRacket already).
Robby
|
Closes Metaxal#73 (when finished)
I've opened #81 with some work in progress. |
Then maybe just
Good. One issue though: quickscript-test comes with a bunch a scripts that should loaded only when running the test suite. So these scripts must be excluded by default. How could this happen? The new mechanism also requires the creation of a collection to be able to add a directory with scripts. It's heavier than the un/register approach and can't be done (easily) directly within the library GUI I suspect. I suppose we could have both: (i) explicit exclusions of (i) would be for collections and (ii) would be for non-collections. Thoughts?
👍 Reminders:
|
I'll try to reply to this in #81 to keep discussion in one place. |
The addition of
register.rkt
in #72 breaks building Quickscript (as part of the Racket 8.11 release) in Guix, because, in our build environment, the current user's home directory does not exist and cannot be created.I can work around this by setting
PLTUSERHOME
or patching outregister.rkt
(which is what I plan to do, to avoid masking other errors), but, as I've looked into the underlying problem, I don't thinkregister.rkt
is really working as intended in any case. The problem is even broader because the documentation recommends this approach:Here is the code:
quickscript/register.rkt
Lines 6 to 10 in 5243a87
AIUI, it tries to write to
library-file
as a side-effect when the moduleregister.rkt
is visited in the sense of "Module Expansion, Phases, and Visits". Sinceregister.rkt
is otherwise unused, the module is visited only when it is compiled byraco setup
. But this means that the side-effect only happens for the user who is compiling the module. It seems the side-effect won't happen at all for someone who installed Quickscript as part of a built Racket release.For scripts distributed as Racket packages, it seems like a better mechanism would be to specify an
info.rkt
key for packages to define and to usefind-relevant-directories
.Some other questionable things I noticed in the process:
PLTQUICKSCRIPTDIR
is not set,library-file
will be(build-path (find-system-path 'prefs-dir) "quickscript/library.rktd")
, so it is shared among all Racket versions and installations. Whileregister.rkt
attempts to register a new directory on setup, there seems to be no attempt to clean up on uninstallation—and any such attempt would be unreliable, anyway, since "uninstallation" might meanrm -r
.racket/fasl
would be more robust alternatives.The text was updated successfully, but these errors were encountered: