@less broken?

@less write(stdout,'a') is resulting in the following error

ERROR: could not find source file for function
Stacktrace:
[1] less(::Nothing, ::Int32) at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/InteractiveUtils/src/editless.jl:265
[2] less(::Function, ::Any) at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/InteractiveUtils/src/editless.jl:264
[3] top-level scope at REPL[17]:1
[4] run_repl(::REPL.AbstractREPL, ::Any) at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288

That was taken from my history, so I know it’s worked in the past. I’ve also tried several others, they all fail with the same error.

If you typed literally

@less write(stdout,‘a’)

those are the wrong quotation marks: you should use the single straight quotation mark ' for characters:

@less write(stdout, 'a')

(but I get a different error message with instead of ')

1 Like

No, that’s just the formatting the forums are apply.

I edited my opening post for clarity.

What does @which write(stdout, 'a') show? Or methods(write)? Or probably more clearly, just displaying write itself? I’m guessing you are shadowing it.

1 Like

The problem isn’t with write, if that’s what you’re getting at. @less isn’t working for any function. As for the output, it’s as expected.

Ah, true, it looks like you may have moved/deleted some files within your Julia install? That error message would pop up if you don’t have the source files.

If they’ve been moved or deleted, then it was without my knowledge.

Looking at $ ls /usr/share/julia/stdlib/v1.5/**|grep jl|uniq, it certainly seems like the source code is there.

Is that where joinpath(Sys.BINDIR, Base.DATAROOTDIR) points? Is there a file at joinpath(Sys.BINDIR, Base.DATAROOTDIR,"julia","base","io.jl")?

julia> joinpath(Sys.BINDIR, Base.DATAROOTDIR)
"/usr/bin/../../build/julia/src/julia-1.5.3/julia-1.5.3/share"

isfile(joinpath(Sys.BINDIR, Base.DATAROOTDIR,"julia","base","io.jl"))
false

isdir(joinpath(Sys.BINDIR, Base.DATAROOTDIR))
false

That would be a “no”.

I’m no expert (or even competent), but I think there is something wrong with Base.DATAROOTDIR.

How did you install Julia? Did you use a distro installation?

Thanks for the reply. Sorry I didn’t catch the email notification.

Yes, I installed it from the Arch main repo.

Which package? I wholeheartedly recommend aur:julia-bin over julia

2 Likes

The main repo, so julia.

Why do you suggest the AUR repo over the main one? In general, I try to avoid the AUR where I can.

Because aur:julia-bin simply uses the official binaries, the package from the main repo bitrots every now and then, as you’ve just experienced

3 Likes

I see.

Well, I’ve downgraded from 2:1.5.3-3 to 2:1.5.3-2 and that fixed it for me. That confirms it’s a package issue.

Thanks.

This is the change between the two versions:
https://github.com/archlinux/svntogit-community/commit/1344d963d4b9249ba830f102b30f0aa651351c8d
I wonder if it reflects a bug in Julia build system? :thinking:

And/or missing test coverage? I’d hope they’d ensure no test failures — or at least no new regressions with a new packaging setup.

I can reproduce the issue with this Dockerfile:

FROM archlinux:latest
RUN pacman -Sy --noconfirm julia

CMD julia -E 'isdir(joinpath(Sys.BINDIR, Base.DATAROOTDIR))'

I believe they should set prefix at build time: FS#69870 : [julia] `prefix` should be set at build time as well

1 Like

Well, that was fast: archrelease: copy trunk to community-x86_64 · archlinux/svntogit-community@0ca84f8 · GitHub. I confirm 2:1.5.3-4 fixes the issue for me and @less works properly

3 Likes