criticic / llpp

llpp original source code before it turned to protestware. NOTE: changes are made on the "latest" branch, master is locked and remains as it was.
Other
28 stars 6 forks source link

Building problems: "build failed" error #9

Closed temhelk closed 10 months ago

temhelk commented 10 months ago

I'm trying to build llpp myself and I'm getting "build failed" error when I run bash ./build.bash build. I tried to debug that issue and that's what I found. I'm sorry if I got something wrong, not a bash person.

The scripts exits after a call to this function defined like that:

isfresh() { test "$(<$1.past)" = "$2"; } 2>/dev/null

https://github.com/criticic/llpp/blob/63def6568f1dca6a49f9f870164a5f726e6d59fe/build.bash#L198

If I understand correctly it makes the script exit because it tries to read the content of the file "$1.past" that doesn't exist when you build it the first time.

After changing the function to that:

isfresh() {
    test -f "$1.past" || return 1
    test "$(<$1.past)" = "$2"
} 2>/dev/null

It seems to work and build the application on the first run and skips everything on the second. Is that a problem with my environment or what is going on?

fstecker commented 10 months ago

I would guess that it's something about your environment. What operating system are you on, and which version of bash are you using? Also, can you share the output of echo "$-" to see which shell options are active?

As a simplified test case, if you run something like

test "<(nonexistent)" = "x" || echo y

what does it do? I just get the output "y" without an error.

txtsd commented 10 months ago

This happens when building from the AUR. I submitted a patch to the llpp AUR package that makes it build, and I'm providing the same fix here upstream with #10.

fstecker commented 10 months ago

I updated my Arch Linux and now get the same problem. The update included a new version of bash, so maybe that's actually what changed.

In any case, I think we should fix this here instead of adding a patch to the AUR package.

txtsd commented 10 months ago

Oh I didn't realise you were stek on the AUR 😅. It's much easier to fix it here in that case.

fstecker commented 10 months ago

I'm excited to see I'm not the only one still using this program! That gives me hope we can keep it maintained without the original developer.

I propose we wait for a bit if anyone else has some thoughts on this, but if not I'll just merge your fix.

fstecker commented 10 months ago

I did some additional tests and it turns out that indeed the behavior of bash changed. Something like

set -e
echo "$(<nonexistent)"

used to just generate an error message in bash 5.1 and leave the shell running, but in version 5.2 it closes the shell.

Anyway, thank you @temhelk and @txtsd for fixing it!