Giter VIP home page Giter VIP logo

libappimage's People

Contributors

a1batross avatar azubieta avatar fabiololix avatar gholmann16 avatar hyperupcall avatar kossebau avatar mid-kid avatar probonopd avatar scarlettgatelymoore avatar srevinsaju avatar theassassin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

libappimage's Issues

32bit AppImage with size bigger than 2GB not working

When I built an large (5GB) x86 AppImage on my x86_64 openSUSE linux I get the following error when running it:

Cannot open /proc/self/exe: Value too large for defined data type
Failed to get fs offset for /proc/self/exe

It seems my image is too big. A friend of mine is using Ubuntu and for him the generated AppImage works fine.
Since it's a video game with packed size of 5GB I can't get it smaller.
I googled a lot and found out the following. Maybe I need to rebuild some of my software stack (maybe coreutils) with the following gcc option

 -D_FILE_OFFSET_BITS=64

But I think this is already activated on my whole software stack, because this is stuff which changed in like 2006. But of course I'm not sure.

I successfully built x86 appimages (also games) which are smaller than 2GB which work flawlessly.

Strace prints the following line when executing the binary

[...]
open("/proc/self/exe", O_RDONLY)        = -1 EOVERFLOW (Value too large for defined data type)
write(2, "Cannot open /proc/self/exe: Valu"..., 66Cannot open /proc/self/exe: Value too large for defined data type
[...]

I'm using openSUSE 42.3 x86_64 with the default kernel.

If you need any more info, just ask.
Thank you in advance

Implement a proper logging system

Currently, libappimage logging is controlled by the "verbose" boolean parameter on some of the public interface functions. This method doesn't allow specifying verbosity levels or pretty printing errors.

missing cmake check for libfuse

When trying to compile libappimage, it dies during building of squashfuse, unless libfuse development files are installed, but a cmake check for that is missing

Add symlinks support to the ResourcesExtractor

The resources extractor currently trust on the read method to resolve links while reading the files. As both, libarchive and squashfuse, don't support to move backward or directly accessing an entry while iterating resolving a link implies to re-iterate the payload file system until a regular file is found. This could be improved by building a cache of the existent links in a first iteration so the regular files can be properly extracted in the second.


This may be also a good opportunity to improve the constructor using an enum to describe the different resources to be extracted.

Implement LoopsDetector

Detecting loops while extracting/reading files from the AppImage Payload is a common procedure in several parts. It would be nice to group all the implementations into a single class.

cmake LIBAPPIMAGE_LIBRARIES missing

When I compile libappimage and try to use it in KDE's KFileMetaData (https://phabricator.kde.org/D18450), cmake configuration fails with:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
LIBAPPIMAGE_LIBRARIES
linked by target "kfilemetadata_appimageextractor" in directory /path_to_folder/kfilemetadata/src/extractors
linked by target "appimageextractortest" in directory /path_to_folder/kfilemetadata/autotests

Configuring incomplete, errors occurred!
See also "/path_to_folder/build-kfilemetadata-Desktop-Default/CMakeFiles/CMakeOutput.log".
CMake Project parsing failed.

This is on Kubuntu 18.10.

I'm not super experienced with this, so this may also be a problem on my side.

How do deal with distributions?

How do deal with distributions?

By the time libappimage lands in debian stable or the oldest still-supported Ubuntu LTS, we will long have moved on.

Can we somehow enforce that every user of this library bundles their own private copy, ensuring that once this is in debian stable or the oldest still-supported Ubuntu LTS, people don't use that outdated version but the most recent one?

appimage_type2_get_desktop_filename_and_key_file doesn't load symlinked desktop files

While looking into TheAssassin/AppImageLauncher#97, I found that if an AppImage uses a symlink for the root desktop file (IIRC linuxdeploy uses that method, too), appimage_type2_get_desktop_filename_and_key_file will report success and returns the correct path, however g_key_file_load_from_squash doesn't support reading from symlinks, and fails to create the GKeyFile instance. For some reason, however, that function doesn't report an error. It makes the assumption that if a file is found in the root directory, it's a regular file. That is not acceptable.

We must:

  • change the function to return an error if loading of the key file fails
  • make that function aware of symlinks

CC @azubieta would appreciate if you could look into that ASAP.

libappimage 0.2.0 proposal

LibAppImage is the foundation of all AppImage tools, therefore, it should provide a consistent and functional API for all of its clients. Currently, its state is not the best among the most prominent issues we found:

  • duplicated code
  • unnecessary (utilities) entries at the public interface
  • mixed concerns: file examination and desktop integration
  • missing file examination functionalities (list files, extract files, appimage files traversal)
  • dependencies included as submodules. Not all libs are made to be used as submodules but every lib is made to be used in the traditional way (installed in the system). Using submodules also temp to the developer to use the inner sections of the lib which are not expected to be consistent between version, which will produce build fails and increase the maintenance work.

As a major modification of the public interface and the inner implementation is required it would be a good idea to use this opportunity to improve the code-base and ease maintenance by rewriting it in modern C++ .

It's purposed to split the current libappimage.so in two different dynamic shared objects (DSOs): libappimage and libappimage-desktop-integration. Both will be produced from the same code base (the libappimage project). Besides the DSO version, there will be a static version with will have zero external dependencies in order to allow its usage by third-party projects that don't want to depend on the whole libstd++. The public headers files will be kept in bare C initially also to increase compatibility, an additional C++ interface could be published later.

The libappimage module will be responsible for: reading AppImage files information and contents extraction.

The libappimage-desktop-integration module will be responsible for: performing the desktop integration and disintegration of applications packed into AppImages.

Move to/delete from $HOME/.local/share transactionally (all at once)

Currently libappimage directly extracts e.g., desktop files directly to $HOME/.local/share (or deletes them from) on each invocation of

  • appimage_type1_register_in_system
  • appimage_type2_register_in_system
  • appimage_unregister_in_system

Each change in /.local/share can trigger local caches such as Sycoca to be re-generated, which results in a lot of CPU activity.

So we should also apply the same logic that @rszibele used in AppImageCommunity/appimaged#50 to all files (desktop files, icon files, mime type files and such) that get copied to HOME/.local/share for system integration.

We should only atomically (=everything in one go) move files to (from a temporary location to which they get extracted and modified in) or delete files from $HOME/.local/share after a certain timer of inactivity has passed.

We should do all editing/rewriting of desktop files outside of HOME/.local/share in a separate directory.

This will solve:

Review (and fix) symlink handling in type 1 code

While working on #9, I added a new function, which lacked symlink handling in the type 2 code at first. Therefore, I refactored the code to be more useful, fixed a few annoyances, and implemented some actual error handling (which is missing in the majority of the legacy code of libappimage right now).

Since I didn't encounter issues for type 1 yet, I didn't work on that. However, also that code base should be reviewed, and perhaps refactored soon.

Run programs to update desktop integration

AppImageCommunity/appimaged#50 from @rszibele needs to be ported over here.

It checks if the following programs are available in the users $PATH:

  • update-desktop-database
  • update-mime-database
  • gtk-update-icon-cache
  • kbuildsycoca5

Based on the availability of each program, it executes each of them within a thread if more than 3 seconds have passed since the last AppImage was added. If another AppImage is dropped into one of the watched directories while still within the 3 seconds, then the timer is reset. So if suddenly a user drops 20 AppImages into the directory, the update will only be executed once.

.DirIcon extraction broken since #14

The icons get extracted (in a pretty naive but apparently working way, to .local/share/icons/hicolor/32x32/apps, ignoring the format and the resolution, which works fine). Pretty sure it's been done like that forever (I doubt @azubieta changed the basic algorithm), however, since the rewriting in #14, this extraction doesn't add the file extension to the icon any more, producing bugs like TheAssassin/AppImageLauncher#105. appimaged is only broken because we didn't update libappimage in there for a while.

The breaking commit is IMO 7f390f6.

TODO:

  • add unit test that breaks because of this bug
  • fix bug in an elegant way

Lots of directories created in /tmp

When diagnosing why my main system started to take a long time to boot, I was shocked to discover that there were approximately more than 30K directories all starting with libappimage- This is totaling to about 130+ GB of data. They all seem to have sizes of 4.0 KB each. Unfortunately, I can't give more exact details about this since I have deleted all of them already. Is this normal behavior or not?

Replace regular expressions for performance

Based on the results of AppImageCommunity/appimaged#53, regular expressions seem to be really CPU intensive.

Hence, we should replace them with something more efficient. Possibly fnmatch(3) would be more efficient (to be verified),

After having replaced regular expressions with something else, please test that

  • --appimage-extract still works with * wildcards
  • appimaged consumes significantly less CPU

Apply a coding style to cmake files

The current CMake files are made from snippets from different parts and they don't follow a given style. In order to improve the overall project readability, we must define and apply a code style to all cmake files.

Thumbnail generation at libappimage

One of the functionalities that are still missing at libappimage_0.2 is the thumbnails generation. A correct implementation of the standard will require using some image manipulation library (which are known to be huge). The current implementation is really naive as it ignores the Images size and format.

I consider that a correct implementation can easily be achieved by a third party tool without size or linking dependencies restrictions like "appimaged" or "AppImageLaunher". So I would like to leave it out of our public interface.

@probonopd @TheAssassin comments are welcome

This issue is related to #33

Release v1.0.0

Until the end of March, I'd like to release libappimage 1.0.0. Being the first stable release we ever provide, this marks a milestone in our development history. This library has been largely rewritten, and now the codebase is ready for more public usage.

KDE application menu does not show icons until user logs out and in again

When integrating, we should rewrite desktop files to use an absolute Icon= path. This will

  • Prevent from rendering issues when the icon size does not match the size of the icon theme directory (at least on some desktops, see below)
  • Remove the need to log out and log in again after having installed appimaged/AppImageLauncher and similar tools

libappimage 0.2 tests code coverage

In order to have a reliable code base and to not jump blindly into a release, libappimage 0.2 must have an overall code coverage indicator of 90%. This issue is to keep @probonopd and @TheAssassin aware of the progress.

To reproduce the results run:

cmake -DBUILD_COVERAGE_TESTS=On .
make -j`nproc`
make tests_code_coverage

Expose a more low-level api

At the moment the functions exposed by appimage.h only allow to do very high level things with the appimage, such as directly installing it, directly creating a thumbnail.

However, being it a generic library to handle appimages I think it would be more useful if it exposed in addition to the functions already present, which are very useful already, a few lower level functions and the main handler struct. Which would allow a developer using the library to have more control especially on the registration of the image in the system, to customise the process.

For example, i am trying to develop a thumbnailer for any appimage, that could be registered along with the other system thumbnailers in /usr/share/thumbnailers (in Arch Linux at least), however the appimage_create_thumbnail function does not allow me to choose where to create it.

Another example is theming, as I do believe, although I haven't verified it yet, that placing an icon in the .local/share/icons folder overrides automatically any icon theme, and furthermore no theme provides icons named app_6a8124552b098217d5f7c428fe2a1ab8, so may like to be able to place them somewhere else...

It seems to me that as it is at the moment, this library is more of a libappimagetools than a libappimage, if this makes it clearer :)

Edit: /usr/share/thumbnailers only applies to Nautilus and Nemo

Replacing elf file reading functions by libelf or LIEF

As part of the libappimage rewrite on C++, it's proposed to replace our own ELF files reading functions by a more widely used and tested ones. Those will be libelf and LIEF. The positive aspects of this change are that we will reduce our codebase and the need for maintaining that part. The negative: we will have another dependency.

  1. libelf
  • size: ~200 kb
  • license: LGPL
  1. LIEF
  • size: ~ 2Mb
  • license: Apache

Is it viable to have it? Does it imply any licensing issues?

Refactor dynamic library handling

The dynamic library handling, specifically the handler code for image processing libraries, should be moved into a proper separate module and receive proper unit tests.

Continuation of #33 (comment).

Allow return value in AppImage traversal

At the moment, we have type-specific functions called appimage_handler::traverse (if it were C++), which call a callback on every path that matches a given pattern.

The callbacks usually perform name comparisons, for instance:

if (strcmp(params->file_path, filename) == 0)
    // do something meaningful

As you can see, in this common case, the callback is only supposed to be run once when the right file has been found, as the comparison checks for equal strings. However, even if the file is found, the loop will continue to call the callback on all the files left in the AppImage.

This is highly inefficient, but luckily, we're not the first ones to solve this problem. There is an elegant way to allow for some "feedback" from the callback to the caller: we simply change the callbacks' return values from void to bool. Whenever the callback returns true, the loop in traverse can be aborted.

Depending on the location of the given path, this will greatly speed up use cases such as appimage_extract_file_following_symlinks. Also, our dummy functions which we use for testing can become no-ops (O(1) instead of O(n)).

CC @azubieta @probonopd if you have any points why this is a bad idea, please let me know.

Fix libappimage_static

The static linked binaries of libappimage are not being installed and its cmake target is not properly configured which makes it unusable by third parties.

Spelling error in binary

`Index: libappimage/src/libappimage_shared/elf.c

--- libappimage.orig/src/libappimage_shared/elf.c 2019-01-09 05:42:49.721466452 -0700
+++ libappimage/src/libappimage_shared/elf.c 2019-01-11 09:07:48.259236674 -0700
@@ -136,7 +136,7 @@
}
if ((ehdr.e_ident[EI_DATA] != ELFDATA2LSB) &&
(ehdr.e_ident[EI_DATA] != ELFDATA2MSB)) {

  •   fprintf(stderr, "Unkown ELF data order %u\n",
    
  •   fprintf(stderr, "Unknown ELF data order %u\n",
      	ehdr.e_ident[EI_DATA]);
      return -1;
    
    }`

Incomplete CMake Config file

As @kossebau show at #17 the CMake config file is incomplete. The libappimage has issues with it's dependencies. Which are mostly public and client projects fail at linking against them.

This linking error is produced because of the name of the targets which are not recreated in the config file.

Avoid icon/mime clobbering by using <icon name=... />

Running the latest appimaged from downloads, I'm observing the following behavior on Ubuntu 14.04 LTS:

  1. Placing <project>.AppImage in ~/Downloads successfully triggers the appimage_register_in_system.
  2. During registration, appimaged copies <project>.xml to $HOME/.local/share/mime/packages and names it appimage_<hash>_<project>.xml.
  3. During registration, appimaged copies <mime-icon>.svg to $HOME/.local/icons/hicolor/scalable/mimetypes and names it appimage_<hash>_<mime-icon>.svg.

What seems to be missing is, the xml still references the original .svg by it's original name, so the icon never shows up in Nautilus, regardless of how many times you restart nautilus or logout of the Desktop.

Here's an example xml. For demonstration purposes, I'll call this project "starbright".

Mime Package

  • mime/packages/starbright.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
      <mime-type type="application/x-starbright-file">
        <!---          ^-- EXPECTS icon to be named e.g. application-x-starbright-file.svg  -->
        <sub-class-of type="application/xml"/>
        <comment>Starbright File</comment>
        <glob pattern="*.starb"/>
      </mime-type>
    </mime-info>

Mime Icon

  • icons/hicolor/scalable/mimetypes/application-x-starbright-file.svg

What happens is appimaged does the following:

  1. Copies
    <AppImage>/share/mime/packages/starbright.xml -->

    $HOME/.local/share/mime/packages/appimaged_d41d8cd98f00b204e9800998ecf8427e_starbright.xml
    ✅ Good!
  2. Copies
    <AppImage>/share/icons/hicolor/scalable/mimetypes/application-x-starbright-file.svg -->

    $HOME/.local/share/icons/hicolor/scalable/mimetypes/appimaged_d41d8cd98f00b204e9800998ecf8427e_application-x-starbright-file.svg
    ⛔️ This causes problem

Now the mime type value inside the xml file is mismatched from its respective icon. Is this a limitation of the mimetype support for this OS, or is there a gap in functionality with the way the icon is currently being installed?

<?xml version="1.0" encoding="UTF-8"?>
   <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
-     <mime-type type="application/x-starbright-file">
+     <!-- Help! How to reference after rename? -->
+     <mime-type type="appimaged_d41d8cd98f00b204e9800998ecf8427e_application/x-starbright-file">
         <sub-class-of type="application/xml"/>
         <comment>Starbright File</comment>
         <glob pattern="*.starb"/>
      </mime-type>
   </mime-info>
</xml>

If the svg name is copied to hicolor/scalable/mimetypes/application-x-starbright-file.svg (without the appimaged_d41d8cd98f00b204e9800998ecf8427e_ prefix), the icon will show up.

Review PayloadIterator public interface

The PayloadIterator provides an SLT friendly interface to traverse the files contained in the AppImage payload. It directly provides access to the entry path by means of operator*() and to the rest of entry properties by means of other function in the same class. This design mostly influenced by the limitations of libarchive and squashfuse.

Creating PayloadEntry objects seems to be a wrong approach as our back-end doesn't allow to keep references to a single entry while traversing.

This issue was opened to give another review to the design.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.