archlinux-downgrade / downgrade

Downgrade packages in Arch Linux
GNU General Public License v2.0
570 stars 24 forks source link

`downgrade-11.2.0-1` does not appear to build with `paru #205

Closed amtoine closed 2 years ago

amtoine commented 2 years ago

:bug: Bug Report

Checklist

Environment

Description

When running paru to update my whole system, the update of downgrade does not succeed.

The full error is the following:

install: cannot stat 'bin//usr/local/bin': No such file or directory
install: cannot stat 'completion//usr/local/bin/bash': No such file or directory
install: cannot stat 'completion//usr/local/bin/zsh': No such file or directory
install: cannot stat 'completion//usr/local/bin/fish': No such file or directory
make: *** [Makefile:41: install] Error 1
==> ERROR: A failure occurred in package().
    Aborting...
error: failed to build 'downgrade-11.2.0-1':
error: packages failed to build: downgrade-11.2.0-1
atreyasha commented 2 years ago

Thanks @a2n-s for reporting this issue.

Cause

Just by looking at the log you posted and comparing it with our Makefile, I can tell that the issue arises from the variable $script being incorrectly resolved as /usr/local/bin:

https://github.com/archlinux-downgrade/downgrade/blob/30efdf7871b19c3385d1850e824b0d34acbd5a34/Makefile#L41-L45

Reproduction

I don't experience this issue when installing or upgrading via makepkg or with the yay helper.

As I don't use paru, I tried a dockerized workflow to reproduce this issue with the following Dockerfile:

# get base docker image
FROM greyltc/archlinux-aur:paru-20220605.0.219

# verify paru version
RUN paru --version

# enable wheel group to access sudo without password
RUN sed -i '/%wheel ALL=(ALL:ALL) NOPASSWD: ALL/s/^# *//g' /etc/sudoers

# add a test user to the wheel group
RUN useradd -G wheel -m test

# switch to the test user
USER test
WORKDIR /home/test

# clone downgrade from AUR
RUN git clone https://aur.archlinux.org/downgrade.git
WORKDIR /home/test/downgrade

# checkout and install downgrade v11.1.0
RUN git reset --hard c4ab93918ecb7e350986a4c2b54702cedd1667ec
RUN makepkg --noconfirm -si

# verify that downgrade version is v11.1.0
RUN which downgrade
RUN downgrade --version

# start system upgrade including donwgrade
RUN paru -Syu --noconfirm

# verify that downgrade version is v11.2.0
RUN which downgrade
RUN downgrade --version

I ran this with the following command (assuming this Dockerfile exists in the same directory):

$ docker build . -t test_downgrade_issue_205:latest

No similar error was encountered during the system upgrade and downgrade was successfully upgraded.

Build log

``` Sending build context to Docker daemon 3.072kB Step 1/15 : FROM greyltc/archlinux-aur:paru-20220605.0.219 ---> 6b574c8e53e8 Step 2/15 : RUN paru --version ---> Running in 794ca8f623a5 paru v1.10.0 - libalpm v13.0.1 Removing intermediate container 794ca8f623a5 ---> 8ad35eb78d42 Step 3/15 : RUN sed -i '/%wheel ALL=(ALL:ALL) NOPASSWD: ALL/s/^# *//g' /etc/sudoers ---> Running in 57486196f471 Removing intermediate container 57486196f471 ---> 810a51cb383b Step 4/15 : RUN useradd -G wheel -m test ---> Running in bad2126f5ad3 Removing intermediate container bad2126f5ad3 ---> d4fc516548de Step 5/15 : USER test ---> Running in a4019eec36eb Removing intermediate container a4019eec36eb ---> eaf976f71d89 Step 6/15 : WORKDIR /home/test ---> Running in 3c90b24cf8bc Removing intermediate container 3c90b24cf8bc ---> a39213f59aaa Step 7/15 : RUN git clone https://aur.archlinux.org/downgrade.git ---> Running in 590640a6169c Cloning into 'downgrade'... Removing intermediate container 590640a6169c ---> adee715b325a Step 8/15 : WORKDIR /home/test/downgrade ---> Running in 7c01c65ed123 Removing intermediate container 7c01c65ed123 ---> 37022cf1301e Step 9/15 : RUN git reset --hard c4ab93918ecb7e350986a4c2b54702cedd1667ec ---> Running in 19a865879195 HEAD is now at c4ab939 Release v11.1.0 Removing intermediate container 19a865879195 ---> 0e39f7afa19c Step 10/15 : RUN makepkg --noconfirm -si ---> Running in a2da8d3cceba ==> Making package: downgrade 11.1.0-1 (Thu 09 Jun 2022 10:49:57 AM UTC) ==> Checking runtime dependencies... ==> Installing missing dependencies... resolving dependencies... looking for conflicting packages... Package (1) New Version Net Change Download Size community/fzf 0.30.0-3 2.58 MiB 0.94 MiB Total Download Size: 0.94 MiB Total Installed Size: 2.58 MiB :: Proceed with installation? [Y/n] :: Retrieving packages... fzf-0.30.0-3-x86_64 downloading... checking keyring... checking package integrity... loading package files... checking for file conflicts... :: Processing package changes... installing fzf... Optional dependencies for fzf fish: fish keybindings tmux: fzf-tmux script for launching fzf in a tmux pane vim: plugin zsh: zsh keybindings :: Running post-transaction hooks... (1/1) Arming ConditionNeedsUpdate... ==> Checking buildtime dependencies... ==> Retrieving sources... -> Downloading downgrade-v11.1.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 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0  0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:--  0  100 45328 100 45328 0 0 50023 0 --:--:-- --:--:-- --:--:-- 50023 ==> Validating source files with md5sums...  downgrade-v11.1.0.tar.gz ... Passed ==> Extracting sources... -> Extracting downgrade-v11.1.0.tar.gz with bsdtar ==> Entering fakeroot environment... ==> Starting package()... install -Dm755 downgrade /home/test/downgrade/pkg/downgrade/usr/bin/downgrade install -Dm644 conf/downgrade.conf /home/test/downgrade/pkg/downgrade/etc/xdg/downgrade/downgrade.conf install -Dm644 doc/downgrade.8 /home/test/downgrade/pkg/downgrade/usr/share/man/man8/downgrade.8 install -Dm644 completion/bash /home/test/downgrade/pkg/downgrade/usr/share/bash-completion/completions/downgrade install -Dm644 completion/zsh /home/test/downgrade/pkg/downgrade/usr/share/zsh/site-functions/_downgrade install -Dm644 completion/fish /home/test/downgrade/pkg/downgrade/usr/share/fish/vendor_completions.d/downgrade.fish for po_file in locale/*.po; do \ locale="$(basename "$po_file" .po)"; \ mkdir -p "/home/test/downgrade/pkg/downgrade/usr/share/locale/$locale/LC_MESSAGES/"; \ msgfmt "$po_file" -o "/home/test/downgrade/pkg/downgrade/usr/share/locale/$locale/LC_MESSAGES/downgrade.mo"; \ done ==> Tidying install... -> Removing libtool files... -> Purging unwanted files... -> Removing static library files... -> Stripping unneeded symbols from binaries and libraries... -> Compressing man and info pages... ==> Checking for packaging issues... ==> Creating package "downgrade"... -> Generating .PKGINFO file... -> Generating .BUILDINFO file... -> Generating .MTREE file... -> Compressing package... ==> Leaving fakeroot environment. ==> Finished making: downgrade 11.1.0-1 (Thu 09 Jun 2022 10:50:00 AM UTC) ==> Installing package downgrade with pacman -U... loading packages... resolving dependencies... looking for conflicting packages... Package (1) New Version Net Change downgrade 11.1.0-1 0.05 MiB Total Installed Size: 0.05 MiB :: Proceed with installation? [Y/n] checking keyring... checking package integrity... loading package files... checking for file conflicts... :: Processing package changes... installing downgrade... Optional dependencies for downgrade sudo: for installation via sudo [installed] :: Running post-transaction hooks... (1/1) Arming ConditionNeedsUpdate... Removing intermediate container a2da8d3cceba ---> 5740dd90bd6e Step 11/15 : RUN which downgrade ---> Running in d8079f8336d0 /usr/sbin/downgrade Removing intermediate container d8079f8336d0 ---> 243b865366be Step 12/15 : RUN downgrade --version ---> Running in f49c368466e3 11.1.0 Removing intermediate container f49c368466e3 ---> c995bb46d966 Step 13/15 : RUN paru -Syu --noconfirm ---> Running in 0b1dc8b5ba59 :: Synchronizing package databases... core downloading... extra downloading... community downloading... :: Starting full system upgrade... resolving dependencies... looking for conflicting packages... Package (12) Old Version New Version Net Change Download Size core/glibc 2.35-5 2.35-6 0.33 MiB 9.90 MiB core/hwdata 0.359-1 0.360-1 0.01 MiB 0.46 MiB core/iana-etc 20220427-1 20220603-1 0.01 MiB 0.38 MiB core/kbd 2.4.0-2 2.5.0-1 0.11 MiB 1.21 MiB core/krb5 1.19.3-1 1.19.3-3 -0.07 MiB 1.24 MiB core/libevent 2.1.12-1 1.17 MiB 0.26 MiB core/libgpg-error 1.45-1 1.45-2 0.00 MiB 0.24 MiB core/libnftnl 1.2.1-1 1.2.2-1 0.00 MiB 0.07 MiB core/libverto 0.3.2-4 0.07 MiB 0.02 MiB core/nettle 3.7.3-1 3.8-1 0.05 MiB 0.43 MiB core/pacman-mirrorlist 20220501-1 20220605-1 0.00 MiB 0.01 MiB core/sudo 1.9.10-1 1.9.11.p1-1 0.13 MiB 1.69 MiB Total Download Size: 15.92 MiB Total Installed Size: 71.61 MiB Net Upgrade Size: 1.80 MiB :: Proceed with installation? [Y/n] :: Retrieving packages... glibc-2.35-6-x86_64 downloading... sudo-1.9.11.p1-1-x86_64 downloading... krb5-1.19.3-3-x86_64 downloading... kbd-2.5.0-1-x86_64 downloading... hwdata-0.360-1-any downloading... nettle-3.8-1-x86_64 downloading... iana-etc-20220603-1-any downloading... libevent-2.1.12-1-x86_64 downloading... libgpg-error-1.45-2-x86_64 downloading... libnftnl-1.2.2-1-x86_64 downloading... libverto-0.3.2-4-x86_64 downloading... pacman-mirrorlist-20220605-1-any downloading... checking keyring... checking package integrity... loading package files... checking for file conflicts... :: Running pre-transaction hooks... (1/1) Removing old entries from the info directory file... :: Processing package changes... upgrading iana-etc... upgrading glibc... warning: /etc/locale.gen installed as /etc/locale.gen.pacnew Generating locales... en_US.UTF-8... done Generation complete. upgrading hwdata... installing libevent... Optional dependencies for libevent python: to use event_rpcgen.py installing libverto... upgrading krb5... upgrading kbd... upgrading libgpg-error... upgrading libnftnl... upgrading nettle... upgrading pacman-mirrorlist... warning: /etc/pacman.d/mirrorlist installed as /etc/pacman.d/mirrorlist.pacnew upgrading sudo... warning: /etc/sudoers installed as /etc/sudoers.pacnew :: Running post-transaction hooks... (1/3) Reloading system manager configuration... Failed to check for chroot() environment: Permission denied Skipped: Current root is not booted. (2/3) Creating temporary files... /usr/lib/tmpfiles.d/journal-nocow.conf:26: Failed to resolve specifier: uninitialized /etc detected, skipping All rules containing unresolvable specifiers will be skipped. (3/3) Arming ConditionNeedsUpdate... :: Looking for AUR upgrades :: Looking for devel upgrades :: Resolving dependencies... :: Calculating conflicts... :: Calculating inner conflicts... Aur (1) downgrade-11.2.0-1 :: Proceed to review? [Y/n]: :: Downloading PKGBUILDs... (1/1) downloading: downgrade-11.2.0-1 fetching devel info... ==> Making package: downgrade 11.2.0-1 (Thu 09 Jun 2022 10:50:25 AM UTC) ==> Retrieving sources... -> Downloading downgrade-v11.2.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 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0  0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 53101 0 53101 0 0 77579 0 --:--:-- --:--:-- --:--:-- 274k ==> Validating source files with md5sums...  downgrade-v11.2.0.tar.gz ... Passed ==> Making package: downgrade 11.2.0-1 (Thu 09 Jun 2022 10:50:26 AM UTC) ==> Checking runtime dependencies... ==> Checking buildtime dependencies... ==> Retrieving sources... -> Found downgrade-v11.2.0.tar.gz ==> Validating source files with md5sums...  downgrade-v11.2.0.tar.gz ... Passed ==> Removing existing $srcdir/ directory... ==> Extracting sources... -> Extracting downgrade-v11.2.0.tar.gz with bsdtar ==> Sources are ready. downgrade-11.2.0-1: parsing pkg list... ==> Making package: downgrade 11.2.0-1 (Thu 09 Jun 2022 10:50:28 AM UTC) ==> Checking runtime dependencies... ==> Checking buildtime dependencies... ==> WARNING: Using existing $srcdir/ tree ==> Entering fakeroot environment... ==> Starting package()... install -Dm644 conf/downgrade.conf "/home/test/.cache/paru/clone/downgrade/pkg/downgrade/etc/xdg/downgrade/downgrade.conf" install -Dm644 doc/downgrade.8 "/home/test/.cache/paru/clone/downgrade/pkg/downgrade/usr/share/man/man8/downgrade.8" install -Dm644 doc/pacignore.8 "/home/test/.cache/paru/clone/downgrade/pkg/downgrade/usr/share/man/man8/pacignore.8" for script in pacignore downgrade; do \ install -Dm755 "bin/$script" "/home/test/.cache/paru/clone/downgrade/pkg/downgrade/usr/bin/$script"; \ install -Dm644 "completion/$script/bash" "/home/test/.cache/paru/clone/downgrade/pkg/downgrade/usr/share/bash-completion/completions/$script"; \ install -Dm644 "completion/$script/zsh" "/home/test/.cache/paru/clone/downgrade/pkg/downgrade/usr/share/zsh/site-functions/_${script}"; \ install -Dm644 "completion/$script/fish" "/home/test/.cache/paru/clone/downgrade/pkg/downgrade/usr/share/fish/vendor_completions.d/${script}.fish"; \ done for po_file in locale/**/*.po; do \ locale="$(basename "$po_file" .po)"; \ script="$(basename "$(dirname "$po_file")")"; \ mkdir -p "/home/test/.cache/paru/clone/downgrade/pkg/downgrade/usr/share/locale/$locale/LC_MESSAGES/"; \ msgfmt "$po_file" -o "/home/test/.cache/paru/clone/downgrade/pkg/downgrade/usr/share/locale/$locale/LC_MESSAGES/${script}.mo"; \ done ==> Tidying install... -> Removing libtool files... -> Purging unwanted files... -> Removing static library files... -> Stripping unneeded symbols from binaries and libraries... -> Compressing man and info pages... ==> Checking for packaging issues... ==> Creating package "downgrade"... -> Generating .PKGINFO file... -> Generating .BUILDINFO file... -> Generating .MTREE file... -> Compressing package... ==> Leaving fakeroot environment. ==> Finished making: downgrade 11.2.0-1 (Thu 09 Jun 2022 10:50:29 AM UTC) ==> Cleaning up... loading packages... resolving dependencies... looking for conflicting packages... Package (1) Old Version New Version Net Change downgrade 11.1.0-1 11.2.0-1 0.02 MiB Total Installed Size: 0.07 MiB Net Upgrade Size: 0.02 MiB :: Proceed with installation? [Y/n] checking keyring... checking package integrity... loading package files... checking for file conflicts... :: Processing package changes... upgrading downgrade... :: Running post-transaction hooks... (1/1) Arming ConditionNeedsUpdate... Removing intermediate container 0b1dc8b5ba59 ---> efeb9e34f83a Step 14/15 : RUN which downgrade ---> Running in 587a89caedc2 /usr/sbin/downgrade Removing intermediate container 587a89caedc2 ---> 846f9bc5d757 Step 15/15 : RUN downgrade --version ---> Running in 1a4cc793f4de 11.2.0 Removing intermediate container 1a4cc793f4de ---> 84ba0c81fa6e Successfully built 84ba0c81fa6e Successfully tagged test_downgrade_issue_205:latest ```

Debugging

I am not sure if this error arose from paru or something more local. Do you encounter a similar error when you install the latest downgrade via makepkg (see helper commands below)?

$ git clone https://aur.archlinux.org/downgrade.git
$ cd downgrade
$ makepkg -si
amtoine commented 2 years ago

yay:

yay -S downgrade

gives me a similar issue

install: cannot stat 'bin//usr/local/bin': No such file or directory
install: cannot stat 'completion//usr/local/bin/bash': No such file or directory
install: cannot stat 'completion//usr/local/bin/zsh': No such file or directory
install: cannot stat 'completion//usr/local/bin/fish': No such file or directory
make: *** [Makefile:41: install] Error 1
==> ERROR: A failure occurred in package().
    Aborting...
 -> error making: downgrade

manual install via makepkg: and I get the exact same errors. i.e.

install: cannot stat 'bin//usr/local/bin': No such file or directory
install: cannot stat 'completion//usr/local/bin/bash': No such file or directory
install: cannot stat 'completion//usr/local/bin/zsh': No such file or directory
install: cannot stat 'completion//usr/local/bin/fish': No such file or directory
make: *** [Makefile:41: install] Error 1
==> ERROR: A failure occurred in package().
    Aborting...

with either makepkg -si or makepkg -cf

docker: the image and the build command you give work...

that looks like something local :sob:

atreyasha commented 2 years ago

Ah I see. Yes that seems like something local. My guess would be there is some (probably environmental) variable called script that gets defined as /usr/local/bin. Maybe your shell and pacman configs could be places to look.

AFAICT, this does not seem like a downgrade specific problem and I would be inclined to close this issue. But then again if this script variable is causing conflicts then we could rename it to something less generic like downgrade_script.

@pbrisbin WDYT?

pbrisbin commented 2 years ago

Since we can't seem to reproduce this, and the user can't reproduce in a clean environment (docker) either, I'd say it's not a bug on our end.

Since we're using a lower-case variable $script, I don't think we're in the wrong to expect that we own it and it's not coming in from the environment. If something is utilizing some kind of environment variable, it should be capitalized (IMO), exactly to prevent collisions such as this. That said, we could certainly choose some other variable name; there's little downside. Setting up some convention like $_script or $script_ for all our internal variables could be a good better-safe-than-sorry practice.

Personally, I suspect this is a zsh issue. It loves to use lower-case variables for things. If you (re)define a $path variable, it can cause all sorts of problems, for example. And "script" seems like a thing zsh may care about and set up its own variable for (e.g. "the currently executing file" or something).

amtoine commented 2 years ago

Really great job guys :ok_hand:

It was a purely local issue of mine indeed and I feel quite confused about that :eyes:

I immediattely understood that it was the $script variable the trouble maker :thinking: In fact, to launch my bspwm config, I export some environment variables, e.g. to control some bindings through sxhkd. I tried to make sure I export all of them with the WM_ prefix, precisely to avoid that kind of strange error! But $SCRIPT was not part of the WM_ familly :laughing:

It works just fine now, as all my bspwm, and WM in general, variables are exported with the WM_ prefix! :tada:

Thanks again @atreyasha and @pbrisbin for your fast and really good comments :wink: :star_struck: