<commit_before>This project builds [Notes](http://www.get-notes.com/) and packages it as a
snap for Ubuntu.

![notes](https://cloud.githubusercontent.com/assets/16375940/14313739/ea9fc8fa-fbfb-11e5-95bb-fb10c59770a8.png)

To build it on an Ubuntu 16.04 machine, simply go to the `notes` directory and type:

    snapcraft
    
**Developers**: to install the locally built snap (i.e. sideload),

    sudo snap install notes_0.0.8~snap3.gita80fd1c_amd64.snap

Note: replacing `0.0.8~snap3.gita80fd1c` by the revision of the resulting app you've built. The version is defined on the `snapcraft.yaml` file.

**Users**: to install the app from the Ubuntu store:

    sudo snap install notes

[Learn more at the Ubuntu developer site](https://developer.ubuntu.com/en/desktop/get-started)

## Snapcraft features

This project uses the following Snapcraft features
- A custom Snapcraft plugin, derived from the `make` plugin. This is necessary to call the qmake step before doing the build
- A [wiki-based](https://wiki.ubuntu.com/Snappy/Parts) part (`qt5conf`) needed to set up Qt apps to select their Qt version before starting
- A [wrapper](https://github.com/dplanella/snappy-playpen/blob/master/notes/notes.wrapper) that sets up environment variables before calling the binary
- The `copy` plugin to install the wrapper

## App functionality

The application works fine so far. Note that due to confinement data is being written to `/home/$USER/snap/notes`.

### Warnings

    Qt: Session management error: None of the authentication protocols specified are supported
    XmbTextListToTextProperty result code -2
    XmbTextListToTextProperty result code -2
    XmbTextListToTextProperty result code -2

The first warning might need setting an environment variable on the wrapper. The subsequent warnings are most likely due to upstream.

### AppArmor denials

    Apr 21 13:30:06 host kernel: [118072.276749] audit: type=1400 audit(1461238206.897:1500): apparmor="DENIED" operation="chmod" profile="snap.notes-dpm.notes" name="/var/cache/fontconfig/" pid=15243 comm="Notes" requested_mask="w" denied_mask="w" fsuid=1000 ouid=0

Denial trying to write to `/var/cache/fontconfig`, which seems to be quite common amongst snaps.
<commit_msg>Updated README with AppArmor denials<commit_after>This project builds [Notes](http://www.get-notes.com/) and packages it as a
snap for Ubuntu.

![notes](https://cloud.githubusercontent.com/assets/16375940/14313739/ea9fc8fa-fbfb-11e5-95bb-fb10c59770a8.png)

To build it on an Ubuntu 16.04 machine, simply go to the `notes` directory and type:

    snapcraft

**Developers**: to install the locally built snap (i.e. sideload),

    sudo snap install notes_0.0.8~snap3.gita80fd1c_amd64.snap

Note: replacing `0.0.8~snap3.gita80fd1c` by the revision of the resulting app you've built. The version is defined on the `snapcraft.yaml` file.

**Users**: to install the app from the Ubuntu store:

    sudo snap install notes

[Learn more at the Ubuntu developer site](https://developer.ubuntu.com/en/desktop/get-started)

## Snapcraft features

This project uses the following Snapcraft features
- A custom Snapcraft plugin, derived from the `make` plugin. This is necessary to call the qmake step before doing the build
- A [wiki-based](https://wiki.ubuntu.com/Snappy/Parts) part (`qt5conf`) needed to set up Qt apps to select their Qt version before starting
- A [wrapper](https://github.com/dplanella/snappy-playpen/blob/master/notes/notes.wrapper) that sets up environment variables before calling the binary
- The `copy` plugin to install the wrapper

## App functionality

The application works fine so far. Note that due to confinement data is being written to `/home/$USER/snap/notes`.

### Warnings

    Qt: Session management error: None of the authentication protocols specified are supported
    XmbTextListToTextProperty result code -2
    XmbTextListToTextProperty result code -2
    XmbTextListToTextProperty result code -2

The first warning might need setting an environment variable on the wrapper. The subsequent warnings are most likely due to upstream.

### AppArmor denials

    Apr 21 13:30:06 host kernel: [118072.276749] audit: type=1400 audit(1461238206.897:1500): apparmor="DENIED" operation="chmod" profile="snap.notes-dpm.notes" name="/var/cache/fontconfig/" pid=15243 comm="Notes" requested_mask="w" denied_mask="w" fsuid=1000 ouid=0

Denial trying to write to `/var/cache/fontconfig`, which seems to be quite common amongst snaps.

    Apr 26 13:48:11 host kernel: [13537.976542] audit: type=1400 audit(1461671291.269:73): apparmor="DENIED" operation="open" profile="snap.notes.notes" name="/usr/share/glib-2.0/schemas/gschemas.compiled" pid=19412 comm="Notes" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0

Denial trying to read GSettings schemas. That seems to stop the app from loading now.

{'fraction_non_alphanumeric': 0.09446388145708993, 'fraction_numerical': 0.05392055978596419, 'mean_word_length': 4.697538100820633, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6413863', 'n_tokens_mistral': 1659, 'n_tokens_neox': 1430, 'n_words': 534}