[pacman-dev] [PATCH] alpm: Fix possible alignment issues w/ events

2016-01-02 Thread Olivier Brunel
As reported by Rikard Falkeborn[1] using event-specific struct and then
typecasting to the generic alpm_event_t could possibly lead to alignment issue,
so we now always use alpm_event_t instead.

[1] https://lists.archlinux.org/pipermail/pacman-dev/2015-December/020709.html

Signed-off-by: Olivier Brunel 
---
 lib/libalpm/add.c | 36 ++--
 lib/libalpm/be_sync.c |  4 ++--
 lib/libalpm/handle.h  |  2 +-
 lib/libalpm/hook.c| 14 +++---
 lib/libalpm/remove.c  | 20 ++--
 lib/libalpm/sync.c|  8 
 lib/libalpm/trans.c   |  2 +-
 lib/libalpm/util.c|  4 ++--
 8 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 63eda49..4b76bc7 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -315,12 +315,12 @@ static int extract_single_file(alpm_handle_t *handle, 
struct archive *archive,
}
 
if(notouch) {
-   alpm_event_pacnew_created_t event = {
+   alpm_event_t event = {
.type = ALPM_EVENT_PACNEW_CREATED,
-   .from_noupgrade = 1,
-   .oldpkg = oldpkg,
-   .newpkg = newpkg,
-   .file = filename
+   .pacnew_created.from_noupgrade = 1,
+   .pacnew_created.oldpkg = oldpkg,
+   .pacnew_created.newpkg = newpkg,
+   .pacnew_created.file = filename
};
/* "remove" the .pacnew suffix */
filename[filename_len] = '\0';
@@ -366,12 +366,12 @@ static int extract_single_file(alpm_handle_t *handle, 
struct archive *archive,
} else {
/* none of the three files matched another,  leave the 
unpacked
 * file alongside the local file */
-   alpm_event_pacnew_created_t event = {
+   alpm_event_t event = {
.type = ALPM_EVENT_PACNEW_CREATED,
-   .from_noupgrade = 0,
-   .oldpkg = oldpkg,
-   .newpkg = newpkg,
-   .file = origfile
+   .pacnew_created.from_noupgrade = 0,
+   .pacnew_created.oldpkg = oldpkg,
+   .pacnew_created.newpkg = newpkg,
+   .pacnew_created.file = origfile
};
_alpm_log(handle, ALPM_LOG_DEBUG,
"action: keeping current file and 
installing"
@@ -398,7 +398,7 @@ static int commit_single_pkg(alpm_handle_t *handle, 
alpm_pkg_t *newpkg,
alpm_db_t *db = handle->db_local;
alpm_trans_t *trans = handle->trans;
alpm_progress_t progress = ALPM_PROGRESS_ADD_START;
-   alpm_event_package_operation_t event;
+   alpm_event_t event;
const char *log_msg = "adding";
const char *pkgfile;
 
@@ -411,15 +411,15 @@ static int commit_single_pkg(alpm_handle_t *handle, 
alpm_pkg_t *newpkg,
if(cmp < 0) {
log_msg = "downgrading";
progress = ALPM_PROGRESS_DOWNGRADE_START;
-   event.operation = ALPM_PACKAGE_DOWNGRADE;
+   event.package_operation.operation = 
ALPM_PACKAGE_DOWNGRADE;
} else if(cmp == 0) {
log_msg = "reinstalling";
progress = ALPM_PROGRESS_REINSTALL_START;
-   event.operation = ALPM_PACKAGE_REINSTALL;
+   event.package_operation.operation = 
ALPM_PACKAGE_REINSTALL;
} else {
log_msg = "upgrading";
progress = ALPM_PROGRESS_UPGRADE_START;
-   event.operation = ALPM_PACKAGE_UPGRADE;
+   event.package_operation.operation = 
ALPM_PACKAGE_UPGRADE;
}
is_upgrade = 1;
 
@@ -432,12 +432,12 @@ static int commit_single_pkg(alpm_handle_t *handle, 
alpm_pkg_t *newpkg,
/* copy over the install reason */
newpkg->reason = alpm_pkg_get_reason(local);
} else {
-   event.operation = ALPM_PACKAGE_INSTALL;
+   event.package_operation.operation = ALPM_PACKAGE_INSTALL;
}
 
event.type = ALPM_EVENT_PACKAGE_OPERATION_START;
-   event.oldpkg = oldpkg;
-   event.newpkg = newpkg;
+   event.package_operation.oldpkg = oldpkg;
+   event.package_operation.newpkg = newpkg;
EVENT(handle, );
 
pkgfile = newpkg->origin_data.file;
@@ -589,7 +589,7 @@ static int commit_single_pkg(alpm_handle_t *handle, 
alpm_pkg_t *newpkg,
 
PROGRESS(handle, progress, newpkg->name, 100, pkg_count, pkg_current);
 
-   

Re: [pacman-dev] [PATCH] alpm: Fix possible alignment issues w/ events

2016-01-02 Thread Rikard Falkeborn
2016-01-02 19:21 GMT+01:00 Olivier Brunel :

> As reported by Rikard Falkeborn[1] using event-specific struct and then
> typecasting to the generic alpm_event_t could possibly lead to alignment
> issue,
> so we now always use alpm_event_t instead.
>
> [1]
> https://lists.archlinux.org/pipermail/pacman-dev/2015-December/020709.html
>
> Signed-off-by: Olivier Brunel 
> ---
>  lib/libalpm/add.c | 36 ++--
>  lib/libalpm/be_sync.c |  4 ++--
>  lib/libalpm/handle.h  |  2 +-
>  lib/libalpm/hook.c| 14 +++---
>  lib/libalpm/remove.c  | 20 ++--
>  lib/libalpm/sync.c|  8 
>  lib/libalpm/trans.c   |  2 +-
>  lib/libalpm/util.c|  4 ++--
>  8 files changed, 45 insertions(+), 45 deletions(-)
>
> diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
> index 63eda49..4b76bc7 100644
> --- a/lib/libalpm/add.c
> +++ b/lib/libalpm/add.c
> @@ -315,12 +315,12 @@ static int extract_single_file(alpm_handle_t
> *handle, struct archive *archive,
> }
>
> if(notouch) {
> -   alpm_event_pacnew_created_t event = {
> +   alpm_event_t event = {
> .type = ALPM_EVENT_PACNEW_CREATED,
> -   .from_noupgrade = 1,
> -   .oldpkg = oldpkg,
> -   .newpkg = newpkg,
> -   .file = filename
> +   .pacnew_created.from_noupgrade = 1,
> +   .pacnew_created.oldpkg = oldpkg,
> +   .pacnew_created.newpkg = newpkg,
> +   .pacnew_created.file = filename
> };
> /* "remove" the .pacnew suffix */
> filename[filename_len] = '\0';
> @@ -366,12 +366,12 @@ static int extract_single_file(alpm_handle_t
> *handle, struct archive *archive,
> } else {
> /* none of the three files matched another,  leave
> the unpacked
>  * file alongside the local file */
> -   alpm_event_pacnew_created_t event = {
> +   alpm_event_t event = {
> .type = ALPM_EVENT_PACNEW_CREATED,
> -   .from_noupgrade = 0,
> -   .oldpkg = oldpkg,
> -   .newpkg = newpkg,
> -   .file = origfile
> +   .pacnew_created.from_noupgrade = 0,
> +   .pacnew_created.oldpkg = oldpkg,
> +   .pacnew_created.newpkg = newpkg,
> +   .pacnew_created.file = origfile
> };
> _alpm_log(handle, ALPM_LOG_DEBUG,
> "action: keeping current file and
> installing"
> @@ -398,7 +398,7 @@ static int commit_single_pkg(alpm_handle_t *handle,
> alpm_pkg_t *newpkg,
> alpm_db_t *db = handle->db_local;
> alpm_trans_t *trans = handle->trans;
> alpm_progress_t progress = ALPM_PROGRESS_ADD_START;
> -   alpm_event_package_operation_t event;
> +   alpm_event_t event;
> const char *log_msg = "adding";
> const char *pkgfile;
>
> @@ -411,15 +411,15 @@ static int commit_single_pkg(alpm_handle_t *handle,
> alpm_pkg_t *newpkg,
> if(cmp < 0) {
> log_msg = "downgrading";
> progress = ALPM_PROGRESS_DOWNGRADE_START;
> -   event.operation = ALPM_PACKAGE_DOWNGRADE;
> +   event.package_operation.operation =
> ALPM_PACKAGE_DOWNGRADE;
> } else if(cmp == 0) {
> log_msg = "reinstalling";
> progress = ALPM_PROGRESS_REINSTALL_START;
> -   event.operation = ALPM_PACKAGE_REINSTALL;
> +   event.package_operation.operation =
> ALPM_PACKAGE_REINSTALL;
> } else {
> log_msg = "upgrading";
> progress = ALPM_PROGRESS_UPGRADE_START;
> -   event.operation = ALPM_PACKAGE_UPGRADE;
> +   event.package_operation.operation =
> ALPM_PACKAGE_UPGRADE;
> }
> is_upgrade = 1;
>
> @@ -432,12 +432,12 @@ static int commit_single_pkg(alpm_handle_t *handle,
> alpm_pkg_t *newpkg,
> /* copy over the install reason */
> newpkg->reason = alpm_pkg_get_reason(local);
> } else {
> -   event.operation = ALPM_PACKAGE_INSTALL;
> +   event.package_operation.operation = ALPM_PACKAGE_INSTALL;
> }
>
> event.type = ALPM_EVENT_PACKAGE_OPERATION_START;
> -   event.oldpkg = oldpkg;
> -   event.newpkg = newpkg;
> +   event.package_operation.oldpkg = oldpkg;
> +   event.package_operation.newpkg = newpkg;
> 

[pacman-dev] [PATCH v2] alpm: Fix possible alignment issues w/ events

2016-01-02 Thread Olivier Brunel
As reported by Rikard Falkeborn[1] using event-specific struct and then
typecasting to the generic alpm_event_t could possibly lead to alignment issue,
so we now always use alpm_event_t instead.

[1] https://lists.archlinux.org/pipermail/pacman-dev/2015-December/020709.html

Signed-off-by: Olivier Brunel 
---
Now always using the union member, to avoid initializer warnings (thanks Rikard)
and better consistency. Hopefully this time it's all good.

 lib/libalpm/add.c | 44 ++--
 lib/libalpm/be_sync.c |  6 +++---
 lib/libalpm/handle.h  |  2 +-
 lib/libalpm/hook.c| 22 +++---
 lib/libalpm/remove.c  | 28 ++--
 lib/libalpm/sync.c| 14 +++---
 lib/libalpm/trans.c   |  2 +-
 lib/libalpm/util.c|  6 +++---
 8 files changed, 62 insertions(+), 62 deletions(-)

diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index 63eda49..6df7d7a 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -315,12 +315,12 @@ static int extract_single_file(alpm_handle_t *handle, 
struct archive *archive,
}
 
if(notouch) {
-   alpm_event_pacnew_created_t event = {
-   .type = ALPM_EVENT_PACNEW_CREATED,
-   .from_noupgrade = 1,
-   .oldpkg = oldpkg,
-   .newpkg = newpkg,
-   .file = filename
+   alpm_event_t event = {
+   .pacnew_created.type = ALPM_EVENT_PACNEW_CREATED,
+   .pacnew_created.from_noupgrade = 1,
+   .pacnew_created.oldpkg = oldpkg,
+   .pacnew_created.newpkg = newpkg,
+   .pacnew_created.file = filename
};
/* "remove" the .pacnew suffix */
filename[filename_len] = '\0';
@@ -366,12 +366,12 @@ static int extract_single_file(alpm_handle_t *handle, 
struct archive *archive,
} else {
/* none of the three files matched another,  leave the 
unpacked
 * file alongside the local file */
-   alpm_event_pacnew_created_t event = {
-   .type = ALPM_EVENT_PACNEW_CREATED,
-   .from_noupgrade = 0,
-   .oldpkg = oldpkg,
-   .newpkg = newpkg,
-   .file = origfile
+   alpm_event_t event = {
+   .pacnew_created.type = 
ALPM_EVENT_PACNEW_CREATED,
+   .pacnew_created.from_noupgrade = 0,
+   .pacnew_created.oldpkg = oldpkg,
+   .pacnew_created.newpkg = newpkg,
+   .pacnew_created.file = origfile
};
_alpm_log(handle, ALPM_LOG_DEBUG,
"action: keeping current file and 
installing"
@@ -398,7 +398,7 @@ static int commit_single_pkg(alpm_handle_t *handle, 
alpm_pkg_t *newpkg,
alpm_db_t *db = handle->db_local;
alpm_trans_t *trans = handle->trans;
alpm_progress_t progress = ALPM_PROGRESS_ADD_START;
-   alpm_event_package_operation_t event;
+   alpm_event_t event;
const char *log_msg = "adding";
const char *pkgfile;
 
@@ -411,15 +411,15 @@ static int commit_single_pkg(alpm_handle_t *handle, 
alpm_pkg_t *newpkg,
if(cmp < 0) {
log_msg = "downgrading";
progress = ALPM_PROGRESS_DOWNGRADE_START;
-   event.operation = ALPM_PACKAGE_DOWNGRADE;
+   event.package_operation.operation = 
ALPM_PACKAGE_DOWNGRADE;
} else if(cmp == 0) {
log_msg = "reinstalling";
progress = ALPM_PROGRESS_REINSTALL_START;
-   event.operation = ALPM_PACKAGE_REINSTALL;
+   event.package_operation.operation = 
ALPM_PACKAGE_REINSTALL;
} else {
log_msg = "upgrading";
progress = ALPM_PROGRESS_UPGRADE_START;
-   event.operation = ALPM_PACKAGE_UPGRADE;
+   event.package_operation.operation = 
ALPM_PACKAGE_UPGRADE;
}
is_upgrade = 1;
 
@@ -432,12 +432,12 @@ static int commit_single_pkg(alpm_handle_t *handle, 
alpm_pkg_t *newpkg,
/* copy over the install reason */
newpkg->reason = alpm_pkg_get_reason(local);
} else {
-   event.operation = ALPM_PACKAGE_INSTALL;
+   event.package_operation.operation = ALPM_PACKAGE_INSTALL;
}
 
-   event.type = ALPM_EVENT_PACKAGE_OPERATION_START;
-   event.oldpkg = oldpkg;
-   event.newpkg = newpkg;
+   event.package_operation.type = 

[pacman-dev] [PATCH] Update copyright years for 2016

2016-01-02 Thread Allan McRae
make update-copyright OLD=2015 NEW=2016

Signed-off-by: Allan McRae 
---

This is an FYI - it is too big to send the whole patch.

 contrib/bacman.sh.in| 4 ++--
 contrib/pacdiff.sh.in   | 4 ++--
 contrib/pacscripts.sh.in| 2 +-
 doc/index.txt   | 2 +-
 lib/libalpm/add.c   | 2 +-
 lib/libalpm/add.h   | 2 +-
 lib/libalpm/alpm.c  | 2 +-
 lib/libalpm/alpm.h  | 2 +-
 lib/libalpm/alpm_list.c | 2 +-
 lib/libalpm/alpm_list.h | 2 +-
 lib/libalpm/backup.c| 2 +-
 lib/libalpm/backup.h| 2 +-
 lib/libalpm/be_local.c  | 2 +-
 lib/libalpm/be_package.c| 2 +-
 lib/libalpm/be_sync.c   | 2 +-
 lib/libalpm/conflict.c  | 2 +-
 lib/libalpm/conflict.h  | 2 +-
 lib/libalpm/db.c| 2 +-
 lib/libalpm/db.h| 2 +-
 lib/libalpm/delta.c | 2 +-
 lib/libalpm/delta.h | 2 +-
 lib/libalpm/deps.c  | 2 +-
 lib/libalpm/deps.h  | 2 +-
 lib/libalpm/diskspace.c | 2 +-
 lib/libalpm/diskspace.h | 2 +-
 lib/libalpm/dload.c | 2 +-
 lib/libalpm/dload.h | 2 +-
 lib/libalpm/error.c | 2 +-
 lib/libalpm/filelist.c  | 2 +-
 lib/libalpm/filelist.h  | 2 +-
 lib/libalpm/graph.c | 2 +-
 lib/libalpm/graph.h | 2 +-
 lib/libalpm/group.c | 2 +-
 lib/libalpm/group.h | 2 +-
 lib/libalpm/handle.c| 2 +-
 lib/libalpm/handle.h| 2 +-
 lib/libalpm/hook.c  | 2 +-
 lib/libalpm/hook.h  | 2 +-
 lib/libalpm/libarchive-compat.h | 2 +-
 lib/libalpm/log.c   | 2 +-
 lib/libalpm/log.h   | 2 +-
 lib/libalpm/package.c   | 2 +-
 lib/libalpm/package.h   | 2 +-
 lib/libalpm/pkghash.c   | 2 +-
 lib/libalpm/pkghash.h   | 2 +-
 lib/libalpm/remove.c| 2 +-
 lib/libalpm/remove.h| 2 +-
 lib/libalpm/signing.c   | 2 +-
 lib/libalpm/signing.h   | 2 +-
 lib/libalpm/sync.c  | 2 +-
 lib/libalpm/sync.h  | 2 +-
 lib/libalpm/trans.c | 2 +-
 lib/libalpm/trans.h | 2 +-
 lib/libalpm/util.c  | 2 +-
 lib/libalpm/util.h  | 2 +-
 lib/libalpm/version.c   | 2 +-
 scripts/libmakepkg/lint_package.sh.in   | 2 +-
 scripts/libmakepkg/lint_package/build_references.sh.in  | 2 +-
 scripts/libmakepkg/lint_package/missing_backup.sh.in| 2 +-
 scripts/libmakepkg/lint_pkgbuild.sh.in  | 2 +-
 scripts/libmakepkg/lint_pkgbuild/arch.sh.in | 2 +-
 scripts/libmakepkg/lint_pkgbuild/backup.sh.in   | 2 +-
 scripts/libmakepkg/lint_pkgbuild/changelog.sh.in| 2 +-
 scripts/libmakepkg/lint_pkgbuild/epoch.sh.in| 2 +-
 scripts/libmakepkg/lint_pkgbuild/install.sh.in  | 2 +-
 scripts/libmakepkg/lint_pkgbuild/optdepends.sh.in   | 2 +-
 scripts/libmakepkg/lint_pkgbuild/options.sh.in  | 2 +-
 scripts/libmakepkg/lint_pkgbuild/package_function.sh.in | 2 +-
 scripts/libmakepkg/lint_pkgbuild/pkgbase.sh.in  | 2 +-
 scripts/libmakepkg/lint_pkgbuild/pkglist.sh.in  | 2 +-
 scripts/libmakepkg/lint_pkgbuild/pkgname.sh.in  | 2 +-
 scripts/libmakepkg/lint_pkgbuild/pkgrel.sh.in   | 2 +-
 scripts/libmakepkg/lint_pkgbuild/pkgver.sh.in   | 2 +-
 scripts/libmakepkg/lint_pkgbuild/provides.sh.in | 2 +-
 scripts/libmakepkg/lint_pkgbuild/source.sh.in   | 2 +-