Brian,
This is approved, since it's an important feature/request.
However, it's clear that the originator of the fix didn't unit
test it on x86 prior to integration. This is disappointing and
ultimately generates more work for people.
Regards
-Karl.
Brian Cameron wrote:
>
> The attached patch fixes SDX2 stopper bug #6545464. Basically the code
> was looking for --default-sutdown instead of --default-shutdown, which
> was causing the problem.
>
> In my patch I modify GNOME 2.16 to use the new sys-suspend 0.4 tarball
> which has the three older patches integrated, so I remove the 3 previous
> patches and now just apply the one patch needed to fix this bug.
>
> I attach the new patch separately since it is probably easier to review
> than the diff which shows the 3 removed patches.
>
> This will require updating the tarball in the gnome-2.16 branch to the
> new 0.4 version. I talked with Damien about this, and it is no problem.
>
> Brian
>
>
> ------------------------------------------------------------------------
>
> Index: ChangeLog
> ===================================================================
> --- ChangeLog (revision 11129)
> +++ ChangeLog (working copy)
> @@ -1,3 +1,15 @@
> +2007-04-13 Brian Cameron <brian.cameron at sun.com>
> +
> + * SUNWgnome-sys-suspend.spec,
> + patches/gnome-sys-suspend-01-fixshutdown.diff: Bump to
> + sys-suspend 0.4 tarball. Add patch to fix spelling of
> + "default-shutdown" argument. This fixes stopper bug
> + #6545464.
> + * patches/gnome-sys-suspend-01-fixshutdown.diff,
> + patches/gnome-sys-suspend-02-cmd-options.diff,
> + patches/gnome-sys-suspend-03-check-a11y.diff: Remove patches
> + now integrated into the 0.4 tarball.
> +
> 2007-04-10 Dave Lin <dave.lin at sun.com>
>
> * SUNWfirefox.spec: Remove dependency on
> Index: patches/gnome-sys-suspend-02-cmd-options.diff
> ===================================================================
> --- patches/gnome-sys-suspend-02-cmd-options.diff (revision 11129)
> +++ patches/gnome-sys-suspend-02-cmd-options.diff (working copy)
> @@ -1,173 +0,0 @@
> ---- gnome-sys-suspend-0.3/src/Makefile.am 2004-09-25 17:40:52.527127000
> +0530
> -+++ gnome-sys-suspend-0.3-new/src/Makefile.am 2004-09-25
> 17:40:23.640434000 +0530
> -@@ -3,10 +3,10 @@
> - INCLUDES = \
> - -DPACKAGE_DATA_DIR=\""$(datadir)"\" \
> - -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
> -- -DSBINDIR=\""$(sbindir)"\" \
> -+ -DLIBDIR=\""$(libdir)"\" \
> - @PACKAGE_CFLAGS@
> -
> --sbin_PROGRAMS = gnome-suspend
> -+libexec_PROGRAMS = gnome-suspend
> -
> - bin_PROGRAMS = gnome-sys-suspend
> -
> -@@ -25,4 +25,4 @@ gnome_suspend_LDADD = -lcmd
> - gnome_sys_suspend_LDADD = -lX11 -lXext @PACKAGE_LIBS@
> -
> - install-exec-hook:
> -- -chmod 4711 $(DESTDIR)$(sbindir)/gnome-suspend
> -+ -chmod 4711 $(DESTDIR)$(libexecdir)/gnome-suspend
> ---- gnome-sys-suspend-0.3/src/gnome-sys-suspend.h 2004-09-25
> 17:42:21.049408000 +0530
> -+++ gnome-sys-suspend-0.3-new/src/gnome-sys-suspend.h 2004-09-25
> 17:42:11.970369000 +0530
> -@@ -8,7 +8,7 @@
> -
> - #include "gnome-suspend.h"
> -
> --#define GNOME_SUSPEND_PATH SBINDIR "/gnome-suspend"
> -+#define GNOME_SUSPEND_PATH LIBDIR "/gnome-suspend"
> -
> - #ifdef __cplusplus
> - extern "C" {
> ---- gnome-sys-suspend-0.3/src/gnome-sys-suspend.c 2004-09-25
> 17:41:21.972692000 +0530
> -+++ gnome-sys-suspend-0.3-new/src/gnome-sys-suspend.c 2004-09-25
> 17:40:15.392263000 +0530
> -@@ -33,7 +33,9 @@
> - #include <gdk/gdkx.h>
> - #include <libgnome/gnome-program.h>
> - #include <libgnomeui/gnome-ui-init.h>
> -+#include <libgnome/libgnome.h>
> - #include "gnome-sys-suspend.h"
> -+#include <popt.h>
> -
> - #define ALARM_TIMEOUT 1
> - #define RESPONSE_SHUTDOWN 1000
> -@@ -1035,18 +1037,6 @@ with_ow(argc, argv)
> - int argc;
> - char *argv[];
> - {
> --
> --#ifdef ENABLE_NLS
> -- bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
> -- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
> -- textdomain (GETTEXT_PACKAGE);
> --#endif
> -- gnome_program_init (PACKAGE, VERSION,
> -- LIBGNOMEUI_MODULE,
> -- argc, argv,
> -- NULL,
> -- NULL);
> --
> - /* setup child process to do the back-end stuff */
> - sys_suspend_helper ();
> -
> -@@ -1321,6 +1311,11 @@ main(int argc, char **argv)
> - struct stat stat_buf;
> - char display_name[MAXNAMELEN + 8] = "DISPLAY=";
> - char xauthority[MAXPATHLEN + 11] = "XAUTHORITY=";
> -+ gboolean force_suspend = FALSE;
> -+ gboolean disable_selection = FALSE;
> -+ gboolean disable_lockscreen = FALSE;
> -+ gboolean default_shutdown = FALSE;
> -+ gchar *display = NULL;
> -
> - (void *) signal(SIGHUP, SIG_IGN);
> - (void *) signal(SIGINT, SIG_IGN);
> -@@ -1331,6 +1326,31 @@ main(int argc, char **argv)
> - old_pri = nice(0);
> - new_pri = nice(-(2 * NZERO - 1));
> -
> -+ struct poptOption options [] = {
> -+ { "force-suspend", 'f', POPT_ARG_NONE, &force_suspend, 0,
> -+ N_("Make the system to force all the processes to stop and
> then susepnd"), NULL },
> -+ { "disable-selection", 'n', POPT_ARG_NONE, &disable_selection,
> 0,
> -+ N_("Disable the selection popup dialog at invocation time"),
> NULL },
> -+ { "disable-lockscreen", 'x', POPT_ARG_NONE,
> &disable_lockscreen, 0,
> -+ N_("Disable the execution of lockscreen at resume time"),
> NULL },
> -+ { "default-sutdown", 'h', POPT_ARG_NONE, &default_shutdown, 0,
> -+ N_("Change default operation from suspend to shutdown"), NULL
> },
> -+ { "display", 'd', POPT_ARG_STRING, &display, 0,
> -+ N_("Connect to the X server specified by display"), NULL },
> -+ {NULL, '\0', 0, NULL, 0}
> -+ };
> -+
> -+#ifdef ENABLE_NLS
> -+ bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
> -+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
> -+ textdomain (GETTEXT_PACKAGE);
> -+#endif
> -+ gnome_program_init (PACKAGE, VERSION,
> -+ LIBGNOMEUI_MODULE,
> -+ argc, argv,
> -+ GNOME_PARAM_POPT_TABLE, options,
> -+ NULL);
> -+
> - /*
> - * If gnome-sys-suspend is invoked from a daemon (case 1 above), it
> - * will not have a working stdin, stdout and stderr. We need
> -@@ -1345,39 +1365,32 @@ main(int argc, char **argv)
> - dup2(open("/dev/console", O_WRONLY), 2);
> - }
> -
> -- while ((c = getopt(argc, argv, "fnxhd:")) != EOF) {
> -- switch (c) {
> -- case 'f':
> -- flags |= FORCE;
> -- break;
> -- case 'n':
> -- flags |= NO_WARN;
> -- break;
> -- case 'x':
> -- flags |= NO_XLOCK;
> -- break;
> -- case 'h':
> -- flags |= SHUTDOWN;
> -- break;
> -- case 'd':
> -- if (strlen(optarg) > MAXNAMELEN) {
> -- (void) printf(gettext("Error: "
> -- "display name is too long.\n"));
> -- exit(1);
> -- }
> -- (void) strcat(display_name, optarg);
> -- if (putenv(display_name) != 0) {
> -- (void) printf(gettext("Error: "
> -- "unable to set DISPLAY "
> -- "environment variable.\n"));
> -- exit(1);
> -- }
> -- break;
> -- default:
> -- (void) printf(gettext("USAGE: gnome-sys-suspend
> "
> -- "[-fnxh] [-d <display>]\n"));
> -- exit(1);
> -- break;
> -+ /* Parse the commandline options */
> -+ if (force_suspend) {
> -+ flags |= FORCE;
> -+ }
> -+
> -+ if (disable_selection) {
> -+ flags |= NO_WARN;
> -+ }
> -+
> -+ if (disable_lockscreen) {
> -+ flags |= NO_XLOCK;
> -+ }
> -+
> -+ if (default_shutdown) {
> -+ flags |= SHUTDOWN;
> -+ }
> -+
> -+ if (display && display[0]) {
> -+ if (strlen(display) > MAXNAMELEN) {
> -+ (void) printf(gettext("Error: display name is too
> long.\n"));
> -+ exit(1);
> -+ }
> -+ (void) strcat(display_name, display);
> -+ if (putenv(display_name) != 0) {
> -+ (void) printf(gettext("Error: unable to set DISPLAY
> environment variable.\n"));
> -+ exit(1);
> - }
> - }
> -
> Index: patches/gnome-sys-suspend-01-fixshutdown.diff
> ===================================================================
> --- patches/gnome-sys-suspend-01-fixshutdown.diff (revision 0)
> +++ patches/gnome-sys-suspend-01-fixshutdown.diff (revision 0)
> @@ -0,0 +1,11 @@
> +--- gnome-sys-suspend-0.4/src/gnome-sys-suspend.c-orig 2007-04-13
> 16:20:45.794891000 +0800
> ++++ gnome-sys-suspend-0.4/src/gnome-sys-suspend.c 2007-04-13
> 16:20:56.688677000 +0800
> +@@ -1374,7 +1374,7 @@ main(int argc, char **argv)
> + N_("Disable the selection popup dialog at invocation time"),
> NULL },
> + { "disable-lockscreen", 'x', POPT_ARG_NONE,
> &disable_lockscreen, 0,
> + N_("Disable the execution of lockscreen at resume time"),
> NULL },
> +- { "default-sutdown", 'h', POPT_ARG_NONE, &default_shutdown, 0,
> ++ { "default-shutdown", 'h', POPT_ARG_NONE, &default_shutdown, 0,
> + N_("Change default operation from suspend to shutdown"), NULL
> },
> + { "display", 'd', POPT_ARG_STRING, &display, 0,
> + N_("Connect to the X server specified by display"), NULL },
> Index: patches/gnome-sys-suspend-03-check-a11y.diff
> ===================================================================
> --- patches/gnome-sys-suspend-03-check-a11y.diff (revision 11129)
> +++ patches/gnome-sys-suspend-03-check-a11y.diff (working copy)
> @@ -1,190 +0,0 @@
> ---- gnome-sys-suspend-0.3/src/gnome-sys-suspend-util.c 2004-11-22
> 19:05:26.561397000 +0530
> -+++ gnome-sys-suspend-0.3-new/src/gnome-sys-suspend-util.c 2004-11-23
> 11:08:19.187747000 +0530
> -@@ -7,15 +7,34 @@
> - #include <stdio.h>
> - #include <stdlib.h>
> - #include <libintl.h>
> -+#include <gconf/gconf-client.h>
> -
> - #define _(x) gettext (x)
> -
> -+gboolean
> -+check_accessibilty_status (void)
> -+{
> -+ static GConfClient *client = NULL;
> -+ gboolean status;
> -+
> -+ if (!client)
> -+ client = gconf_client_get_default ();
> -+
> -+ status = gconf_client_get_bool (client,
> -+ "/desktop/gnome/interface/accessibility",
> -+ NULL);
> -+ return status;
> -+}
> -+
> - int
> - graball (GtkWidget *widget)
> - {
> - GdkGrabStatus pointer;
> - GdkWindow *window;
> -
> -+ if (check_accessibilty_status())
> -+ return 1;
> -+
> - window = (widget->window) ? widget->window :
> gdk_get_default_root_window();
> -
> - pointer = gdk_pointer_grab (window,
> -@@ -37,9 +56,10 @@ graball (GtkWidget *widget)
> - void
> - ungraball (GtkWidget *window)
> - {
> -- gdk_pointer_ungrab (GDK_CURRENT_TIME);
> --}
> --
> -+ if (!check_accessibilty_status()) {
> -+ gdk_pointer_ungrab (GDK_CURRENT_TIME);
> -+ }
> -+}
> -
> - void
> - alert_popup (char *err)
> ---- gnome-sys-suspend-0.3/src/gnome-sys-suspend.c 2004-11-22
> 19:05:26.594440000 +0530
> -+++ gnome-sys-suspend-0.3-new/src/gnome-sys-suspend.c 2004-11-23
> 11:09:26.883870000 +0530
> -@@ -69,6 +69,7 @@ extern char *optarg;
> - extern void alert_popup (char *err);
> - extern int graball (GtkWidget *widget);
> - extern void ungraball(GtkWidget *window);
> -+extern gboolean check_accessibilty_status();
> -
> - static void
> - suspend_add_atk_namedesc (GtkWidget *widget,
> -@@ -412,8 +413,7 @@ powerwarningpopup (int err)
> - GdkWindow *window;
> - GtkWidget *poweroff_button;
> - GtkWidget *cancel_button;
> -- gboolean a11y_enabled;
> -- int ret;
> -+ int ret;
> -
> - warning_msg = get_powerwarning_message (err);
> -
> -@@ -429,8 +429,6 @@ powerwarningpopup (int err)
> - warning_msg);
> - g_free (warning_msg);
> -
> -- a11y_enabled = GTK_IS_ACCESSIBLE (gtk_widget_get_accessible
> (powerwarning));
> --
> - poweroff_button = gtk_dialog_add_button (GTK_DIALOG (powerwarning),
> - _("_Power Off"),
> - GTK_RESPONSE_OK);
> -@@ -442,7 +440,7 @@ powerwarningpopup (int err)
> - gtk_dialog_set_default_response (GTK_DIALOG (powerwarning),
> - GTK_RESPONSE_CANCEL);
> -
> -- if (a11y_enabled) {
> -+ if (check_accessibilty_status()) {
> - suspend_add_atk_namedesc (poweroff_button, NULL, _("Power Off
> the system."));
> - }
> -
> -@@ -454,23 +452,25 @@ powerwarningpopup (int err)
> - */
> - window = (powerwarning->window) ? powerwarning->window :
> gdk_get_default_root_window();
> -
> -- while (1) {
> -+ if (!check_accessibilty_status()) {
> -+ while (1) {
> -
> -- pointer = gdk_pointer_grab (window,
> -- TRUE,
> -- GDK_BUTTON_PRESS_MASK|
> -- GDK_BUTTON_RELEASE_MASK|
> -- GDK_BUTTON_MOTION_MASK,
> -- NULL,
> -- NULL,
> -- GDK_CURRENT_TIME);
> --
> -- if (pointer == GDK_GRAB_ALREADY_GRABBED) {
> -- sleep (1);
> -- } else {
> -- break;
> -- }
> -- }
> -+ pointer = gdk_pointer_grab (window,
> -+ TRUE,
> -+ GDK_BUTTON_PRESS_MASK|
> -+ GDK_BUTTON_RELEASE_MASK|
> -+ GDK_BUTTON_MOTION_MASK,
> -+ NULL,
> -+ NULL,
> -+ GDK_CURRENT_TIME);
> -+
> -+ if (pointer == GDK_GRAB_ALREADY_GRABBED) {
> -+ sleep (1);
> -+ } else {
> -+ break;
> -+ }
> -+ }
> -+ }
> -
> - ret = gtk_dialog_run (GTK_DIALOG (powerwarning));
> -
> -@@ -500,9 +500,8 @@ chkptwarningpopup ()
> - GtkWidget *shutdown_button;
> - GtkWidget *ok_button;
> - GtkWidget *cancel_button;
> -- gboolean a11y_enabled;
> - char *oklabel;
> -- int ret;
> -+ int ret , status;
> -
> - if (flags & LOWPOWER) {
> - oklabel = strdup (_("_LowPower"));
> -@@ -515,8 +514,6 @@ chkptwarningpopup ()
> - GTK_BUTTONS_NONE,
> - _("Please select one of the
> options."));
> -
> -- a11y_enabled = GTK_IS_ACCESSIBLE (gtk_widget_get_accessible
> (chkptwarning));
> --
> - ok_button = gtk_dialog_add_button (GTK_DIALOG (chkptwarning),
> - oklabel,
> - GTK_RESPONSE_OK);
> -@@ -529,7 +526,7 @@ chkptwarningpopup ()
> - GTK_STOCK_CANCEL,
> - GTK_RESPONSE_CANCEL);
> -
> -- if (a11y_enabled) {
> -+ if (check_accessibilty_status()) {
> - if (flags & LOWPOWER) {
> - suspend_add_atk_namedesc (ok_button, NULL, _("Bring the
> system to Low Power mode"));
> - } else {
> -@@ -551,14 +548,21 @@ chkptwarningpopup ()
> - gtk_window_set_title (GTK_WINDOW (chkptwarning), _("Power Off
> Selection"));
> - free (oklabel);
> -
> -- if ((graball (chkptwarning)) == -1) {
> -- /* grab failed */
> -- if (flags & SHUTDOWN) {
> -- suspend_write_childin (SUSPEND_POWER_OFF);
> -- } else {
> -- checkpoint();
> -- }
> -- }
> -+ status = graball (chkptwarning);
> -+
> -+ switch (status) {
> -+ case -1:
> -+ /* grab failed */
> -+ if (flags & SHUTDOWN) {
> -+ suspend_write_childin (SUSPEND_POWER_OFF);
> -+ } else {
> -+ checkpoint();
> -+ }
> -+ break;
> -+ case 0:
> -+ case 1:
> -+ break;
> -+ }
> -
> - ret = gtk_dialog_run (GTK_DIALOG (chkptwarning));
> -
> Index: patches/gnome-sys-suspend-01-security-check.diff
> ===================================================================
> --- patches/gnome-sys-suspend-01-security-check.diff (revision 11129)
> +++ patches/gnome-sys-suspend-01-security-check.diff (working copy)
> @@ -1,19 +0,0 @@
> ---- gnome-sys-suspend-0.2/src/gnome-suspend.c 2004-07-21
> 16:29:43.047686000 +0530
> -+++ gnome-sys-suspend-0.2-new/src/gnome-suspend.c 2004-07-21
> 16:29:32.514620000 +0530
> -@@ -59,6 +59,16 @@ process_service_request (char *service_s
> - int uadmin_ret;
> - int lowpower_ret;
> -
> -+ /* Before servicing any request, check if user has permissions
> -+ * to suspend, shutdown or lowpower the system. This spoils any
> -+ * attempt to misuse the system.
> -+ */
> -+ if (service_str[0] != SUSPEND_CHECK_PERMS) {
> -+ if (!has_perms_to_suspend ()) {
> -+ exit (ERR_PERM);
> -+ }
> -+ }
> -+
> - switch (service_str[0]) {
> -
> - case SUSPEND_CHECK_PERMS:
> Index: SUNWgnome-sys-suspend.spec
> ===================================================================
> --- SUNWgnome-sys-suspend.spec (revision 11129)
> +++ SUNWgnome-sys-suspend.spec (working copy)
> @@ -13,14 +13,16 @@
> Name: SUNWgnome-sys-suspend
> Summary: GNOME system suspend application
> Version: %{default_pkg_version}
> -%define tarball_version 0.3
> -Release: 3
> -Source: gnome-sys-suspend-%{tarball_version}.tar.gz
> +%define tarball_version 0.4
> +Release: 2
> +Source:
> http://dlc.sun.com/osol/jds/downloads/extras/sys-suspend/gnome-sys-suspend-%{tarball_version}.tar.bz2
> +# NOTE: Don't patch this module, update the sources.
> +# svn+ssh://USER at svn.opensolaris.org/svn/jds/sys-suspend/trunk
> +# Contact jds-re if you need a new tarball release.
> Source1: %{name}-manpages-0.1.tar.gz
> Source2: l10n-configure.sh
> -Patch1: gnome-sys-suspend-01-security-check.diff
> -Patch2: gnome-sys-suspend-02-cmd-options.diff
> -Patch3: gnome-sys-suspend-03-check-a11y.diff
> +#owner:yippi date:2007-04-13 type:bug bugster:6545464
> +Patch1: gnome-sys-suspend-01-fixshutdown.diff
> SUNW_BaseDir: %{_basedir}
> BuildRoot: %{_tmppath}/%{name}-%{version}-build
> %include default-depend.inc
> @@ -58,8 +60,6 @@
> cd gnome-sys-suspend-%{tarball_version}
> gzcat %SOURCE1 | tar xf -
> %patch1 -p1
> -%patch2 -p1
> -%patch3 -p1
>
> bash -x %SOURCE2
>
> @@ -122,6 +122,12 @@
> %endif
>
> %changelog
> +* Fri Apr 13 2007 - brian.cameron at sun.com
> +- Add patch to fix spelling of "default-shutdown" argument.
> +* Wed Mar 07 2007 - laca at sun.com
> +- bump to 0.4 remove patches.
> +* Thu Mar 01 2007 - Matt.Keenan at sun.com
> +- Fix #6198538, patch gnome-sys-suspend-04-already-running.diff
> * Mon Sep 04 2006 - Matt.Keenan at sun.com
> - New Manpage tarball
> * Sun Jun 11 2006 - laca at sun.com
>
>
> ------------------------------------------------------------------------
>
> --- gnome-sys-suspend-0.4/src/gnome-sys-suspend.c-orig 2007-04-13
> 16:20:45.794891000 +0800
> +++ gnome-sys-suspend-0.4/src/gnome-sys-suspend.c 2007-04-13
> 16:20:56.688677000 +0800
> @@ -1374,7 +1374,7 @@ main(int argc, char **argv)
> N_("Disable the selection popup dialog at invocation time"),
> NULL },
> { "disable-lockscreen", 'x', POPT_ARG_NONE,
> &disable_lockscreen, 0,
> N_("Disable the execution of lockscreen at resume time"),
> NULL },
> - { "default-sutdown", 'h', POPT_ARG_NONE, &default_shutdown, 0,
> + { "default-shutdown", 'h', POPT_ARG_NONE, &default_shutdown, 0,
> N_("Change default operation from suspend to shutdown"), NULL
> },
> { "display", 'd', POPT_ARG_STRING, &display, 0,
> N_("Connect to the X server specified by display"), NULL },