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

Packages with symlinks have issues #87

Open
ericphanson opened this issue Jul 6, 2023 · 1 comment
Open

Packages with symlinks have issues #87

ericphanson opened this issue Jul 6, 2023 · 1 comment

Comments

@ericphanson
Copy link
Member

Problem 1:

In [25]: analyze("Mads"; version= v"0.9.1")
┌ Debug: Downloading code via github api
└ @ PackageAnalyzer ~/.julia/packages/PackageAnalyzer/GHakA/src/obtain_code.jl:106
┌ Debug: Must be download corruption; tree hash of download does not match expected
│   get_tree_hash(dest) = "8b5971b5b9b32a2f45cacda47a0e5fd4849981d9"
│   tree_hash = "488a8dfcddf4e1c0fef21a59f62e7e52b32f0888"
└ @ PackageAnalyzer ~/.julia/packages/PackageAnalyzer/GHakA/src/obtain_code.jl:77
Out[25]: PackageV1 Mads:
  * repo: https://github.com/madsjulia/Mads.jl.git
  * uuid: d6bdc55b-bd94-5012-933c-1f73fc2ee992
  * version: 0.9.1
  * is reachable: false

Problem 2: if I manually clone,

❯ git clone https://github.com/madsjulia/Mads.jl.git
❯ cd Mads.jl
❯ git log --pretty=raw | grep -B 1 488a8dfcddf4e1c0fef21a59f62e7e52b32f0888 # tree hash from error above
commit 191bee6213169df94c4d20dfd3c65907ac8e4833
tree 488a8dfcddf4e1c0fef21a59f62e7e52b32f0888
❯ git reset --hard 191bee6213169df94c4d20dfd3c65907ac8e4833

then start Julia and analyze:

In [4]: using PackageAnalyzer

In [5]: analyze(".")
ERROR: SystemError: opening file "./examples/model_analysis/models/internal-polynomial.jl": No such file or directory
Stacktrace:
  [1] systemerror(p::String, errno::Int32; extrainfo::Nothing)
    @ Base ./error.jl:176
  [2] #systemerror#82
    @ ./error.jl:175 [inlined]
  [3] systemerror
    @ ./error.jl:175 [inlined]
  [4] open(fname::String; lock::Bool, read::Nothing, write::Nothing, create::Nothing, truncate::Nothing, append::Nothing)
    @ Base ./iostream.jl:293
  [5] open
    @ ./iostream.jl:275 [inlined]
  [6] open(f::Base.var"#418#419"{String}, args::String; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Base ./io.jl:393
  [7] open
    @ ./io.jl:392 [inlined]
  [8] read
    @ ./io.jl:473 [inlined]
  [9] parse_green_node(file_path::String)
    @ PackageAnalyzer ~/.julia/packages/PackageAnalyzer/GHakA/src/count_loc.jl:102
 [10] count_julia_lines_of_code(dir::String)
    @ PackageAnalyzer ~/.julia/packages/PackageAnalyzer/GHakA/src/count_loc.jl:146
 [11] count_lines_of_code(dir::String)
    @ PackageAnalyzer ~/.julia/packages/PackageAnalyzer/GHakA/src/count_loc.jl:16
 [12] analyze_code(dir::String; repo::String, reachable::Bool, subdir::String, auth::GitHub.AnonymousAuth, sleep::Int64, only_subdir::Bool, version::Nothing)
    @ PackageAnalyzer ~/.julia/packages/PackageAnalyzer/GHakA/src/analyze.jl:263
 [13] analyze_code
    @ ~/.julia/packages/PackageAnalyzer/GHakA/src/analyze.jl:221 [inlined]
 [14] #analyze#41
    @ ~/.julia/packages/PackageAnalyzer/GHakA/src/analyze.jl:185 [inlined]
 [15] analyze
    @ ~/.julia/packages/PackageAnalyzer/GHakA/src/analyze.jl:177 [inlined]
 [16] analyze(name_or_dir_or_url::String; registries::Vector{RegistryInstances.RegistryInstance}, auth::GitHub.AnonymousAuth, sleep::Int64, version::Nothing, root::String, subdir::String)
    @ PackageAnalyzer ~/.julia/packages/PackageAnalyzer/GHakA/src/analyze.jl:76
 [17] analyze(name_or_dir_or_url::String)
    @ PackageAnalyzer ~/.julia/packages/PackageAnalyzer/GHakA/src/analyze.jl:58
 [18] top-level scope
    @ REPL[5]:1
 [19] top-level scope
    @ ~/.julia/juliaup/julia-1.9.1+0.aarch64.apple.darwin14/share/julia/stdlib/v1.9/REPL/src/REPL.jl:1416

The file in question seems to be a symlink:

❯ ls -alh ./examples/model_analysis/models/
total 600
drwxr-xr-x  13 eph  staff   416B Jul  6 02:24 .
drwxr-xr-x  28 eph  staff   896B Jul  6 02:24 ..
-rw-r--r--   1 eph  staff   461B Jul  6 02:24 internal-exp-polynomial.jl
-rw-r--r--   1 eph  staff   550B Jul  6 02:24 internal-exp-polynomial.mads
-rw-r--r--   1 eph  staff   399B Jul  6 02:24 internal-linear.jl
-rw-r--r--   1 eph  staff   435B Jul  6 02:24 internal-linear.mads
-rw-r--r--   1 eph  staff   129K Jul  6 02:24 internal-polynomial-efast-385.png
-rw-r--r--   1 eph  staff    52K Jul  6 02:24 internal-polynomial-w13a-model-100-spaghetti.png
-rw-r--r--   1 eph  staff    87K Jul  6 02:24 internal-polynomial-w13a-svr-100-spaghetti.png
lrwxr-xr-x   1 eph  staff    54B Jul  6 02:24 internal-polynomial.jl -> ../../internal-polynomial-model/internal-polynomial.jl
lrwxr-xr-x   1 eph  staff    56B Jul  6 02:24 internal-polynomial.mads -> ../../internal-polynomial-model/internal-polynomial.mads
-rw-r--r--   1 eph  staff   437B Jul  6 02:24 internal-polynomial3.jl
-rw-r--r--   1 eph  staff   549B Jul  6 02:24 internal-polynomial3.mads
@giordano
Copy link
Member

I reported also in #90, the problem isn't the symlink per se, but the fact it has a nonsense target: they dumped the content of the file as the target....

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

No branches or pull requests

2 participants