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

Symlink fixup #11

Merged
merged 4 commits into from
May 29, 2019
Merged

Symlink fixup #11

merged 4 commits into from
May 29, 2019

Conversation

nigels-com
Copy link
Collaborator

It appears that PySquashfsImage doesn't currently support symlinks.

This change adds some support by ensuring that read_inode happens for both files and links.

To test this I used the current slack snap via: https://snapcraft.io/slack

Before:

$ python2 PySquashfsImage/PySquashfsImage.py slack_14.snap /lib/x86_64-linux-gnu
--------------/lib/x86_64-linux-gnu                              --------------
FOLDER /lib/x86_64-linux-gnu
	libbsd.so.0          <dir>
	libbsd.so.0.8.2      84976
	libdbus-1.so.3       84976
	libdbus-1.so.3.14.6  327216
	libexpat.so.1        327216
	libexpat.so.1.6.0    171056
	libglib-2.0.so.0     171056
	libglib-2.0.so.0.4800.2 1154768
	libjson-c.so.2       1154768
	libjson-c.so.2.0.0   48504
	libkeyutils.so.1     48504
	libkeyutils.so.1.5   18432
	libpcre.so.3         18432
	libpcre.so.3.13.2    460760
	libpng12.so.0        460760
	libpng12.so.0.54.0   156960
	libwrap.so.0         156960
	libwrap.so.0.7.6     39360

After:

$ python2 PySquashfsImage/PySquashfsImage.py slack_14.snap /lib/x86_64-linux-gnu
--------------/lib/x86_64-linux-gnu                              --------------
FOLDER /lib/x86_64-linux-gnu
	libbsd.so.0          ->
	libbsd.so.0.8.2      84976
	libdbus-1.so.3       ->
	libdbus-1.so.3.14.6  327216
	libexpat.so.1        ->
	libexpat.so.1.6.0    171056
	libglib-2.0.so.0     ->
	libglib-2.0.so.0.4800.2 1154768
	libjson-c.so.2       ->
	libjson-c.so.2.0.0   48504
	libkeyutils.so.1     ->
	libkeyutils.so.1.5   18432
	libpcre.so.3         ->
	libpcre.so.3.13.2    460760
	libpng12.so.0        ->
	libpng12.so.0.54.0   156960
	libwrap.so.0         ->
	libwrap.so.0.7.6     39360

And w.r.t the mounted snap on my filesystem:

$ ls -lah /snap/slack/14/lib/x86_64-linux-gnu/
total 2.4M
drwxr-xr-x 2 root root  441 May 22 12:59 .
drwxr-xr-x 3 root root   39 Sep 18  2018 ..
lrwxrwxrwx 1 root root   15 Jan 28  2016 libbsd.so.0 -> libbsd.so.0.8.2
-rw-r--r-- 1 root root  83K May 22 12:59 libbsd.so.0.8.2
lrwxrwxrwx 1 root root   19 Jan 13  2017 libdbus-1.so.3 -> libdbus-1.so.3.14.6
-rw-r--r-- 1 root root 320K May 22 12:59 libdbus-1.so.3.14.6
lrwxrwxrwx 1 root root   17 Jun 27  2017 libexpat.so.1 -> libexpat.so.1.6.0
-rw-r--r-- 1 root root 168K May 22 12:59 libexpat.so.1.6.0
lrwxrwxrwx 1 root root   23 Sep 18  2018 libglib-2.0.so.0 -> libglib-2.0.so.0.4800.2
-rw-r--r-- 1 root root 1.2M May 22 12:59 libglib-2.0.so.0.4800.2
lrwxrwxrwx 1 root root   18 Jan 13  2015 libjson-c.so.2 -> libjson-c.so.2.0.0
-rw-r--r-- 1 root root  48K May 22 12:59 libjson-c.so.2.0.0
lrwxrwxrwx 1 root root   18 Dec 11  2015 libkeyutils.so.1 -> libkeyutils.so.1.5
-rw-r--r-- 1 root root  18K May 22 12:59 libkeyutils.so.1.5
lrwxrwxrwx 1 root root   17 Mar 25  2016 libpcre.so.3 -> libpcre.so.3.13.2
-rw-r--r-- 1 root root 450K May 22 12:59 libpcre.so.3.13.2
lrwxrwxrwx 1 root root   18 Jul 11  2018 libpng12.so.0 -> libpng12.so.0.54.0
-rw-r--r-- 1 root root 154K May 22 12:59 libpng12.so.0.54.0
lrwxrwxrwx 1 root root   16 Jan 13  2014 libwrap.so.0 -> libwrap.so.0.7.6
-rw-r--r-- 1 root root  39K May 22 12:59 libwrap.so.0.7.6

@nigels-com
Copy link
Collaborator Author

With getLink:

$ python2 PySquashfsImage/PySquashfsImage.py slack_14.snap /lib/x86_64-linux-gnu
--------------/lib/x86_64-linux-gnu                              --------------
FOLDER /lib/x86_64-linux-gnu
	libbsd.so.0 -> libbsd.so.0.8.2
	libbsd.so.0.8.2                                                 84976
	libdbus-1.so.3 -> libdbus-1.so.3.14.6
	libdbus-1.so.3.14.6                                            327216
	libexpat.so.1 -> libexpat.so.1.6.0
	libexpat.so.1.6.0                                              171056
	libglib-2.0.so.0 -> libglib-2.0.so.0.4800.2
	libglib-2.0.so.0.4800.2                                       1154768
	libjson-c.so.2 -> libjson-c.so.2.0.0
	libjson-c.so.2.0.0                                              48504
	libkeyutils.so.1 -> libkeyutils.so.1.5
	libkeyutils.so.1.5                                              18432
	libpcre.so.3 -> libpcre.so.3.13.2
	libpcre.so.3.13.2                                              460760
	libpng12.so.0 -> libpng12.so.0.54.0
	libpng12.so.0.54.0                                             156960
	libwrap.so.0 -> libwrap.so.0.7.6
	libwrap.so.0.7.6                                                39360

@matteomattei matteomattei merged commit 06a0261 into matteomattei:master May 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants