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

Line numbers shown on lints are not accurate to source code #123

Open
razzlestorm opened this issue Nov 3, 2022 · 6 comments · Fixed by #131
Open

Line numbers shown on lints are not accurate to source code #123

razzlestorm opened this issue Nov 3, 2022 · 6 comments · Fixed by #131
Assignees
Labels
bug Something isn't working

Comments

@razzlestorm
Copy link
Contributor

When a lint is produced, the corresponding line number can be off by a few lines. This is because the linter marks the error of the post-rendered version of the recipe that it has, not the original.

Ideally, the line numbers of the lint messages should reflect the recipe that the user can see/work on.

@razzlestorm
Copy link
Contributor Author

Marking @danpetry in this since he has also noticed it and might be interested when it gets resolved.

@marcoesters marcoesters added the bug Something isn't working label Nov 10, 2022
@marcoesters marcoesters linked a pull request Nov 10, 2022 that will close this issue
@marcoesters
Copy link
Collaborator

Reopening this because the problem is unfortunately not solved. I think one problem is that it erases comments, which shifts line numbers.

@marcoesters marcoesters reopened this Dec 7, 2022
@cbouss
Copy link
Collaborator

cbouss commented Dec 8, 2022

Can you post a recipe highlighting this?

@marcoesters
Copy link
Collaborator

I found it while testing my multi-output branch with this purposefully broken recipe:

{% set version = "1.64.0" %}

package:
  name: 'rust'
  version: {{ version }}

source:
  - url: https://static.rust-lang.org/dist/rust-{{ version }}-x86_64-unknown-linux-gnu.tar.gz  # [linux64]
    sha256: a893977f238291370ab96726a74b6b9ae854dc75fbf5730954d901a93843bf9b  # [linux64]
  - url: https://static.rust-lang.org/dist/rust-{{ version }}-aarch64-unknown-linux-gnu.tar.gz  # [aarch64]
    sha256: 7d8860572431bd4ee1b9cd0cd77cf7ff29fdd5b91ed7c92a820f872de6ced558  # [aarch64]
  - url: https://static.rust-lang.org/dist/rust-{{ version }}-powerpc64le-unknown-linux-gnu.tar.gz  # [ppc64le]
    sha256: 9d4591033eac22093d107991a68fffccea087b26bb54115d46cc544fbf5ef66c  # [ppc64le]
  - url: https://static.rust-lang.org/dist/rust-{{ version }}-s390x-unknown-linux-gnu.tar.gz  # [s390x]
    sha256: 202c445d2a7742c761ad31e62a8ffdfbff4ecc691a79d04182b7e1e5b18383ad  # [s390x]
  - url: https://static.rust-lang.org/dist/rust-{{ version }}-x86_64-apple-darwin.tar.gz  # [osx and x86_64]
    sha256: b6003d49fb857ff8dc105a3ccba98b851cd3e7d874005acb92284fd1113adc0d  # [osx and x86_64]
  - url: https://static.rust-lang.org/dist/rust-{{ version }}-aarch64-apple-darwin.tar.gz  # [osx and arm64]
    sha256: e1a37dc5991304716e260144311fd291d8fb514042e45c244c582b3454477038  # [osx and arm64]
  - url: https://static.rust-lang.org/dist/rust-{{ version }}-x86_64-pc-windows-msvc.tar.gz  # [win64]
    sha256: 82ab0bf226cc64379612e050365f4944d6201cd5d9e527d7956c3fbdb715d0bb  # [win64]
    folder: msvc  # [win64]
  - url: https://static.rust-lang.org/dist/rust-{{ version }}-x86_64-pc-windows-gnu.tar.gz  # [win64]
    sha256: 40432058311e765a28605f9507fdc6df2d60fad70aa5def231709eb64adeea4d  # [win64]
    folder: gnu  # [win64]

build:
  number: 0
  # the distributed binaries are already relocatable
  binary_relocation: False
  runpath_whitelist:
    - $ORIGIN/../lib
  missing_dso_whitelist:
    - /usr/lib/libresolv.9.dylib
    - /usr/lib/libc++.1.dylib
    - /usr/lib/libc++abi.dylib
    - /usr/lib/libiconv.2.dylib
    - /usr/lib/libcurl.4.dylib
    - /usr/lib/libxar.1.dylib
    - $RPATH/libLLVM-14-rust-1.64.0-stable.so
    # Since 1.32.0 macOS also needs:
    - /System/Library/Frameworks/Python.framework/Versions/2.7/Python
    - /System/Library/PrivateFrameworks/DebugSymbols.framework/Versions/A/DebugSymbols
    - /usr/lib/libcompression.dylib
    - /usr/lib/libedit.3.dylib
    - /usr/lib/libform.5.4.dylib
    - /usr/lib/libncurses.5.4.dylib
    - /usr/lib/libpanel.5.4.dylib
    - /usr/lib/libxml2.2.dylib
    # Fixed via install_name_tool now (just declaring it here meant the thing using -
    # lib/rustlib/x86_64-apple-darwin/lib/python2.7/site-packages/lldb/lldb-argdumper - was
    # still unable to find it at runtime).
    # - $RPATH/libLLVM.dylib

    - '**/ld-linux-x86-64.so.2'
    - '**/libc.so.6'
    - '**/libdl.so.2'
    - '**/ld64.so.*'
    - '**/libgcc_s.so.1'
    - '**/libm.so.6'
    - '**/libpthread.so.0'
    - '**/librt.so.1'
    - '**/libgcc_s.so.1'
    - '**/libz.so.1'
    # Since 1.32.0 linux also needs:
    - '**/libstdc++.so.6'

outputs:
  - name: rust
    script: install-msvc.bat  # [win]
    script: install-unix.sh  # [not win]
    requirements:
      build:
        - {{ compiler('c') }}    # [osx]
        - posix  # [win]
    test:
      commands:
        - rustc --version
        - cargo --help


  - name: rust-gnu  # [win]
    script: install-gnu.bat  # [win]
    requirements:  # [win]
      build:  # [win]
        - posix # [win]
    test:  # [win]
      commands:  # [win]
        - rustc --version  # [win]
        - cargo --help  # [win]

about:
  home: https://www.rust-lang.org
  license: MIT AND Apache-2.0
  license_family: OTHER
  license_url: https://github.com/rust-lang/rust/blob/{{ version }}/COPYRIGHT
  summary: |
    Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety.
  description: |
    This package provides the compiler (rustc) and the documentation utilities rustdoc.
  dev_url: https://github.com/rust-lang/rust
  doc_url: https://www.rust-lang.org/learn
  doc_source_url: https://github.com/rust-lang/rust/tree/{{ version }}/src/doc

extra:
  # The license files cannot be found properly on Windows
  skip-lints:
    - missing_license_file
  recipe-maintainers:
    - abhi18av
    - dlaehnemann
    - johanneskoester
    - pkgw
    - katietz

This is the output I'm getting:

The following problems have been found:

ERROR: /Users/mesters/codebase/aggregate/rust-feedstock/recipe/meta.yaml:61: outputs_not_unique: Output name is not unique
ERROR: /Users/mesters/codebase/aggregate/rust-feedstock/recipe/meta.yaml:62: outputs_not_unique: Output name is not unique
Errors were found

The correct line number would be 69.

Now that I tested it more, it's not the comments. Removing the comments still doesn't get me the correct number, so it was just a coincidence that we had seven lines of comments.

The fact that we're getting two messages with two different line numbers is also interesting.

@marcoesters
Copy link
Collaborator

After more testing: it's not jinja, comments, or empty lines.

@schuylermartin45
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants