Closed 0x2b3bfa0 closed 2 years ago
isn't the action meant to "uninstall the previous CML" first though?
Exactly! The prior version should be removed first
Changed p0 because seems to be needed for the release
isn't the action meant to "uninstall the previous CML" first though?
The previous CML is the binary we use to launch the runner. Not sure we actually want to uninstall that, or even overwrite it for that effect. 🤔
also windows tests failing
(Please kill me)
The previous CML is the binary we use to launch the runner. Not sure we actually want to uninstall that, or even overwrite it for that effect. 🤔
😆 true!
But it works anyway
Yes, it works anyway or, at least, it should.
⚠️ On a second thought, overwriting the executable may crash the program
When you unlink(1)
an executable while it's running, the file doesn't actually get deleted until the executable exits and the file descriptor reference count is zero. It has no effect on the running process.
When you overwrite an executable while it's running it may crash in very creative ways, because it's not loaded in memory at once; pages are loaded on demand.
@DavidGOrtega, TL;DR, it's fine to replace it when it's running, but we need to make sure that it's doing rm old && cp new old
(delete & create) instead of cat new > old
(overwrite)
would #57 be a better fix?
Yes, definitely, but we need to build Windows binaries, and https://github.com/iterative/setup-cml/pull/60#issuecomment-1097120247 still applies.
@0x2b3bfa0 I knew! Yesterday I was trying to understand what is doing npm uninstall
.
😉
- name: test cml
run: |
node --version
cml --version
# which cml
# rm /usr/bin/cml
npm uninstall -g @dvcorg/cml
cml --version || echo 'no cml'
When you overwrite an executable while it's running it may crash in very creative ways, because it's not loaded in memory at once; pages are loaded on demand.
My rationale is that in case of a node app its fine while we do not do it against node itself. Our code its just interpreted by the v8 engine, loaded in memory by the VM
My rationale is that in case of a node app its fine while we do not do it against node itself.
The pkg
binaries are “node itself” plus our code, so yes, it's equally risky
Our code its just interpreted by the v8 engine, loaded in memory by the VM
Not sure... does V8 load all the code at once, or waits until it's needed to read the file? 🤔
The pkg binaries are “node itself” plus our code, so yes, it's equally risky
I think I have not explained my self. Using the bin is more dangerous, the npm install
its more secure because its the V8 VM loading our js
Not sure... does V8 load all the code at once, or waits until it's needed to read the file?
Everything unless we do the require
inside non evaluated code. But we do the require in every single module on top.
But I might be wrong
🤦🏼 Makes sense now. I thought you were talking about binaries.
Still, replacing binaries safely is straightforward (e.g. rm
and cp
as stated above) while installing a Node.js package might be a bit less stable. 🤔
At current stage the workflow hangs forever in macos, something that does not happen installing the action.
jobs:
cml:
runs-on: [macos-latest]
env:
REPO_TOKEN: ${{ secrets.REPO_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: iterative/setup-cml@v1
@DavidGOrtega, https://github.com/iterative/cml/pull/983 solves all your hanging issues in a rather drastic way. 🐉
Unfortunately does not totally fix it for previous version of CML and we could end up with the same error but I have remembered this issue and I can pipe a dummy text as we do in formal CML tests.
I had to remove publish tests: In windows they fail. https://github.com/iterative/cml/pull/901 seems not to have fixed it?
@0x2b3bfa0
Also tests in container fails until https://github.com/iterative/cml/pull/974 is effective
@iterative/cml ready to review 🙏
I had to remove publish tests: In windows they fail. https://github.com/iterative/cml/pull/901 seems not to have fixed it?
Windows tests are broken because an arcane issue involving the drive letter of the current working directory not being the same as the drive letter of the @npcz/magic
installation path. 🎩 Magic.
I can't approve “my own” pull request, by the way. 🙃
Attracting reviewers from @iterative/cml...
@dacbd ready for review 🙏
@RCdeWit has found an error when using this
iterative/setup-cml
action in a self–hosted runner that, of course, already hadcml
installed.@DavidGOrtega edits
This pull request adds the-f
option to “overwrite files recklessly [sic]” and workaround this issue.force
parameter to force the installationThe interesting/tricky thing is that
uninstall
theninstall
does not always fail. Howeverforce
is the only way of guarantee the complete installation. For the majority of the cases that this could happen (runner image and installed latest cml version) this code may suffice perfectly