esy icon indicating copy to clipboard operation
esy copied to clipboard

substs: Operation not permitted

Open bentxt opened this issue 4 years ago • 9 comments

esy version: 0.6.10

Operating System: macOS 11.2.3

Issue:

git clone https://github.com/melange-re/melange-basic-template
cd melange-basic-template
esy
...
debug build @esy-ocaml/[email protected]@d41d8cd9: 404.521942ms
debug build: 405.802965ms
error: build failed with exit code: 1
  build log:
    # esy-build-package: building: @esy-ocaml/[email protected]
    # esy-build-package: pwd: /Users/ben/.esy/source/i/esy_ocaml__s__substs__0.0.1__19de1ee1
    # esy-build-package: running: 'cp' './substs' '/Users/ben/.esy/3____________________________________________________________________/s/esy_ocaml__s__substs-0.0.1-dcea4195/bin/substs'
    cp: /Users/ben/.esy/3____________________________________________________________________/s/esy_ocaml__s__substs-0.0.1-dcea4195/bin/substs: Operation not permitted
    error: command failed: 'cp' './substs' '/Users/ben/.esy/3____________________________________________________________________/s/esy_ocaml__s__substs-0.0.1-dcea4195/bin/substs' (exited with 1)
    esy-build-package: exiting with errors above...

bsconfig.json

cat bsconfig.json
{
    "$schema": "https://raw.githubusercontent.com/rescript-lang/rescript-compiler/master/docs/docson/build-schema.json",
    "name": "melange-basic-project",
    "version": "0.0.1",
    "sources": {
      "dir" : "src"
    },
    "package-specs": {
      "module": "commonjs"
    },
    "suffix": ".bs.js",
    "bs-dependencies": [
    ],
    "warnings": {
      "error" : "+101"
    },
  }⏎

Additional

This is the error, that happens if I try to install substs directly

npm -i @esy-ocaml/[email protected]

pm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /Users/ben/devnull/melange/melange-basic-template/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/Users/ben/devnull/melange/melange-basic-template/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ben/.npm/_logs/2021-05-02T21_52_46_743Z-debug.log

bentxt avatar May 02 '21 21:05 bentxt

I initially created this issue for an other reasonml package. But now I just saw, that I get the same error when I try to build this very repo

 git clone https://github.com/esy/esy
cd esy
esy -v -v -v

...
error: build failed with exit code: 1
  build log:
    # esy-build-package: building: @esy-ocaml/[email protected]
    # esy-build-package: pwd: /Users/ben/.esy/source/i/esy_ocaml__s__substs__0.0.1__19de1ee1
    # esy-build-package: running: 'cp' './substs' '/Users/ben/.esy/3____________________________________________________________________/s/esy_ocaml__s__substs-0.0.1-dcea4195/bin/substs'
    cp: /Users/ben/.esy/3____________________________________________________________________/s/esy_ocaml__s__substs-0.0.1-dcea4195/bin/substs: Operation not permitted
    error: command failed: 'cp' './substs' '/Users/ben/.esy/3____________________________________________________________________/s/esy_ocaml__s__substs-0.0.1-dcea4195/bin/substs' (exited with 1)
    esy-build-package: exiting with errors above...

  building @esy-ocaml/[email protected]
esy: exiting due to errors above

bentxt avatar May 02 '21 22:05 bentxt

@bentxt did you tried to remove the .esy? This is not the solution of course but it may be a problem of stale files with wrong permissions or something like that

EduardoRFS avatar May 02 '21 23:05 EduardoRFS

do you mean the ~/.esy directory? Yes I've deleted that multiple times.

bentxt avatar May 02 '21 23:05 bentxt

@bentxt are you on ARM64 / M1? This is a well tested path on esy which makes it weird.

EduardoRFS avatar May 03 '21 02:05 EduardoRFS

I actually get the exact same thing on a NixOS machine:

info esy 0.6.10 (using esy.json)
info fetching: done                                   
warn missing /home/ulrik.strid/.esy/source/i/opam__s__bisect__ppx__opam__c__2.6.0__b7477a79/bisect-ppx-report defined as binary
info installing: done                                 
info building @esy-ocaml/[email protected]@d41d8cd9
info building [email protected]@d41d8cd9
error: build failed with exit code: 1
  build log:
    # esy-build-package: building: @esy-ocaml/[email protected]
    # esy-build-package: pwd: /home/ulrik.strid/.esy/source/i/esy_ocaml__s__substs__0.0.1__19de1ee1
    # esy-build-package: running: 'cp' './substs' '/home/ulrik.strid/.esy/3_____________________________________________________________/s/esy_ocaml__s__substs-0.0.1-ed6217b4/bin/substs'
    esy-build-package: unable to resolve command: cp
    
  building @esy-ocaml/[email protected]
esy: exiting due to errors above

ulrikstrid avatar May 03 '21 12:05 ulrikstrid

Because the problem is resolved on my machine, I just want to give a quick feedback on this issue. I'm not sure what caused and cured the problem its more a few random notes.

  • I have an older Macbook (Intel) and too little hard drive space
  • because of the limited disk space I had to move the ~/.esy folder on an external disk (apfs) and did a symbolic link from the harddrive /externaldisk/dotesy to ~/.esy.

** possible 1. problem: an extern ~/.esy folder**

  • Maybe thats a fish shell speciality, but what I missed is when you rm -rf a link like ~/.esy/ (with a trailing /) was, you dont remove not the link target, but only the subfolders. So when I thought I wiped ~/.esy I was always working with the link.

** possible 2. problem: external CLI Tools** Due to the harddisk limitations I also outsourced XCode to the external disk and with it the 'CommandLine Tools' (gcc, etc). So I fixed that be separately install the freestanding CLI tools: xcode-select --install

** possible 3. problem: outdated sw** I had to update my macos and also XCode (and the CLI Tools)

I dont know, strange stuff, but esy runs again ...

bentxt avatar May 03 '21 23:05 bentxt

@ulrikstrid your error is different, yours is related to esy not finding cp because esy has a default folder to search on Linux, is known that nixOS sadly doesn't work

EduardoRFS avatar May 04 '21 00:05 EduardoRFS

@bentxt that's probably the problem then, your somehow got a stale esy-subst and didn't delete.

This also happens on Windows but are kind of hard to reproduce, I should try some ideas, like running multiple instances of esy randomly at same time.

But the problem overall is that esy doesn't have a centralized way to handle assets and doesn't check permissions / stats of the file.

EduardoRFS avatar May 04 '21 00:05 EduardoRFS

this repo fails by being unable to find the cp executable from within esy on nixos (22.05) in everything but vscode. In vscode's shell it works.

I did /usr/bin/env > vscode.txt from a vscode shell and /usr/bin/env > st.txt from my simple term shell, and read git diff vscode.txt st.txt for clues, but nothing stood out.

I've also found that vscode doesn't oblige me to patchelf gentype, in another project.

quinn-dougherty avatar Apr 19 '22 14:04 quinn-dougherty