tfiers / PkgGraph.jl

Visualize the dependency graph of a Julia package
https://tfiers.github.io/PkgGraph.jl
MIT License
42 stars 2 forks source link

Windows: Long package silently not opened in browser #46

Open tfiers opened 1 year ago

tfiers commented 1 year ago

depgraph_web(:Plots), eg

url(:Plots,) shows that truncated..

tfiers commented 1 year ago
tfiers commented 1 year ago

another one: depgraph_web(:OrdinaryDiffEq)

tfiers commented 1 year ago

Also, that takes a long time, #TTFX. So let's go to

tfiers commented 1 year ago

(Actually, OrdinarryDiffEq takes longer to crawl than Plots)

Ok this works:

julia> link=PkgGraph.url(PkgGraph.depgraph_as_dotstr(:OrdinaryDiffEq));
julia> run(pipeline(`echo $link`, `clip.exe`))

(and then pasting in browser) (btw, that is not a useful viz. link)

tfiers commented 1 year ago

(it's not better w/ jll and stdlib filtered out! (link))

tfiers commented 1 year ago

aha, interesting: with our deved DefaultApp (

)

julia> DefaultApplication.open(link)
ERROR: IOError: stat("https://drea [...] Diff%0A%7D%0A"): name too long (ENAMETOOLONG)
Stacktrace:
 [1] uv_error
   @ ./libuv.jl:100 [inlined]
 [2] stat(path::String)
   @ Base.Filesystem ./stat.jl:152
 [3] ispath
   @ ./stat.jl:461 [inlined]
 [4] #open#1
   @ ~/.julia/dev/DefaultApplication/src/DefaultApplication.jl:27 [inlined]
 [5] open(filename::String)
   @ DefaultApplication ~/.julia/dev/DefaultApplication/src/DefaultApplication.jl:18
 [6] top-level scope
   @ REPL[5]:1
tfiers commented 1 year ago

aha, but it works on WSL:

julia> ope(path) = run(`powershell.exe -NoProfile -NonInteractive -Command start \"$(path)\"`);
julia> ope(link);

(works)

So. Is it on windows only this bug?

(wow. crazy long on Windows, #windows IO is slower than linux: image

compare w/ asciinema rec here:

ok that was :Plots, but still. I remember ODE on WSL being ~14 seconds, not two minutes )

but ok, yes, it is a windows only thing:

julia> PkgGraph.depgraph_web(:OrdinaryDiffEq)
[ Info: Package "OrdinaryDiffEq" not found in active project. Using General registry
✓ Crawling registry      Time: 0:01:58
ERROR: IOError: could not spawn `'C:\WINDOWS\system32\cmd.exe' /c start 'https://dreampuf.github.io/GraphvizOnline/#digraph%20%7B%0A%20%20%20%20bgcolor%20%3D%20%22transparent%22%0A%20%20%20%20node%20%5Bfontcolor%3D%22black
[ .. ]
%20%20%20%20Logging%20%5Bfontcolor%3Dgray%5D%0A%20%20%20%20Mmap%20%5Bfontcolor%3Dgray%5D%0A%7D%0A'`: name too long (ENAMETOOLONG)
Stacktrace:
  [1] _spawn_primitive(file::String, cmd::Cmd, stdio::Vector{Union{RawFD, Base.Libc.WindowsRawSocket, IO}})
    @ Base .\process.jl:128
  [2] #760
    @ .\process.jl:139 [inlined]
  [3] setup_stdios(f::Base.var"#760#761"{Cmd}, stdios::Vector{Union{RawFD, Base.Libc.WindowsRawSocket, IO}})
    @ Base .\process.jl:223
  [4] _spawn
    @ .\process.jl:138 [inlined]
  [5] run(::Cmd; wait::Bool)
    @ Base .\process.jl:483
  [6] #open#1
    @ C:\Users\tfiers\.julia\packages\DefaultApplication\7wyMn\src\DefaultApplication.jl:33 [inlined]
  [7] open
    @ C:\Users\tfiers\.julia\packages\DefaultApplication\7wyMn\src\DefaultApplication.jl:18 [inlined]
  [8] depgraph_web(pkgname::Symbol, base_url::String; dryrun::Bool, kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ PkgGraph C:\Users\tfiers\.julia\dev\PkgGraph\src\includes\enduser.jl:14
  [9] depgraph_web
    @ C:\Users\tfiers\.julia\dev\PkgGraph\src\includes\enduser.jl:10 [inlined]
 [10] depgraph_web(pkgname::Symbol)
    @ PkgGraph C:\Users\tfiers\.julia\dev\PkgGraph\src\includes\enduser.jl:10
 [11] top-level scope
    @ REPL[3]:1
tfiers commented 1 year ago

(could also be the case on mac, dunno) Can I run(explorer) on it directly? Does that work w/ urls? (or, run run(cmd.exe /c start …)) nope:

julia> run(`explorer.exe $link`)
ERROR: IOError: could not spawn `explorer.exe 'https://dreampuf.github
[..]
%3Dgray%5D%0A%20%20%20%20Logging%20%5Bfontcolor%3Dgray%5D%0A%20%20%20%20Mmap%20%5Bfontcolor%3Dgray%5D%0A%7D%0A'`: name too long (ENAMETOOLONG)
Stacktrace:
 [1] _spawn_primitive(file::String, cmd::Cmd, stdio::Vector{Union{RawFD, Base.Libc.WindowsRawSocket, IO}})
   @ Base .\process.jl:128
 [2] #760
   @ .\process.jl:139 [inlined]
 [3] setup_stdios(f::Base.var"#760#761"{Cmd}, stdios::Vector{Union{RawFD, Base.Libc.WindowsRawSocket, IO}})
   @ Base .\process.jl:223
 [4] _spawn
   @ .\process.jl:138 [inlined]
 [5] run(::Cmd; wait::Bool)
   @ Base .\process.jl:479
 [6] run(::Cmd)
   @ Base .\process.jl:477
 [7] top-level scope
   @ REPL[8]:1
tfiers commented 1 year ago

So, we know thr: https://learn.microsoft.com/en-us/troubleshoot/windows-client/shell-experience/command-line-string-limitation

"#how-to-work-around-the-limitation": write to tmp file, then pipe through. ok sure (could be a defaultapp pr)

hah, maybe PowerShell doesn't have this?

ah no,

julia> run(`powershell.exe -NoProfile -NonInteractive -Command start $link`)

gives same error (IOError: could not spawn .. : name too long (ENAMETOOLONG))

tfiers commented 1 year ago

Current status: will be fixed once

is merged and released

tfiers commented 1 year ago

Should be released and thus fixed: https://github.com/tpapp/DefaultApplication.jl/commits/master Might need a lower bound on this dep version. And to check.