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

installing zfsbootmenu 2.3.0 on arch results in error #588

Closed
wboschman opened this issue Feb 4, 2024 · 11 comments · Fixed by #589
Closed

installing zfsbootmenu 2.3.0 on arch results in error #588

wboschman opened this issue Feb 4, 2024 · 11 comments · Fixed by #589
Labels
bug Something isn't working

Comments

@wboschman
Copy link

wboschman commented Feb 4, 2024

ZFSBootMenu build source

Release EFI

ZFSBootMenu version

2.3.0

Boot environment distribution

arch linux

Problem description

Hi,]

I get his error while building

Updating zfsbootmenu/zbm-release
Updating bin/generate-zbm
sed: -e expression #1, char 45: unterminated `s' command
make: *** [Makefile:36: zbm-release] Error 1
==> ERROR: A failure occurred in package().

problem might come from line 35 releng/version.sh:

  # Otherwise, use git-rev-parse if possible
  if branch="$(git rev-parse --abbrev-rev HEAD 2>/dev/null)"; then

should be:

  # Otherwise, use git-rev-parse if possible
  if branch="$(git rev-parse --abbrev-ref HEAD 2>/dev/null)"; then

Steps to reproduce

yay -S zfsbootmenu

@wboschman wboschman added the bug Something isn't working label Feb 4, 2024
@ahesford
Copy link
Member

ahesford commented Feb 4, 2024

I cannot reproduce this:

mkdir -p test/root
cd test
curl -L https://github.com/zbm-dev/zfsbootmenu/archive/v2.3.0.tar.gz | tar xzvf -
cd zfsbootmenu-2.3.0
make DESTDIR="../root"

successfully installs ZFSBootMenu with a valid usr/share/zfsbootmenu/zbm-release as written by releng/version.sh.

The Makefile is also used in the same way to build the Void Linux package. Is makepkg or yay doing something weird?

@wboschman
Copy link
Author

I've followed your steps and this works fine for me.

I don't have much insight in in the workings of makepkg but I think the problem is caused by the separate build and source dirs.

@wboschman
Copy link
Author

additionally when doing it manually the file zfsbootmenu/zbm-release looks like this:

NAME="ZFSBootMenu"
PRETTY_NAME="ZFSBootMenu"
ID="zfsbootmenu"
ID_LIKE="void"
HOME_URL="https://zfsbootmenu.org"
DOCUMENTATION_URL="https://docs.zfsbootmenu.org"
BUG_REPORT_URL="https://github.com/zbm-dev/zfsbootmenu/issues"
SUPPORT_URL="https://github.com/zbm-dev/zfsbootmenu/discussions"
VERSION="2.3.0"

with makepkg it get:

NAME="ZFSBootMenu"
PRETTY_NAME="ZFSBootMenu"
ID="zfsbootmenu"
ID_LIKE="void"
HOME_URL="https://zfsbootmenu.org"
DOCUMENTATION_URL="https://docs.zfsbootmenu.org"
BUG_REPORT_URL="https://github.com/zbm-dev/zfsbootmenu/issues"
SUPPORT_URL="https://github.com/zbm-dev/zfsbootmenu/discussions"
VERSION="--abbrev-rev
53e601974ca8ee56461131c32bab70bafcb3684e (53e6019)"

@scotte
Copy link

scotte commented Feb 4, 2024

It does look like it's related to the version parsing - I can reproduce the same error locally:

$ git clone https://aur.archlinux.org/zfsbootmenu.git
$ cd zfsbootmenu
$ makepkg
==> Making package: zfsbootmenu 2.3.0-1 (Sun 04 Feb 2024 09:42:20 AM MST)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Downloading zfsbootmenu-v2.3.0.tar.gz...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 1846k    0 1846k    0     0  1647k      0 --:--:--  0:00:01 --:--:-- 11.3M
==> Validating source files with sha512sums...
    zfsbootmenu-v2.3.0.tar.gz ... Passed
==> Extracting sources...
  -> Extracting zfsbootmenu-v2.3.0.tar.gz with bsdtar
==> Entering fakeroot environment...
==> Starting package()...
./releng/version.sh -u
Updating zfsbootmenu/zbm-release
Updating bin/generate-zbm
sed: -e expression #1, char 45: unterminated `s' command
make: *** [Makefile:36: zbm-release] Error 1
==> ERROR: A failure occurred in package().
    Aborting...

By making releng/version.sh set-x:

+ sed -e 's/our $VERSION.*/our $VERSION = '\''--abbrev-rev
53e601974ca8ee56461131c32bab70bafcb3684e (53e6019)'\'';/' -i bin/generate-zbm
sed: -e expression #1, char 45: unterminated `s' command

@ahesford
Copy link
Member

ahesford commented Feb 4, 2024

Alright, I understand the problem. The fact that AUR stuff lives in a git repository, and that makepkg doesn't attempt to isolate the build environment, means that your host git is leaking into the build environment and then the git rev parsing is picking up the AUR package git root. Our version detection assumes that one of the following is true:

  1. The ZBM tree is a git repository;
  2. The ZBM tree is not a git repository and is not unpacked in some other git repository; or
  3. The git executable is not available.

Arch packaging is kind of broken here. The right thing to do is not build the ZBM package as a child of a git repository, and also to prevent the host git from leaking into the environment. I'm not sure how to do this with makepkg.

If this needs to be worked around, patching the Makefile to make the zbm-release target a no-op.

@scotte
Copy link

scotte commented Feb 4, 2024

Ha, indeed! A simple workaround:

$ rm -rf .git
$ makepkg
[...]
==> Finished making: zfsbootmenu 2.3.0-1 (Sun 04 Feb 2024 10:26:49 AM MST)
$ ls
pkg  PKGBUILD  src  zfsbootmenu-2.3.0-1-x86_64.pkg.tar.zst  zfsbootmenu-v2.3.0.tar.gz

Obviously that precludes the use of yay, etc, but it is a workaround and still using the AUR...

@wboschman
Copy link
Author

it not so much git i think but the fact that "--abbrev-rev" does not exist as a parameter it should be "--abbrev-ref".

@ahesford
Copy link
Member

ahesford commented Feb 4, 2024

Ah, I couldn't see the difference in your "line should be" note. Thanks, this is definitely a big on our part. Curious that git isn't returning nonzero there.

ahesford added a commit that referenced this issue Feb 4, 2024
1. Correct typo: --abbrev-rev -> --abbrev-ref
2. Limit repository search to the current directory

Fixes: #588.
ahesford added a commit that referenced this issue Feb 4, 2024
1. Correct typo: --abbrev-rev -> --abbrev-ref
2. Limit repository search to the current directory

Fixes: #588.
@ahesford
Copy link
Member

ahesford commented Feb 4, 2024

After fixing the typo and limiting the search for a git repository, I think this will build as expected even with the AUR helper. See #589.

ahesford added a commit that referenced this issue Feb 4, 2024
1. Correct typo: --abbrev-rev -> --abbrev-ref
2. Limit repository search to the current directory

Fixes: #588.
@Darukutsu
Copy link

Still not fixed, AUR suggest to use workaround. Will this be fixed?

@ahesford
Copy link
Member

There's nothing to fix on our end. We don't support the AUR, and whoever posted that PKGBUILD should avoid running our versioning script if Arch's build process can't stop leaking information into the build directory.

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