coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

install: arch - yay build may failed due to not finding or permissions of files in cache

Open AndreasBrostrom opened this issue 3 years ago • 10 comments
trafficstars

Upgrading packaged on arch using yay (to build google-chrome as example) may fail due to missing permissions to folder or not being able to find files in there it self.

Test case:

#!/bin/sh
export projRoot=$HOME/TestError/
export projDest=$HOME/TestError/dest/

mkdir -p $projRoot/
mkdir -p $projRoot/src/
mkdir -p $projRoot/dest/

cd $projRoot

touch test.sh
ln -fs /opt/FakeDestination "$projDest"test.sh # Fake destination

# Permissions 
chmod +x test.sh

cd $projRoot/src/
ln -sf $projRoot/test.sh test.sh

install "$projRoot"test.sh "$projDest"test.sh

AndreasBrostrom avatar May 25 '22 10:05 AndreasBrostrom

I am sorry but I don't see how this bug is actionable ?!

sylvestre avatar May 25 '22 10:05 sylvestre

Removing the rewrite of install and using the default does not causes this issue.

AndreasBrostrom avatar May 25 '22 10:05 AndreasBrostrom

ok but sorry: not providing any step to reproduce or error message isn't helping.

sylvestre avatar May 25 '22 11:05 sylvestre

Sorry, fixed with log as well as with a StR.

AndreasBrostrom avatar May 25 '22 11:05 AndreasBrostrom

Thanks but the str should be simple test case, not install Chrome with a package manager ;)

sylvestre avatar May 25 '22 11:05 sylvestre

It's the easiest way of replicate it ;D Unsure exactly what is up else i would have done a better test case.

AndreasBrostrom avatar May 25 '22 11:05 AndreasBrostrom

we need something like

$ mkdir foo
$ install --fail-option foo bar
KABOOM

sylvestre avatar May 25 '22 12:05 sylvestre

Took me some digging.

The problem here is the softlink ln -fs /opt/FakeDestination "$projDest"test.sh were it seams to check the permission for the destination with or without it existence or relevance to what it is about to do.

From tar files (reason why this fails) there are softlinks going to non existing or existing paths.

In the google-chrome example above for instance there is a couple of softlinks inside of data.tar.xz after unpacking and attempt to replace them permissions is checked for the non existing file /opt/google/chrome/google-chrome and permissions are denied. (i could be wrong but it seamed to me like a plausible explanation to why ^^)

Here is a script setting up and making the problem happen.

#!/bin/sh
export projRoot=$HOME/TestError/
export projDest=$HOME/TestError/dest/

mkdir -p $projRoot/
mkdir -p $projRoot/src/
mkdir -p $projRoot/dest/

cd $projRoot

touch test.sh
ln -fs /opt/FakeDestination "$projDest"test.sh # Fake destination

# Permissions 
chmod +x test.sh

cd $projRoot/src/
ln -sf $projRoot/test.sh test.sh

install "$projRoot"test.sh "$projDest"test.sh

AndreasBrostrom avatar May 30 '22 09:05 AndreasBrostrom

Thanks; i updated comment #0

sylvestre avatar May 30 '22 09:05 sylvestre

i took this issue and tried to address it in the pull request #5851

cre4ture avatar Jan 17 '24 15:01 cre4ture