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

Make AppImageTool OSX friendlier #466

Merged
merged 24 commits into from
Sep 30, 2017

Conversation

teras
Copy link
Contributor

@teras teras commented Sep 2, 2017

No description provided.

@teras teras force-pushed the appimagetool/master branch from 653a8e3 to dfa45a6 Compare September 2, 2017 23:29
@probonopd
Copy link
Member

Please remove LGPL osx_elf.h as its license is incompatible with this project. A few definitions from it (the ones regarding Intel and ARM 32-bit and 64-bit) should be sufficient, after all.

@TheAssassin
Copy link
Member

The entire squashfs_osx.patch file is indented with tabs instead of the 4 spaces used in the rest of the projects. Please fix that.

I'll post a more detailed review when I get to it.

@teras
Copy link
Contributor Author

teras commented Sep 3, 2017

About osx_elf : done. I am not sure if this changes anything license wise though.
It doesn't mean anything else if you are linking with system file or provided file; the license is the same.

About tabs, I hate tabs too, but this is how the original source and patch is. I'd prefer not to change anything on a code that is outside the scope of this codebase.

@teras
Copy link
Contributor Author

teras commented Sep 3, 2017

I created also a patch to support gpg & shashum, which are almost the same with their equivalent gpg2 and sha256sum. My only question is how to display the name to the user. I preferred the gpg[2] and sha[256]sum, which is more condensed. Ideas welcome.

@teras teras force-pushed the appimagetool/master branch from 1b9f560 to 6df5fc0 Compare September 3, 2017 13:32
@teras teras force-pushed the appimagetool/master branch from 2698d10 to 2416bce Compare September 3, 2017 15:09
Copy link
Member

@TheAssassin TheAssassin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a lot of potential for improvements in this PR. You tried to follow the overall code style at least in the files which were existing already, but the new file breaks with the existing style.

At some point I stopped analyzing the PR, as the review got quite long. Many of the mentioned points are valid for other sections as well, e.g., my words about the architecture code.

I'd ask you to fix some of the issues, or to start a discussion. After fixing these points, I'd review the PR again.

appimagetool.c Outdated
#define fARCH_i386 0
#define fARCH_x86_64 1
#define fARCH_arm 2
#define fARCH_aarch64 3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be an enum. Even if it stayed a set of defines, the alignment of numbers should be fixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct.

appimagetool.c Outdated

if ((sp = strstr(line, search))) {
replacestr(line, search, replace);
char* readFile(char* filename, int* size) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As said before, I don't like this function's signature. It should be changed to void. Or, while I think about it, a bool would be a lot better, that returns false in case of errors.

appimagetool.c Outdated
// sprintf (guessed_bin_path, "%s/usr/bin/%s", source, g_strsplit_set(get_desktop_entry(kf, "Exec"), " ", -1)[0]);
// archfile = guessed_bin_path;
archfile = "/proc/self/exe";
char archs[4];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this a char array?

appimagetool.c Outdated
{
printf("The architecture could not be determined, assuming 'all'\n");
arch="all";
if (archs[fARCH_x86_64]) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not very fond of this mix of representation and actual data gathering. I'd rather have used a little for loop to count the architectures, and then render the output. Also, you're overwriting the arch variable even when there's multiple architectures. I'd rather have rendered the actually found architectures into the error message, and then created the arch variable afterwards.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

appimagetool.c Outdated
char* data;
if (runtime_file) {
data = readFile(runtime_file, &size);
if (!data)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As said above, I don't like the API of this function, and therefore don't like this kind of error handling. Comparing a pointer here can be really problematic, and is not really straightforward. If any, you need to do both, check for the pointer and check for a return value from a boolean function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a null check, as you asked

getsection.c Outdated
@@ -1,4 +1,9 @@
#include <elf.h>
#ifdef __APPLE__
#include "osx_elf.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment for elf.c.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, I didn't understand that

osx_elf.h Outdated
@@ -0,0 +1,103 @@
/* This is a derivative work of the elf.h file from the GNU C Library */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line suggests that the file is licensed under the LGPL. This license is incompatible with the rest of the project. This is a major problem, and thus the PR cannot be merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, I'll copy the symbols from https://github.com/torvalds/linux/blob/master/include/uapi/linux/elf.h

is that better?

osx_elf.h Outdated
/* This is a derivative work of the elf.h file from the GNU C Library */

#ifndef _ELF_H
#define _ELF_H 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tab needs to be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it were on the original file - now the whole file is properly indented.

osx_elf.h Outdated

typedef struct
{
unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tabs for indentation are not used by the rest of the project. You will have to change the indentation of the entire file.

@@ -0,0 +1,434 @@
diff --git a/squashfs-tools/action.c b/squashfs-tools/action.c
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, the tabs in this file are totally justified by the fact that the upstream project uses them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

@teras teras force-pushed the appimagetool/master branch from f68f1f5 to 4b0cb26 Compare September 4, 2017 06:46
@teras
Copy link
Contributor Author

teras commented Sep 4, 2017

The changes have been applied... please have a look


__END_DECLS

#endif /* elf.h */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is still licensed as GNU GPL. This license is not compatible with the rest of the code base. This is a really big problem, and we cannot risk a GPL violation by relicensing the extracted code. You will have to write it yourself, I guess, and change the variable and macro names etc. The file doesn't have to be compatible to any other code any more, especially since this is going to be used on both Linux and OS X.

@teras teras force-pushed the appimagetool/master branch from 0eee828 to 8db00f0 Compare September 4, 2017 18:50
@teras
Copy link
Contributor Author

teras commented Sep 8, 2017

I have the feeling that #471 is mutually exclusive with this, patch, since it references the exact same location with memory management, while this patch also takes into account external binary files. My humble opinion is, if possible, to fix possible issues with this patch, apply it if you want and then take care of #471, who is indeed dependent on this tool being multi-platform first. Otherwise external files patch will not apply and maybe it will fail on other locations too.

EDIT: I just saw that you have already applied the patches I was afraid of, thus this patch does not apply clean any more...

@probonopd
Copy link
Member

#471 is not applied yet, since it doesn't build "green" yet...

@probonopd
Copy link
Member

probonopd commented Sep 11, 2017

Thank you, great work @teras and throrough reviews @TheAssassin. It builds "green" now, and I'd really like to get this merged soon. But that will require all GPL code to be replaced by something that we can license under the MIT license. This is important for adoption of AppImage by some of our business users (yes, Microsoft and IBM are already using AppImage, too, and we don't want to scare them away.)

@teras
Copy link
Contributor Author

teras commented Sep 18, 2017

@probonopd we had a discussion about that with @TheAssassin and we concluded that what the last thing I did was the best thing to do. Please if possible discuss with him about this.

@TheAssassin
Copy link
Member

@teras, @probonopd, I should get to merging everything manually soon. I'll fix the remaining issues, merge #470 and #471, and then everything should work fine.

@probonopd we will now have to provide runtimes for embedding built by Travis I guess. I'll implement that, too.

@probonopd
Copy link
Member

Thank you @teras @TheAssassin

@TheAssassin
Copy link
Member

Sorry for the delay. I'm going to review and most likely merge this tonight.

@TheAssassin
Copy link
Member

Not sure what's going on in the x86_64 build. The 32-bit one is broken due to a dependency issue. I'm going to fix the latter first.

@TheAssassin
Copy link
Member

As mentioned in #433, the builds are failing due to issues with SourceForge. We'll have to wait for this to get fixed. It also shows how fragile our build system is. We should mirror those tarballs.

@probonopd
Copy link
Member

Looks like the checks are passing now. Ready to merge @TheAssassin?

@TheAssassin
Copy link
Member

TheAssassin commented Sep 30, 2017

I have been working on the legal implications of the GPL code included in this repository. I have come up with the following explanation.

The file is and will remain GPLv2. The copyright notice must stay, and should not be modified (although the file may be modified, but when it is modified will also remain GPLv2). Especially the year and author name are important information.

The file only contains definitions of data types and other values. According to Richard Stallman [1], when using this file to create a program, it will not create a derivative work and therefore, appimagetool is not subject to the GPLv2. This is important to know, as this is what @probonopd warned about. I wanted to revise and explicitly state the situation again. (I know that @teras and I knew this already, based on [2].) So, shipping this GPLv2 file along with the MIT licensed code is okay.

I will have to verify whether @teras made changes to the file, as then, we should update the copyright notice in the header file before merging.

Sorry for the additional delay.

[1] http://lkml.iu.edu/hypermail/linux/kernel/0301.1/0362.html
[2] https://elinux.org/Legal_Issues#Use_of_kernel_header_files_in_user-space

@TheAssassin
Copy link
Member

@teras did make changes, and stated this implicitly. I've fixed this. As @probonopd forces Travis to run successfully before being able to merge, we'll have to wait before finally merging this PR (although this is not really necessary).

@TheAssassin TheAssassin merged commit cc63970 into AppImage:appimagetool/master Sep 30, 2017
@TheAssassin
Copy link
Member

Thank you very much @teras for your great work! I hope users will be able to make use of it.

@teras
Copy link
Contributor Author

teras commented Sep 30, 2017 via email

@develar
Copy link
Contributor

develar commented Oct 1, 2017

@teras To build appimagetool (./build-tool-osx.sh) on macOS, you need to

  1. brew install libtool glib argp-standalone
  2. brew install Caskroom/cask/osxfuse

right?

@develar
Copy link
Contributor

develar commented Oct 1, 2017

To be able to use appimagetool on macOS, I need runtime, but no runtime files in the https://github.com/AppImage/AppImageKit/releases/tag/continuous (I can build it on Linux, of course, but it will be better if it will be provided to ensure that it is compiled on correct OS and so on).

@TheAssassin
Copy link
Member

You are absolutely right, and I found so elsewhere, too. Would you like to create an issue or even a PR to build runtimes for download on Travis?

@teras
Copy link
Contributor Author

teras commented Oct 1, 2017

@develar

Yes, I had to install a couple of things from vanilla brew, no issues or special treatment there. I can remove brew from my system and see what's missing. Of course, it would make more sense (and in accordance with the current procedure) to have a test environment that would download the packages on the fly and try them. This will save time, if a brew dependency package changes and breaks some things (instead of checking the procedure once - now).

As a parallel feature, why not consider creating a brew especially for appimagekit?

@TheAssassin
Copy link
Member

You can always do this, but I guess the AppImage team wouldn't officially support it. Also, I'd suggest to discuss this in a separate issue.

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.

4 participants