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

gnome extension #2398

Open
wants to merge 70 commits into
base: master
from
Open
Changes from 47 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
289f5db
Initial gnome desktop extension
diddledan Nov 8, 2018
64914e8
add extensions to schema/snapcraft.yaml
diddledan Nov 8, 2018
bf68218
spelling error in desktop-exports script from desktop extension
diddledan Nov 8, 2018
f0da7d8
appease shellcheck
diddledan Nov 8, 2018
1ba844e
Merge branch 'master' into desktop-gnome-extension
sergiusens Nov 11, 2018
23595d3
refactor gnome extension
diddledan Jan 7, 2019
58a7efc
Merge branch 'desktop-gnome-extension' of github.com:diddledan/snapcr…
diddledan Jan 7, 2019
0c85fb3
Merge branch 'master' of https://github.com/snapcore/snapcraft into d…
diddledan Jan 7, 2019
87fd118
merge desktop extension script
diddledan Jan 7, 2019
89a2db9
fix references to content interfaces paths
diddledan Jan 7, 2019
54215e3
add shared snap mountpoints and update launcher
diddledan Jan 7, 2019
ae2e4c5
squash test errors
diddledan Jan 7, 2019
e845f79
fix GIO modules symlinks; update gnome-extension
diddledan Jan 8, 2019
ab8285b
add layout to fix libwebkitgtk
diddledan Jan 8, 2019
844e6e1
Merge branch 'master' into desktop-gnome-extension
diddledan Jan 8, 2019
5d14973
set environment in command-chain scripts
diddledan Jan 14, 2019
e83ec34
fix gnome extension for core/core16 usage
diddledan Jan 14, 2019
80ab417
fix gnome extension usage of 'nil' plugin
diddledan Jan 14, 2019
61111ac
ensure static tests pass for gnome extension
diddledan Jan 14, 2019
4d24738
fix bugs in gnome extension scripts
diddledan Jan 15, 2019
6a301ca
Initial gnome desktop extension
diddledan Nov 8, 2018
a5642d2
add extensions to schema/snapcraft.yaml
diddledan Nov 8, 2018
478f7d2
spelling error in desktop-exports script from desktop extension
diddledan Nov 8, 2018
58121d1
appease shellcheck
diddledan Nov 8, 2018
1836ba5
refactor gnome extension
diddledan Jan 7, 2019
e06d7ec
merge desktop extension script
diddledan Jan 7, 2019
5f091b9
fix references to content interfaces paths
diddledan Jan 7, 2019
601d71f
add shared snap mountpoints and update launcher
diddledan Jan 7, 2019
9bf1939
squash test errors
diddledan Jan 7, 2019
745cd43
fix GIO modules symlinks; update gnome-extension
diddledan Jan 8, 2019
f668e50
add layout to fix libwebkitgtk
diddledan Jan 8, 2019
aa917d4
set environment in command-chain scripts
diddledan Jan 14, 2019
7e25ef9
fix gnome extension for core/core16 usage
diddledan Jan 14, 2019
72b2bd0
fix gnome extension usage of 'nil' plugin
diddledan Jan 14, 2019
4054ef4
ensure static tests pass for gnome extension
diddledan Jan 14, 2019
8fd0c49
fix bugs in gnome extension scripts
diddledan Jan 15, 2019
53ed8bc
further refinements to gnome extension
diddledan Jan 18, 2019
728ac4d
Fix GDK Pixbuf loaders
diddledan Jan 19, 2019
aed7404
Merge branch 'desktop-gnome-extension' of github.com:diddledan/snapcr…
diddledan Jan 19, 2019
5a6ff32
Update extensions/desktop-common/desktop-common
diddledan Jan 22, 2019
ddd64ce
update extensions/gnome/desktop-gnome-specific
diddledan Jan 22, 2019
16247ab
Add bindtextdomain for localisations
diddledan Jan 22, 2019
6aa832f
Desktop extension: Fix bindtextdomain.so build
diddledan Jan 23, 2019
d3afb53
Add locale-langpack path to bindtextdomain.c
diddledan Jan 25, 2019
cdafbe2
Add iso-codes layout to gnome extension
diddledan Feb 12, 2019
fa73f54
Merge remote-tracking branch 'origin/master' into desktop-gnome-exten…
diddledan Feb 12, 2019
21787d2
Merge branch 'master' into desktop-gnome-extension
sergiusens Feb 13, 2019
04e059e
ci: shallow clones for CLA checks on travis
sergiusens Feb 19, 2019
5092330
Merge remote-tracking branch 'origin/master' into desktop-gnome-exten…
sergiusens Feb 19, 2019
5b37480
rename gnome extension to gnome-3-28
diddledan Feb 19, 2019
e1361d0
Minor syntax errors on gnome-3-28 extension
diddledan Feb 20, 2019
712c0d8
incorrect quote style in extensions/_utils.py
diddledan Feb 20, 2019
0720c4d
force supported_cores to be a tuple in gnome ext
diddledan Feb 20, 2019
9f31943
Merge branch 'master' into desktop-gnome-extension
sergiusens Feb 20, 2019
1ecd076
Backport ubuntu/snapcraft-desktop-helpers#176
diddledan Mar 15, 2019
8b9084f
Merge branch 'master' of https://github.com/snapcore/snapcraft into d…
diddledan Mar 15, 2019
723257d
Merge branch 'desktop-gnome-extension' of github.com:diddledan/snapcr…
diddledan Mar 15, 2019
364960e
Gnome extension: variable name changes
diddledan Mar 24, 2019
3f5ec4f
Extensions: refactor away gnome exceptions
diddledan Mar 24, 2019
31b92f5
Gnome extension: remove duplicate test
diddledan Mar 24, 2019
ab20600
Desktop extensions: Remove -mark-and-exec script
diddledan Mar 24, 2019
d9aacdf
Gnome extension: Remove unused dependency vars
diddledan Mar 24, 2019
2c133da
Extensions: spelling mistake in error message
diddledan Mar 26, 2019
fd9cdd9
Gnome extension: Remove fedora $SNAP override
diddledan Apr 17, 2019
6c46d4b
Gnome extension: Fix missed var change
diddledan Apr 17, 2019
0347854
Gnome extension: Dont add empties to XDG_*_PATHS
diddledan Apr 17, 2019
11a90b4
Merge branch 'master' into desktop-gnome-extension
diddledan Apr 17, 2019
27c30c2
Gnome extension: Attempt to resolve double-frees
diddledan Apr 17, 2019
136e210
Merge branch 'desktop-gnome-extension' of github.com:diddledan/snapcr…
diddledan Apr 17, 2019
e6e6503
Desktop extensions: last-updated move to common
diddledan Apr 17, 2019
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+961 −0
Diff settings

Always

Just for now

@@ -0,0 +1,12 @@
#!/usr/bin/make -f

BINDTEXTDOMAIN = bindtextdomain.so

clean:
rm -f $(BINDTEXTDOMAIN)

$(BINDTEXTDOMAIN):
gcc -Wall -O2 -o $(BINDTEXTDOMAIN) -fPIC -shared bindtextdomain.c -ldl

install: $(BINDTEXTDOMAIN)
install -D -m644 $(BINDTEXTDOMAIN) "$(DESTDIR)"/lib/$(BINDTEXTDOMAIN)
@@ -0,0 +1,120 @@
/* gcc -Wall -O2 -o bindtextdomain.so -fPIC -shared bindtextdomain.c -ldl */

#define _GNU_SOURCE

#include <errno.h>
#include <dirent.h>
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

static void die (const char *msg)
{
fprintf (stderr, "can't preload: %s\n", msg);
exit (EXIT_FAILURE);
}

typedef char * (*BindTextDomainFunc) (const char *a,
const char *b);

static BindTextDomainFunc r_bindtextdomain = NULL;

char *bindtextdomain(const char *domainname, const char *dirname)
{
char *snap = NULL;
char *snap_path = NULL;
char *snap_locale_path = NULL;
DIR *dir = NULL;
struct dirent *ent = NULL;
char *ret = NULL;

if (r_bindtextdomain == 0 && !(r_bindtextdomain =
(BindTextDomainFunc) dlsym (RTLD_NEXT, "bindtextdomain")))
die ("can't find symbol \"bindtextdomain\"");

if (dirname == NULL || dirname[0] != '/')
goto orig;

snap = getenv ("SNAP");

if (snap == NULL || strcmp (snap, "") == 0)
goto orig;

char * paths[] = {
"gnome-platform/usr/share/locale",
This conversation was marked as resolved by diddledan

This comment has been minimized.

Copy link
@oSoMoN

oSoMoN Jan 25, 2019

Contributor

Please add "gnome-platform/usr/share/locale-langpack" to the list of paths. @kenvandine included the gtk3 translations in the gnome-3-28-1804 snap (currently in the candidate channel) so that individual snaps don't have to do it.

This comment has been minimized.

Copy link
@diddledan

diddledan Jan 25, 2019

Author Contributor

added in d3afb53

"gnome-platform/usr/share/locale-langpack",
"usr/share/locale",
"usr/share/locale-langpack",
NULL
};
for(int i = 0; paths[i] != NULL; i++)
{
if (asprintf (&snap_path, "%s/%s", snap, paths[i]) < 0)
continue;

if (access (snap_path, F_OK) < 0)
continue;

This comment has been minimized.

Copy link
@cjp256

cjp256 Mar 25, 2019

Leaking snap_path?

This comment has been minimized.

Copy link
@diddledan

diddledan Apr 17, 2019

Author Contributor

I'm not sure what you are referring to about leaking, but does 136e210 fix it?


/*
* if the mo file exists for one language we assume it exists for them
* all, or at least that we're not going to find it anywhere else. we
* don't know at this point what locale the application is actually
* going to use, so we can't look in any particular directory.
*/
dir = opendir (snap_path);
if (dir == NULL)

This comment has been minimized.

Copy link
@cjp256

cjp256 Mar 25, 2019

Leaking snap_path?

This comment has been minimized.

Copy link
@diddledan

diddledan Apr 17, 2019

Author Contributor

I'm not sure what you're referring to about leaking, but does 136e210 fix it?

continue;

while ((ent = readdir (dir)) != NULL) {
if (ent->d_name[0] == '.')
continue;

if (asprintf (&snap_locale_path,
"%s/%s/LC_MESSAGES/%s.mo",
snap_path,
ent->d_name,
domainname) < 0)
continue;

/* snap_locale_path has been allocated if we made it
* this far, be sure it's freed before any goto
* or continue
*/

if (access (snap_locale_path, F_OK) == 0) {
closedir (dir);
free (snap_locale_path);
snap_locale_path = NULL;
goto ok;
} else {
free (snap_locale_path);
snap_locale_path = NULL;
continue;
}
}

closedir (dir);
free (snap_path);
snap_path = NULL;
free (snap_locale_path);

This comment has been minimized.

Copy link
@cjp256

cjp256 Mar 25, 2019

I don't think this is required. Looks like a potential double free (though snap_locale_path would be NULL as it is explicitly freed and reset in above loop on all paths after allocation).

This comment has been minimized.

Copy link
@diddledan

diddledan Apr 17, 2019

Author Contributor

I think I've solved this in 136e210, but my C is not good so I might have royally mucked it up.

snap_locale_path = NULL;
}
/*
* we fell out of the loop, so we'll go to orig regardless - no need to
* check for errors
*/
goto orig;

ok:
ret = r_bindtextdomain (domainname, snap_path);
goto out;
orig:
ret = r_bindtextdomain (domainname, dirname);
goto out;
out:
free (snap_path);

This comment has been minimized.

Copy link
@cjp256

cjp256 Mar 25, 2019

Maybe already be freed/NULL.

This comment has been minimized.

Copy link
@diddledan

diddledan Apr 17, 2019

Author Contributor

I think I've solved this in 136e210, but my C is not good so I might have royally mucked it up.

snap_path = NULL;
return ret;
}
No changes.
No changes.
No changes.
Oops, something went wrong.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.