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

rescript -warn-error does not work correctly on Linux #6868

Closed
cknitt opened this issue Jul 9, 2024 · 6 comments · Fixed by #6877
Closed

rescript -warn-error does not work correctly on Linux #6868

cknitt opened this issue Jul 9, 2024 · 6 comments · Fixed by #6877
Labels
Milestone

Comments

@cknitt
Copy link
Member

cknitt commented Jul 9, 2024

For some reason, I can only reproduce this problem on Linux.

To reproduce, follow these steps (e.g. in a Docker container with docker run --rm -it node:20 bash):

# Get an example ReScript project, using rescript-core here.
git clone https://github.com/rescript-association/rescript-core.git
cd rescript-core

# Make sure a current ReScript version (11.1+) that has -warn-error is used
npm install rescript

# Create a source file with warning +32 (unused value)
echo "let unused = 1; let unused = 2" >src/Repro.res

# First build (warning, but no error -> ok)
npx rescript build

# Second build (warning as error -> ok)
npx rescript build -warn-error +32

# Third build (warning as error -> WHY???)
npx rescript build
@cknitt cknitt added the bug label Jul 9, 2024
@cknitt
Copy link
Member Author

cknitt commented Jul 9, 2024

@aspeddro Could you have a look at this?

@aspeddro
Copy link
Contributor

aspeddro commented Jul 9, 2024

Yes

@fhammerschmidt fhammerschmidt added this to the v11.1.3 milestone Jul 9, 2024
@aspeddro
Copy link
Contributor

I couldn't reproduce

➜ sudo docker pull node:20
20: Pulling from library/node
e9aef93137af: Pull complete 
58b365fa3e8d: Pull complete 
3dbed71fc544: Pull complete 
ae70830af8b6: Pull complete 
61accb8c79fc: Pull complete 
f51887373605: Pull complete 
711b977faa4e: Pull complete 
322f1716fc6a: Pull complete 
Digest: sha256:786005cf39792f7046bcd66491056c26d2dbcc669c072d1a1e4ef4fcdddd26eb
Status: Downloaded newer image for node:20
docker.io/library/node:20

/tmp/my-rescript-app on  main [?] is 📦 v0.0.0 via  v20.14.0 took 41s 
➜ sudo docker run --rm -it node:20 bash
root@df10967f9149:/# git --version
git version 2.39.2
root@df10967f9149:/# git clone https://github.com/rescript-association/rescript-core.git
Cloning into 'rescript-core'...
remote: Enumerating objects: 1619, done.
remote: Counting objects: 100% (839/839), done.
remote: Compressing objects: 100% (350/350), done.
remote: Total 1619 (delta 619), reused 616 (delta 487), pack-reused 780
Receiving objects: 100% (1619/1619), 525.27 KiB | 1.64 MiB/s, done.
Resolving deltas: 100% (1095/1095), done.
root@df10967f9149:/# cd rescript-core/
root@df10967f9149:/rescript-core# npm install

added 14 packages, and audited 15 packages in 5s

found 0 vulnerabilities
npm notice
npm notice New minor version of npm available! 10.7.0 -> 10.8.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.8.2
npm notice To update run: npm install -g npm@10.8.2
npm notice
root@df10967f9149:/rescript-core# echo "let unused = 1; let unused = 2" > src/Repro.res
root@df10967f9149:/rescript-core# npx rescript build
>>>> Start compiling
Dependency on @rescript/tools
rescript: [8/8] npm/RescriptTools.cmj
rescript: [11/11] install.stamp
Dependency Finished
rescript: [203/304] src/Repro.cmj

  Warning number 32
  /rescript-core/src/Repro.res:1:5-10

  1 │ let unused = 1; let unused = 2
  2 │ 

  unused value unused.

rescript: [304/304] test/TestSuite.cmj
>>>> Finish compiling 531 mseconds
root@df10967f9149:/rescript-core# npx rescript build -warn-error +32
Error: Unknown option "-warn-error".
Usage: rescript build <options> -- <ninja_options>

`rescript build` builds the project with dependencies

`rescript build -- -h` for Ninja options (internal usage only; unstable)

Options:
  -w          Watch mode
  -ws         [host]:port set up host & port for WebSocket build notifications
  -verbose    Set the output to be verbose
  -with-deps  *deprecated* This is the default behavior now. This option will be removed in a future release
root@df10967f9149:/rescript-core# npm install rescript@latest

removed 1 package, changed 1 package, and audited 14 packages in 3s

found 0 vulnerabilities
root@df10967f9149:/rescript-core# npx rescript build -warn-error +32
Different compiler version: clean current repo

  Warning number 3
  /rescript-core/rescript.json:20:20-22

  18 ┆ ],
  19 ┆ "suffix": ".mjs",
  20 ┆ "package-specs": {
  21 ┆   "module": "es6",
  22 ┆   "in-source": true
  23 ┆ },

  deprecated: Option "es6" is deprecated. Use "esmodule" instead.

Cleaning... 11 files.
Cleaning... 453 files.

  Warning number 3
  /rescript-core/rescript.json:20:20-22

  18 ┆ ],
  19 ┆ "suffix": ".mjs",
  20 ┆ "package-specs": {
  21 ┆   "module": "es6",
  22 ┆   "in-source": true
  23 ┆ },

  deprecated: Option "es6" is deprecated. Use "esmodule" instead.

Dependency on @rescript/tools
rescript: [8/8] npm/RescriptTools.cmj
rescript: [11/11] install.stamp
Dependency Finished
rescript: [194/304] src/Repro.cmj
FAILED: src/Repro.cmj

  Warning number 32 (configured as error) 
  /rescript-core/src/Repro.res:1:5-10

  1 │ let unused = 1; let unused = 2
  2 │ 

  unused value unused.

rescript: [304/304] test/TestSuite.cmj
FAILED: cannot make progress due to previous errors.
root@df10967f9149:/rescript-core# npx rescript build                
>>>> Start compiling

  Warning number 3
  /rescript-core/rescript.json:20:20-22

  18 ┆ ],
  19 ┆ "suffix": ".mjs",
  20 ┆ "package-specs": {
  21 ┆   "module": "es6",
  22 ┆   "in-source": true
  23 ┆ },

  deprecated: Option "es6" is deprecated. Use "esmodule" instead.

Dependency on @rescript/tools
Dependency Finished
rescript: [196/304] src/Repro.cmj

  Warning number 32
  /rescript-core/src/Repro.res:1:5-10

  1 │ let unused = 1; let unused = 2
  2 │ 

  unused value unused.

rescript: [304/304] test/TestSuite.cmj
>>>> Finish compiling 362 mseconds
root@df10967f9149:/rescript-core# npx rescript build
>>>> Start compiling

  Warning number 3
  /rescript-core/rescript.json:20:20-22

  18 ┆ ],
  19 ┆ "suffix": ".mjs",
  20 ┆ "package-specs": {
  21 ┆   "module": "es6",
  22 ┆   "in-source": true
  23 ┆ },

  deprecated: Option "es6" is deprecated. Use "esmodule" instead.

Dependency on @rescript/tools
Dependency Finished
rescript: [3/3] src/Repro.cmj

  Warning number 32
  /rescript-core/src/Repro.res:1:5-10

  1 │ let unused = 1; let unused = 2
  2 │ 

  unused value unused.

>>>> Finish compiling 23 mseconds
root@df10967f9149:/rescript-core# npx rescript build -warn-error +32

  Warning number 3
  /rescript-core/rescript.json:20:20-22

  18 ┆ ],
  19 ┆ "suffix": ".mjs",
  20 ┆ "package-specs": {
  21 ┆   "module": "es6",
  22 ┆   "in-source": true
  23 ┆ },

  deprecated: Option "es6" is deprecated. Use "esmodule" instead.

Dependency on @rescript/tools
Dependency Finished
rescript: [3/3] src/Repro.cmj

  Warning number 32
  /rescript-core/src/Repro.res:1:5-10

  1 │ let unused = 1; let unused = 2
  2 │ 

  unused value unused.

root@df10967f9149:/rescript-core# npx rescript build
>>>> Start compiling

  Warning number 3
  /rescript-core/rescript.json:20:20-22

  18 ┆ ],
  19 ┆ "suffix": ".mjs",
  20 ┆ "package-specs": {
  21 ┆   "module": "es6",
  22 ┆   "in-source": true
  23 ┆ },

  deprecated: Option "es6" is deprecated. Use "esmodule" instead.

Dependency on @rescript/tools
Dependency Finished
rescript: [3/3] src/Repro.cmj

  Warning number 32
  /rescript-core/src/Repro.res:1:5-10

  1 │ let unused = 1; let unused = 2
  2 │ 

  unused value unused.

>>>> Finish compiling 26 mseconds
root@df10967f9149:/rescript-core# 

@aspeddro
Copy link
Contributor

Okay, I think I got it

root@0fc6338bd825:/# git clone https://github.com/rescript-association/rescript-core.git
Cloning into 'rescript-core'...
remote: Enumerating objects: 1619, done.
remote: Counting objects: 100% (839/839), done.
remote: Compressing objects: 100% (355/355), done.
remote: Total 1619 (delta 616), reused 612 (delta 482), pack-reused 780
Receiving objects: 100% (1619/1619), 526.30 KiB | 2.63 MiB/s, done.
Resolving deltas: 100% (1092/1092), done.
root@0fc6338bd825:/# cd rescript-core
root@0fc6338bd825:/rescript-core# npm install rescript

added 13 packages, and audited 14 packages in 3s

found 0 vulnerabilities
npm notice
npm notice New minor version of npm available! 10.7.0 -> 10.8.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.8.2
npm notice To update run: npm install -g npm@10.8.2
npm notice
root@0fc6338bd825:/rescript-core# echo "let unused = 1; let unused = 2" >src/Repro.res
root@0fc6338bd825:/rescript-core# npx rescript build
>>>> Start compiling

  Warning number 3
  /rescript-core/rescript.json:20:20-22

  18 ┆ ],
  19 ┆ "suffix": ".mjs",
  20 ┆ "package-specs": {
  21 ┆   "module": "es6",
  22 ┆   "in-source": true
  23 ┆ },

  deprecated: Option "es6" is deprecated. Use "esmodule" instead.

Dependency on @rescript/tools
rescript: [8/8] npm/RescriptTools.cmj
rescript: [11/11] install.stamp
Dependency Finished
rescript: [196/304] src/Repro.cmj

  Warning number 32
  /rescript-core/src/Repro.res:1:5-10

  1 │ let unused = 1; let unused = 2
  2 │ 

  unused value unused.

rescript: [304/304] test/TestSuite.cmj
>>>> Finish compiling 403 mseconds
root@0fc6338bd825:/rescript-core# npx rescript build -warn-error +32

  Warning number 3
  /rescript-core/rescript.json:20:20-22

  18 ┆ ],
  19 ┆ "suffix": ".mjs",
  20 ┆ "package-specs": {
  21 ┆   "module": "es6",
  22 ┆   "in-source": true
  23 ┆ },

  deprecated: Option "es6" is deprecated. Use "esmodule" instead.

Dependency on @rescript/tools
Dependency Finished
rescript: [198/304] src/Repro.cmj
FAILED: src/Repro.cmj

  Warning number 32 (configured as error) 
  /rescript-core/src/Repro.res:1:5-10

  1 │ let unused = 1; let unused = 2
  2 │ 

  unused value unused.

rescript: [304/304] test/TestSuite.cmj
FAILED: cannot make progress due to previous errors.
root@0fc6338bd825:/rescript-core# npx rescript build
>>>> Start compiling

  Warning number 3
  /rescript-core/rescript.json:20:20-22

  18 ┆ ],
  19 ┆ "suffix": ".mjs",
  20 ┆ "package-specs": {
  21 ┆   "module": "es6",
  22 ┆   "in-source": true
  23 ┆ },

  deprecated: Option "es6" is deprecated. Use "esmodule" instead.

Dependency on @rescript/tools
Dependency Finished
rescript: [1/1] src/Repro.cmj
FAILED: src/Repro.cmj

  Warning number 32 (configured as error) 
  /rescript-core/src/Repro.res:1:5-10

  1 │ let unused = 1; let unused = 2
  2 │ 

  unused value unused.

FAILED: cannot make progress due to previous errors.
>>>> Finish compiling (exit: 1)
root@0fc6338bd825:/rescript-core# 

@aspeddro
Copy link
Contributor

aspeddro commented Jul 13, 2024

I can't reproduce it on my machine (linux)

@aspeddro
Copy link
Contributor

The implementation was that if you use -warn-error you would need to clean up to regenerate build.ninja. Therefore, the error is expected if you do not run rescript clean

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants