-
Notifications
You must be signed in to change notification settings - Fork 2
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
cabal exec
may silently run previous version of project executable.
#57
Comments
Hadrian, the GHC build tool, also suffered from this. I asked (probably on #haskell) why Do you think |
Thanks Tom. I think this is a dismissal and not an answer, and unfortunately I find it to be exemplary of the general attitude of the developers of Cabal. I think Cabal should have a coherent user experience model from which such decisions may be derived, and also that there should be an open and persistent channel of communication that allows such a model to be iteratively improved on based on actual reports of user experience issues. In the case here, It is already not feasible to remember the variety of flags one may give to Cabal — before more flags are added, a way to discover them should be provided that is commensurate with the human cognitive ability. It is one thing to have flags for different compiler optimizations — you know where to look for when you need them and they make no difference up to performance. Adding corner cases to patch corner cases is another thing — a bad thing that we should not ask for. Also, I think possibilities for things to go wrong should be eliminated and not merely provided a way to work around of. It puzzles me to no end that, with all the ethos of «making invalid states irrepresentable», we close our eyes to the myriad of invalid states that are very much representable when it comes to human interaction with the prime Haskell build tool. This is not a singular case — there is a whole class of bugs waiting to be eliminated by construction. It would be strategically unwise to push for a small fix, because it being accepted would uphold the limbo of things being bad but not bad enough to bother fixing the problem at the root. |
Actually I do not buy the argument to optimization for machines to use. Why would a machine want to run a random version of an executable? It does not even exist as far as Cabal can see. I checked in another version control branch — end of story. Interference between different versions of a repository is forbidden in the version control paradigm. Human or machine — what difference does it make in this case? |
Well, there is a reason. From the --help:
So maybe you want to debug some build failure, or run ghc directly on your project's files, or run some tool that does not know about cabal. Especially in the first case, having cabal also do stuff, could interfere with your command, or possibly could prevent it from running altogether. By the way, since you do not need the build environment but only the executable, another option is |
Thanks Francesco. I do not think it follows from your argument that running a random version of an executable is a desirable feature. It does follow from your argument that it may be desirable to inspect the world through its eyes. The missing link is the assumption that Cabal itself needs to see a random version of an executable. I doubt that it does. Actually what I suggest is that it should not see any executables belonging to a project until it made sure all build artifacts are up to date. Being able to see these executables is an instance of being able to see an invalid state, so the general argument against invalid states applies.
So, perhaps a special command like |
I see where you're coming from. My point is that running executables, especially ones that are not build tools is more of an incidental feature of exec. It was inherited from v1-exec, before list-bin was a thing. Not exposing outdated executables is a cool idea. I wonder if anyone relies on the exe always being there, outdated or not.
That's Also, relevant cabal issue: haskell/cabal#7106 |
I do not find this as hilarious as you do.
To me that's an example of user experience that is not thought through. Incidentally this works. But is it officially supported? What exactly does it do behind the scenes? What are the guarantees? For example, is running This could be an awesome feature, but instead it is delegated to a special case of a special case.
In the case of Cabal, given my history of unsuccessful attempts at communication with the core developers, it is not reasonable for me to expect that, should I have any issues with the shell thus spawned, anyone on the team would take me seriously — I expect the issue to be immediately dismissed. A cool and safe top level feature should be provided instead of this hack. |
That was a half-joke. But this is off topic anyway. |
So what did we establish?
Please correct whatever does not faithfully represent your view. |
Oops, I forgot about this
Yes, and the same goes for list-bin I think the proper solution to the original issue would be to have an better verbosity control for
It's not that running shells is unsupported: it works the same with them as with other stuff. It's just that one has to be aware of what that command is doing before building a workflow around that
I feel like |
|
So, there are two ways to run an executable
X
in a project:cabal run X
cabal exec X
There are a few differences:
run
checks for changes in the source, resolves dependency versions and so on, whileexec
does nothing of that.run
emits strings to standard output or standard error, so the output is not suitable for piping into other programs.In a real case, I have a program
X
that generates a script in another language. This script is then being fed to the interpreterY
of that language. So, I have to useexec
, and the command line looks ascabal exec X | Y
. So far so good, but then I ship an update and the previous version is being used instead, because re-build is not forced, and no one even notices this because there are no warnings.A simple solution would be to emit a warning (or even an error) when the project is not freshly re-built when running
cabal exec
. A more advanced solution may be to intelligently study the executable to run, see if it is located in the project, and in that case check if it needs to be re-built and inform the operator.The text was updated successfully, but these errors were encountered: