Linuxbrew-core: readline bottle with broken access rights

Created on 14 Mar 2017  路  16Comments  路  Source: Homebrew/linuxbrew-core

  • [x] Ran brew update and retried your prior step?
  • [x] Ran brew doctor, fixed as many issues as possible and retried your prior step?
  • [x] Confirmed this is a problem with specific formulae and not Linuxbrew/brew? If it's a general Linuxbrew/brew problem please file this issue at https://github.com/Linuxbrew/brew/issues/new

The readline bottle has brocken access rights. Access is restricted to the current user and it's group. This is not the case with other bottles. Unfortunatelly, that breaks my use case - a central linuxbrew installation for all users.

If readline is installed using the bottle, the Cellar looks like this:

[linuxbrew@hammamet Cellar]$ ll -d readline
drwxr-x--- 3 linuxbrew linuxbrew 4096 Mar 12 08:28 readline
[linuxbrew@hammamet Cellar]$ ll readline
total 4
drwxr-x--- 6 linuxbrew linuxbrew 4096 Mar 14 16:16 7.0.3_1
[linuxbrew@hammamet Cellar]$ ll readline/7.0.3_1/
total 180
-rw-r----- 1 linuxbrew linuxbrew 33469 Sep  7  2016 CHANGELOG
-rw-r----- 1 linuxbrew linuxbrew 65553 Sep  7  2016 CHANGES
-rw-r----- 1 linuxbrew linuxbrew 35147 Sep  7  2016 COPYING
drwxr-x--- 3 linuxbrew linuxbrew  4096 Mar 14 16:16 include
-rw-r----- 1 linuxbrew linuxbrew   600 Mar 14 16:16 INSTALL_RECEIPT.json
drwxr-x--- 2 linuxbrew linuxbrew  4096 Mar 14 16:16 lib
-rw-r----- 1 linuxbrew linuxbrew 12679 Sep  7  2016 NEWS
-rw-r----- 1 linuxbrew linuxbrew  8028 Sep  7  2016 README
drwxr-x--- 6 linuxbrew linuxbrew  4096 Mar 12 08:27 share
[linuxbrew@hammamet Cellar]$ ll readline/7.0.3_1/lib/
total 932
-r--r----- 1 linuxbrew linuxbrew  52382 Sep  7  2016 libhistory.a
lrwxrwxrwx 1 linuxbrew linuxbrew     15 Mar 14 16:16 libhistory.so -> libhistory.so.7
lrwxrwxrwx 1 linuxbrew linuxbrew     17 Mar 14 16:16 libhistory.so.7 -> libhistory.so.7.0
-r-xr-x--- 1 linuxbrew linuxbrew  47672 Mar 14 16:16 libhistory.so.7.0
-r--r----- 1 linuxbrew linuxbrew 511662 Sep  7  2016 libreadline.a
lrwxrwxrwx 1 linuxbrew linuxbrew     16 Mar 14 16:16 libreadline.so -> libreadline.so.7
lrwxrwxrwx 1 linuxbrew linuxbrew     18 Mar 14 16:16 libreadline.so.7 -> libreadline.so.7.0
-r-xr-x--- 1 linuxbrew linuxbrew 338264 Mar 14 16:16 libreadline.so.7.0

Furthermore, there are some Mac OS specific remains in the bottle, that prevent solving the problem easily by simply reinstalling from source - the access rights of the readline directory are still wrong.

[linuxbrew@hammamet Cellar]$ brew uninstall --force --ignore-dependencies readline
Uninstalling readline... (105 files, 1.8M)
[linuxbrew@hammamet Cellar]$ ll -d readline
drwxr-x--- 2 linuxbrew linuxbrew 4096 Mar 14 16:28 readline
[linuxbrew@hammamet Cellar]$ ll -a readline/
total 24
drwxr-x---  2 linuxbrew linuxbrew 4096 Mar 14 16:28 .
drwxrwxr-x 22 linuxbrew linuxbrew 4096 Mar 14 16:15 ..
-rwxr-x---  1 linuxbrew linuxbrew  212 Mar 12 08:27 ._7.0.3_1
-rw-r--r--  1 linuxbrew linuxbrew  120 Mar 12 08:34 ._.DS_Store
-rw-r--r--  1 linuxbrew linuxbrew 6148 Mar 12 08:34 .DS_Store

Only after deleting these remains and reinstalling from source, the Cellar looks like this - consistent with other packages:

[linuxbrew@hammamet Cellar]$ rm -rf readline/
[linuxbrew@hammamet Cellar]$ brew install --build-from-source readline
...(omitted)...
馃嵑  /export/linuxbrew/.linuxbrew/Cellar/readline/7.0.3_1: 46 files, 1.7M, built in 14 seconds
[linuxbrew@hammamet Cellar]$ ll -d readline
drwxrwxr-x 3 linuxbrew linuxbrew 4096 Mar 14 16:30 readline
[linuxbrew@hammamet Cellar]$ ll readline
total 4
drwxrwxr-x 6 linuxbrew linuxbrew 4096 Mar 14 16:30 7.0.3_1
[linuxbrew@hammamet Cellar]$ ll readline/7.0.3_1/
total 180
-rw-r--r-- 1 linuxbrew linuxbrew 33469 Jan 22  2016 CHANGELOG
-rw-r--r-- 1 linuxbrew linuxbrew 65553 Aug 23  2016 CHANGES
-rw-r--r-- 1 linuxbrew linuxbrew 35147 Aug 12  2008 COPYING
drwxrwxr-x 3 linuxbrew linuxbrew  4096 Mar 14 16:30 include
-rw-rw-r-- 1 linuxbrew linuxbrew   618 Mar 14 16:30 INSTALL_RECEIPT.json
drwxrwxr-x 2 linuxbrew linuxbrew  4096 Mar 14 16:30 lib
-rw-r--r-- 1 linuxbrew linuxbrew 12679 Jan 22  2016 NEWS
-rw-r--r-- 1 linuxbrew linuxbrew  8028 Jul  2  2015 README
drwxrwxr-x 6 linuxbrew linuxbrew  4096 Mar 14 16:30 share
[linuxbrew@hammamet Cellar]$ ll readline/7.0.3_1/lib
total 912
-r--r--r-- 1 linuxbrew linuxbrew  52030 Mar 14 16:30 libhistory.a
lrwxrwxrwx 1 linuxbrew linuxbrew     15 Mar 14 16:30 libhistory.so -> libhistory.so.7
lrwxrwxrwx 1 linuxbrew linuxbrew     17 Mar 14 16:30 libhistory.so.7 -> libhistory.so.7.0
-r-xr-xr-x 1 linuxbrew linuxbrew  43384 Mar 14 16:30 libhistory.so.7.0
-r--r--r-- 1 linuxbrew linuxbrew 510366 Mar 14 16:30 libreadline.a
lrwxrwxrwx 1 linuxbrew linuxbrew     16 Mar 14 16:30 libreadline.so -> libreadline.so.7
lrwxrwxrwx 1 linuxbrew linuxbrew     18 Mar 14 16:30 libreadline.so.7 -> libreadline.so.7.0
-r-xr-xr-x 1 linuxbrew linuxbrew 322272 Mar 14 16:30 libreadline.so.7.0

Additionally, those MacOS remains are obviously gone.

bug outdated

All 16 comments

Very strange. I'll look into it and get back to you, Roland. Thanks for reporting the bug.

Unfortunatelly, that breaks my use case - a central linuxbrew installation for all users.

I've been asked for instructions by other users on how to set up such an installation. Would you like to write an instructional page on the Linuxbrew wiki? It's world writable.
https://github.com/Linuxbrew/brew/wiki

Not sure how exactly this happened but this is my fault. :/ Will try to fix this.

@rschwarzkopf thank you for noticing the permissions issue! i started a multi-user cluster wide reinstall of brew yesterday and this issue had been driving me nuts 馃槱

Should be fixed in 45a0911
I'm really sorry guys 馃

Looks good - I just did a complete reinstallation and everything works as expected.

@sjackman I'm not quite finished yet, I still need to write and test sudo rules, an update cronjob, etc. As soon as that is done, I can write an instruction page..

That'd be great. Thanks, Roland.

@sjackman @maxim-belkin this doesn't really solve the problem though? only the bottle has has been changed for linux? so if i have it installed, it won't reinstall it. and if i force it, it will re-use the broken cached one on my system? or compile from source -> same problem?

i had to force remove, manually delete the cache etc. regular users will never manage to figure that @out?

needs a revision 2 ?

Strictly speaking, you are right. But impacted user-base should be minimal. When homebrew/core is updated, only sha256 for the bottle is updated. So, if a user tries to upgrade Linuxbrew, brew will decide that readline is already installed and will not reinstall it (this is bad). However, if a user does a reinstall, brew will detect that downloaded bottle file has a different sha256 and will build readline from source. If the bottle file has been previously deleted (like you did), then brew will download and install the new bottle. So, only those users who installed readline while the bottle was bad are impacted.

@maxim-belkin I have this problem still?
the permissions are ok IN the folder but not in the overall folder?
see . permissions drwxr-x---. below.
even when i force uninstall this folder + permissions remains.

ls -lsa /home/linuxbrew/.linuxbrew/Cellar/readline/
total 36
 0 drwxr-x---.   3 linuxbrew linuxbrew    90 Mar 16 08:33 .
16 drwxrwxr-x. 428 linuxbrew linuxbrew 12288 Mar 16 08:48 ..
 8 -rw-r--r--.   1 linuxbrew linuxbrew  6148 Mar 12 18:34 .DS_Store
 4 -rw-r--r--.   1 linuxbrew linuxbrew   120 Mar 12 18:34 ._.DS_Store
 4 -rwxr-x---.   1 linuxbrew linuxbrew   212 Mar 12 18:27 ._7.0.3_1
 4 drwxr-xr-x.   6 linuxbrew linuxbrew  4096 Mar 16 08:33 7.0.3_1

BUT if i manually rm -fr readline folder, and re-install, the permissions are fixed.
I'm not sure where the parent readline folder is made or updated.
Very weird.

So my brew uninstall --force readline && rm -fr /home/linuxbrew/.linuxbrew/Cellar/readline/ && brew install readline it seems to be ok.

Eep. Thanks for the workaround, Torsten. Sorry for the mess. For anyone else that stumbles on this issue, to delete the cached bottle:

rm -f `brew --cache ncurses`
# same as
rm -f ~/.cache/Homebrew/ncurses-6.0_2.x86_64_linux.bottle.tar.gz

s/ncurces/readline/g

It wouldn't normally be a problem. But readline is used by so many things.

Somehow my system installed brew gawk which depends on readline and provides the symlink to awk. So everything broke!

Thanks for fixing this. I am just worried that less technically capable people will have major problems.

from here:

question:what is the Dot at the end of permission of a file:
Answer: This mean this file has SELINUX context.

hope you got a clue or someone who has same question.

thanks

@maxim-belkin i'm not sure what you are trying to say with that example?

Oi. For anyone else that stumbles on this issue, to delete the cached bottle:

rm -f `brew --cache readline`
# same as
rm -f ~/.cache/Homebrew/readline-7.0.3_1.x86_64_linux.bottle.tar.gz
Was this page helpful?
0 / 5 - 0 ratings