From f5073b6fb78e5f30a7777f4a6e14b354d251dd0c Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 01 2017 03:51:00 +0000 Subject: import vte291-0.46.2-1.el7 --- diff --git a/.gitignore b/.gitignore index da9adc7..8e8d615 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/vte-0.38.4.tar.xz +SOURCES/vte-0.46.2.tar.xz diff --git a/.vte291.metadata b/.vte291.metadata index b65155d..bc53dca 100644 --- a/.vte291.metadata +++ b/.vte291.metadata @@ -1 +1 @@ -2b42d4eb0ce0609ba2d811f9f3e30ad678a6a4e9 SOURCES/vte-0.38.4.tar.xz +259f91088ecfd98ebdd394f2269b39474b1ff8e0 SOURCES/vte-0.46.2.tar.xz diff --git a/SOURCES/0001-emulation-Support-CSI-3J-clear-scrollback.patch b/SOURCES/0001-emulation-Support-CSI-3J-clear-scrollback.patch deleted file mode 100644 index 083e6a4..0000000 --- a/SOURCES/0001-emulation-Support-CSI-3J-clear-scrollback.patch +++ /dev/null @@ -1,139 +0,0 @@ -From 51de1d6024eb17e97a517226248d6fc657e2d88e Mon Sep 17 00:00:00 2001 -From: Egmont Koblinger -Date: Sun, 28 Dec 2014 23:53:22 +0100 -Subject: [PATCH] emulation: Support CSI 3J (clear scrollback) - -https://bugzilla.gnome.org/show_bug.cgi?id=678042 ---- - src/caps.c | 2 +- - src/ring.c | 17 +++++++++++++++++ - src/ring.h | 1 + - src/vte-private.h | 1 + - src/vte.c | 14 ++++++++++++++ - src/vteseq.c | 7 ++++++- - 6 files changed, 40 insertions(+), 2 deletions(-) - -diff --git a/src/caps.c b/src/caps.c -index e6c235c2e10b..5ce8d931e444 100644 ---- a/src/caps.c -+++ b/src/caps.c -@@ -130,7 +130,7 @@ const char _vte_xterm_capability_strings[] = - ENTRY(CSI "I", "cursor-forward-tabulation") - ENTRY(CSI "%dI", "cursor-forward-tabulation") - ENTRY(CSI "J", "erase-in-display") -- ENTRY(CSI "%dJ", "erase-in-display") -+ ENTRY(CSI "%mJ", "erase-in-display") - ENTRY(CSI "?J", "selective-erase-in-display") - ENTRY(CSI "?%dJ", "selective-erase-in-display") - ENTRY(CSI "K", "erase-in-line") -diff --git a/src/ring.c b/src/ring.c -index 267be8b71a29..2d6fa41586ed 100644 ---- a/src/ring.c -+++ b/src/ring.c -@@ -595,6 +595,23 @@ _vte_ring_append (VteRing * ring) - - - /** -+ * _vte_ring_drop_scrollback: -+ * @ring: a #VteRing -+ * @position: drop contents up to this point, which must be in the writable region. -+ * -+ * Drop the scrollback (offscreen contents). -+ * -+ * TODOegmont: We wouldn't need the position argument after addressing 708213#c29. -+ */ -+void -+_vte_ring_drop_scrollback (VteRing * ring, gulong position) -+{ -+ _vte_ring_ensure_writable (ring, position); -+ ring->start = ring->writable = position; -+ _vte_ring_reset_streams (ring, position); -+} -+ -+/** - * _vte_ring_set_visible_rows_hint: - * @ring: a #VteRing - * -diff --git a/src/ring.h b/src/ring.h -index ec38019b56b5..24e3906a9008 100644 ---- a/src/ring.h -+++ b/src/ring.h -@@ -85,6 +85,7 @@ void _vte_ring_shrink (VteRing *ring, gulong max_len); - VteRowData *_vte_ring_insert (VteRing *ring, gulong position); - VteRowData *_vte_ring_append (VteRing *ring); - void _vte_ring_remove (VteRing *ring, gulong position); -+void _vte_ring_drop_scrollback (VteRing * ring, gulong position); - void _vte_ring_set_visible_rows_hint (VteRing *ring, gulong rows); - void _vte_ring_rewrap (VteRing *ring, glong columns, VteVisualPosition **markers); - gboolean _vte_ring_write_contents (VteRing *ring, -diff --git a/src/vte-private.h b/src/vte-private.h -index 1eb86a63cc1f..1f4ba76f62a4 100644 ---- a/src/vte-private.h -+++ b/src/vte-private.h -@@ -425,6 +425,7 @@ void _vte_terminal_queue_contents_changed(VteTerminal *terminal); - void _vte_terminal_emit_text_deleted(VteTerminal *terminal); - void _vte_terminal_emit_text_inserted(VteTerminal *terminal); - void _vte_terminal_cursor_down (VteTerminal *terminal); -+void _vte_terminal_drop_scrollback (VteTerminal *terminal); - gboolean _vte_terminal_insert_char(VteTerminal *terminal, gunichar c, - gboolean force_insert_mode, - gboolean invalidate_cells); -diff --git a/src/vte.c b/src/vte.c -index 0ce9e2ead688..cf0ec1c31392 100644 ---- a/src/vte.c -+++ b/src/vte.c -@@ -3016,6 +3016,20 @@ _vte_terminal_cursor_down (VteTerminal *terminal) - } - } - -+/* Drop the scrollback */ -+void -+_vte_terminal_drop_scrollback (VteTerminal *terminal) -+{ -+ /* Only for normal screen; alternate screen doesn't have a scrollback. */ -+ _vte_ring_drop_scrollback (terminal->pvt->normal_screen.row_data, -+ terminal->pvt->normal_screen.insert_delta); -+ -+ if (terminal->pvt->screen == &terminal->pvt->normal_screen) { -+ vte_terminal_queue_adjustment_value_changed (terminal, terminal->pvt->normal_screen.insert_delta); -+ _vte_terminal_adjust_adjustments_full (terminal); -+ } -+} -+ - /* Insert a single character into the stored data array. */ - gboolean - _vte_terminal_insert_char(VteTerminal *terminal, gunichar c, -diff --git a/src/vteseq.c b/src/vteseq.c -index 4d21f9f96f5d..ad0c2a689b3d 100644 ---- a/src/vteseq.c -+++ b/src/vteseq.c -@@ -2419,13 +2419,14 @@ vte_sequence_handler_erase_in_display (VteTerminal *terminal, GValueArray *param - guint i; - /* The default parameter is 0. */ - param = 0; -- /* Pull out a parameter. */ -+ /* Pull out the first parameter. */ - for (i = 0; (params != NULL) && (i < params->n_values); i++) { - value = g_value_array_get_nth(params, i); - if (!G_VALUE_HOLDS_LONG(value)) { - continue; - } - param = g_value_get_long(value); -+ break; - } - /* Clear the right area. */ - switch (param) { -@@ -2444,6 +2445,10 @@ vte_sequence_handler_erase_in_display (VteTerminal *terminal, GValueArray *param - /* Clear the entire screen. */ - _vte_terminal_clear_screen (terminal); - break; -+ case 3: -+ /* Drop the scrollback. */ -+ _vte_terminal_drop_scrollback (terminal); -+ break; - default: - break; - } --- -2.5.0 - diff --git a/SOURCES/0001-widget-Don-t-hide-the-mouse-pointer.patch b/SOURCES/0001-widget-Don-t-hide-the-mouse-pointer.patch deleted file mode 100644 index 22e1548..0000000 --- a/SOURCES/0001-widget-Don-t-hide-the-mouse-pointer.patch +++ /dev/null @@ -1,30 +0,0 @@ -From ab9f289d925262c369c6611f0ecaf1f63c6a738c Mon Sep 17 00:00:00 2001 -From: Debarshi Ray -Date: Wed, 1 Jul 2015 16:45:12 +0200 -Subject: [PATCH] widget: Don't hide the mouse pointer - -Although the code has been there for a while, users have recently -reported that the pointer remains hidden even after moving the mouse. -This is more irritating than having the pointer remain visible while -using the terminal, so let's disable this code until a fix shows up. - -https://bugzilla.gnome.org/show_bug.cgi?id=725342 ---- - src/vte.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/vte.c b/src/vte.c -index 906d799..7ea3a8b 100644 ---- a/src/vte.c -+++ b/src/vte.c -@@ -2189,6 +2189,7 @@ _vte_terminal_set_pointer_visible(VteTerminal *terminal, gboolean visible) - GdkWindow *window; - struct vte_match_regex *regex = NULL; - -+ visible = TRUE; - terminal->pvt->mouse_cursor_visible = visible; - - if (! gtk_widget_get_realized (&terminal->widget)) --- -2.1.0 - diff --git a/SOURCES/0001-widget-Only-show-the-cursor-on-motion-if-moved.patch b/SOURCES/0001-widget-Only-show-the-cursor-on-motion-if-moved.patch deleted file mode 100644 index 6195e27..0000000 --- a/SOURCES/0001-widget-Only-show-the-cursor-on-motion-if-moved.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 9077ef68bebee9a22d836a00af72aa02d5628ed4 Mon Sep 17 00:00:00 2001 -From: Bastien Nocera -Date: Fri, 16 Nov 2012 16:18:05 +0100 -Subject: [PATCH] widget: Only show the cursor on motion if moved - -Some devices, like Wacom tablets, will emit mouse motion -events even when the mouse doesn't move on the tablet. This -means that the mouse cursor will show up on the screen very shortly -after hiding. - -We now check the motion event against the last location of the -mouse cursor to avoid this behaviour. - -https://bugzilla.gnome.org/show_bug.cgi?id=688456 ---- - src/vte.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -diff --git a/src/vte.c b/src/vte.c -index bbe6cf6..c5922e6 100644 ---- a/src/vte.c -+++ b/src/vte.c -@@ -7294,8 +7294,11 @@ vte_terminal_motion_notify(GtkWidget *widget, GdkEventMotion *event) - } else { - /* Hilite any matches. */ - vte_terminal_match_hilite(terminal, x, y); -- /* Show the cursor. */ -- _vte_terminal_set_pointer_visible(terminal, TRUE); -+ /* Show the cursor if we moved. */ -+ if (event->type != GDK_MOTION_NOTIFY || -+ x != terminal->pvt->mouse_last_x || -+ y != terminal->pvt->mouse_last_y) -+ _vte_terminal_set_pointer_visible(terminal, TRUE); - } - - switch (event->type) { --- -1.8.0 - diff --git a/SOURCES/vte-scroll-speed.patch b/SOURCES/vte-scroll-speed.patch deleted file mode 100644 index a091c88..0000000 --- a/SOURCES/vte-scroll-speed.patch +++ /dev/null @@ -1,207 +0,0 @@ -From c69816b69f813c4678779e8a01f7a1b716170b1f Mon Sep 17 00:00:00 2001 -From: Debarshi Ray -Date: Fri, 13 May 2016 17:53:54 +0200 -Subject: [PATCH 1/2] widget: Add a property to configure the scroll speed - -By default, it is set to zero which gives the current behaviour of -moving the buffer by a function of the number of visible rows. - -https://bugzilla.redhat.com/show_bug.cgi?id=1103380 ---- - src/vte-private.h | 1 + - src/vte.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- - src/vteterminal.h | 3 +++ - 3 files changed, 66 insertions(+), 3 deletions(-) - -diff --git a/src/vte-private.h b/src/vte-private.h -index 1f4ba76f62a4..212ff56f3627 100644 ---- a/src/vte-private.h -+++ b/src/vte-private.h -@@ -284,6 +284,7 @@ struct _VteTerminalPrivate { - gboolean scroll_on_output; - gboolean scroll_on_keystroke; - gboolean alternate_screen_scroll; -+ guint scroll_speed; - long scrollback_lines; - - /* Cursor shape */ -diff --git a/src/vte.c b/src/vte.c -index da9addb8a904..14784ab9afb1 100644 ---- a/src/vte.c -+++ b/src/vte.c -@@ -169,6 +169,7 @@ enum { - PROP_MOUSE_POINTER_AUTOHIDE, - PROP_PTY, - PROP_REWRAP_ON_RESIZE, -+ PROP_SCROLL_SPEED, - PROP_SCROLLBACK_LINES, - PROP_SCROLL_ON_KEYSTROKE, - PROP_SCROLL_ON_OUTPUT, -@@ -10384,9 +10385,9 @@ vte_cairo_get_clip_region (cairo_t *cr) - static gboolean - vte_terminal_scroll(GtkWidget *widget, GdkEventScroll *event) - { -- GtkAdjustment *adj; - VteTerminal *terminal; - gdouble delta_x, delta_y; -+ gdouble scroll_speed; - gdouble v; - gint cnt, i; - int button; -@@ -10442,8 +10443,16 @@ vte_terminal_scroll(GtkWidget *widget, GdkEventScroll *event) - return TRUE; - } - -- adj = terminal->pvt->vadjustment; -- v = MAX (1., ceil (gtk_adjustment_get_page_increment (adj) / 10.)); -+ if (terminal->pvt->scroll_speed == 0) { -+ GtkAdjustment *adj; -+ -+ adj = terminal->pvt->vadjustment; -+ scroll_speed = ceil (gtk_adjustment_get_page_increment (adj) / 10.); -+ } else { -+ scroll_speed = terminal->pvt->scroll_speed; -+ } -+ -+ v = MAX (1., scroll_speed); - _vte_debug_print(VTE_DEBUG_EVENTS, - "Scroll speed is %d lines per non-smooth scroll unit\n", - (int) v); -@@ -10560,6 +10569,9 @@ vte_terminal_get_property (GObject *object, - case PROP_REWRAP_ON_RESIZE: - g_value_set_boolean (value, vte_terminal_get_rewrap_on_resize (terminal)); - break; -+ case PROP_SCROLL_SPEED: -+ g_value_set_uint (value, pvt->scroll_speed); -+ break; - case PROP_SCROLLBACK_LINES: - g_value_set_uint (value, pvt->scrollback_lines); - break; -@@ -10646,6 +10658,9 @@ vte_terminal_set_property (GObject *object, - case PROP_REWRAP_ON_RESIZE: - vte_terminal_set_rewrap_on_resize (terminal, g_value_get_boolean (value)); - break; -+ case PROP_SCROLL_SPEED: -+ vte_terminal_set_scroll_speed (terminal, g_value_get_uint (value)); -+ break; - case PROP_SCROLLBACK_LINES: - vte_terminal_set_scrollback_lines (terminal, g_value_get_uint (value)); - break; -@@ -11472,6 +11487,23 @@ vte_terminal_class_init(VteTerminalClass *klass) - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY)); - - /** -+ * VteTerminal:scroll-speed: -+ * -+ * The number of lines by which the buffer is moved when -+ * scrolling with a mouse wheel on top of the -+ * terminal. Setting it to zero will cause the buffer to be -+ * moved by an amount depending on the number of visible rows -+ * the widget can display. -+ */ -+ g_object_class_install_property -+ (gobject_class, -+ PROP_SCROLL_SPEED, -+ g_param_spec_uint ("scroll-speed", NULL, NULL, -+ 0, G_MAXUINT, -+ 0, -+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY)); -+ -+ /** - * VteTerminal:scrollback-lines: - * - * The length of the scrollback buffer used by the terminal. The size of -@@ -11990,6 +12022,33 @@ vte_terminal_get_cursor_shape(VteTerminal *terminal) - } - - /** -+ * vte_terminal_set_scroll_speed: -+ * @terminal: a #VteTerminal -+ * @scroll_speed: move the buffer by this number of lines while scrolling -+ * -+ * Sets the number of lines by which the buffer is moved when -+ * scrolling with a mouse wheel. Setting it to zero will cause the -+ * buffer to be moved by an amount depending on the number of visible -+ * rows the widget can display. -+ */ -+void -+vte_terminal_set_scroll_speed(VteTerminal *terminal, -+ guint scroll_speed) -+{ -+ VteTerminalPrivate *pvt; -+ -+ g_return_if_fail(VTE_IS_TERMINAL(terminal)); -+ -+ pvt = terminal->pvt; -+ -+ if (pvt->scroll_speed == scroll_speed) -+ return; -+ -+ pvt->scroll_speed = scroll_speed; -+ g_object_notify(G_OBJECT(terminal), "scroll-speed"); -+} -+ -+/** - * vte_terminal_set_scrollback_lines: - * @terminal: a #VteTerminal - * @lines: the length of the history buffer -diff --git a/src/vteterminal.h b/src/vteterminal.h -index 88e21b86704a..e6c23c7fe109 100644 ---- a/src/vteterminal.h -+++ b/src/vteterminal.h -@@ -221,6 +221,9 @@ void vte_terminal_set_cursor_shape(VteTerminal *terminal, - VteCursorShape shape) _VTE_GNUC_NONNULL(1); - VteCursorShape vte_terminal_get_cursor_shape(VteTerminal *terminal) _VTE_GNUC_NONNULL(1); - -+void vte_terminal_set_scroll_speed(VteTerminal *terminal, -+ guint scroll_speed) _VTE_GNUC_NONNULL(1); -+ - /* Set the number of scrollback lines, above or at an internal minimum. */ - void vte_terminal_set_scrollback_lines(VteTerminal *terminal, - glong lines) _VTE_GNUC_NONNULL(1); --- -2.5.0 - - -From 4f39f6592d1bc5c0c9aefd9176292015ce48ee38 Mon Sep 17 00:00:00 2001 -From: Debarshi Ray -Date: Fri, 13 May 2016 17:54:57 +0200 -Subject: [PATCH 2/2] vteapp: Add a test for the scroll-speed property - -https://bugzilla.redhat.com/show_bug.cgi?id=1103380 ---- - src/app.vala | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/src/app.vala b/src/app.vala -index 67a58a24ce6c..396241f11a68 100644 ---- a/src/app.vala -+++ b/src/app.vala -@@ -122,6 +122,7 @@ class Window : Gtk.ApplicationWindow - terminal.set_rewrap_on_resize(!App.Options.no_rewrap); - terminal.set_scroll_on_output(false); - terminal.set_scroll_on_keystroke(true); -+ terminal.set_scroll_speed(App.Options.scroll_speed); - terminal.set_scrollback_lines(App.Options.scrollback_lines); - - /* Style */ -@@ -564,6 +565,7 @@ class App : Gtk.Application - public static string? output_filename = null; - private static string? pty_flags_string = null; - public static bool reverse = false; -+ public static uint scroll_speed = 0; - public static int scrollback_lines = 512; - public static int transparency_percent = 0; - public static bool version = false; -@@ -755,6 +757,8 @@ class App : Gtk.Application - "PTY flags set from default|no-utmp|no-wtmp|no-lastlog|no-helper|no-fallback", null }, - { "reverse", 0, 0, OptionArg.NONE, ref reverse, - "Reverse foreground/background colors", null }, -+ { "scroll-speed", 'n', 0, OptionArg.INT, ref scroll_speed, -+ "Specify the scroll speed", null }, - { "scrollback-lines", 'n', 0, OptionArg.INT, ref scrollback_lines, - "Specify the number of scrollback-lines", null }, - { "transparent", 'T', 0, OptionArg.INT, ref transparency_percent, --- -2.5.0 - diff --git a/SOURCES/vte291-command-notify-scroll-speed.patch b/SOURCES/vte291-command-notify-scroll-speed.patch new file mode 100644 index 0000000..cf82747 --- /dev/null +++ b/SOURCES/vte291-command-notify-scroll-speed.patch @@ -0,0 +1,603 @@ +From edf5a8144b92989cba2ee2684cb29839e76d9bc8 Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Wed, 7 Jan 2015 16:01:00 +0100 +Subject: [PATCH 1/5] Add sequences and signals for desktop notification + +Add sequences + OSC 777 ; notify ; SUMMARY ; BODY BEL + OSC 777 ; notify ; SUMMARY BEL + OSC 777 ; notify ; SUMMARY ; BODY ST + OSC 777 ; notify ; SUMMARY ST + +that let terminal applications send a notification to the desktop +environment. + +Based on Enlightenment's Terminology: +https://phab.enlightenment.org/T1765 + +https://bugzilla.gnome.org/show_bug.cgi?id=711059 +--- + src/caps.cc | 4 +++ + src/marshal.list | 1 + + src/vte.cc | 12 +++++++ + src/vte/vteterminal.h | 4 ++- + src/vtegtk.cc | 21 ++++++++++++ + src/vtegtk.hh | 1 + + src/vteinternal.hh | 5 +++ + src/vteseq-n.gperf | 1 + + src/vteseq.cc | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++ + 9 files changed, 138 insertions(+), 1 deletion(-) + +diff --git a/src/caps.cc b/src/caps.cc +index 47571269b883..3e496ff33194 100644 +--- a/src/caps.cc ++++ b/src/caps.cc +@@ -255,6 +255,8 @@ const char _vte_xterm_capability_strings[] = + ENTRY(OSC "118" BEL, "reset-tek-cursor-color") + ENTRY(OSC "119" BEL, "reset-highlight-foreground-color") + ENTRY(OSC "777;%s" BEL, "urxvt-777") ++ ENTRY(OSC "777;%s;%s;%s" BEL, "send-notification") ++ ENTRY(OSC "777;%s;%s" BEL, "send-notification") + ENTRY(OSC "1337;%s" BEL, "iterm2-1337") + + COMMENT(/* Set text parameters, ST-terminated versions. */) +@@ -292,6 +294,8 @@ const char _vte_xterm_capability_strings[] = + ENTRY(OSC "118" ST, "reset-tek-cursor-color") + ENTRY(OSC "119" ST, "reset-highlight-foreground-color") + ENTRY(OSC "777;%s" ST, "urxvt-777") ++ ENTRY(OSC "777;%s;%s;%s" ST, "send-notification") ++ ENTRY(OSC "777;%s;%s" ST, "send-notification") + ENTRY(OSC "1337;%s" ST, "iterm2-1337") + + COMMENT(/* These may be bogus, I can't find docs for them anywhere (#104154). */) +diff --git a/src/marshal.list b/src/marshal.list +index 0276422ec6d4..2c35c685930a 100644 +--- a/src/marshal.list ++++ b/src/marshal.list +@@ -1,4 +1,5 @@ + VOID:INT,INT + VOID:OBJECT,OBJECT ++VOID:STRING,STRING + VOID:STRING,UINT + VOID:UINT,UINT +diff --git a/src/vte.cc b/src/vte.cc +index ea415886f46c..26832c0b326c 100644 +--- a/src/vte.cc ++++ b/src/vte.cc +@@ -8292,6 +8292,9 @@ VteTerminalPrivate::~VteTerminalPrivate() + + remove_update_timeout(this); + ++ g_free (m_notification_summary); ++ g_free (m_notification_body); ++ + /* discard title updates */ + g_free(m_window_title); + g_free(m_window_title_changed); +@@ -10325,6 +10328,15 @@ VteTerminalPrivate::emit_pending_signals() + + emit_adjustment_changed(); + ++ if (m_notification_received) { ++ _vte_debug_print (VTE_DEBUG_SIGNALS, ++ "Emitting `notification-received'.\n"); ++ g_signal_emit(object, signals[SIGNAL_NOTIFICATION_RECEIVED], 0, ++ m_notification_summary, ++ m_notification_body); ++ m_notification_received = FALSE; ++ } ++ + if (m_window_title_changed) { + g_free (m_window_title); + m_window_title = m_window_title_changed; +diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h +index 7836271db108..f514c3b227f9 100644 +--- a/src/vte/vteterminal.h ++++ b/src/vte/vteterminal.h +@@ -104,8 +104,10 @@ struct _VteTerminalClass { + + void (*bell)(VteTerminal* terminal); + ++ void (*notification_received)(VteTerminal* terminal, const gchar *summary, const gchar *body); ++ + /* Padding for future expansion. */ +- gpointer padding[16]; ++ gpointer padding[15]; + + VteTerminalClassPrivate *priv; + }; +diff --git a/src/vtegtk.cc b/src/vtegtk.cc +index 924b5a084dd3..a65a2a98b44a 100644 +--- a/src/vtegtk.cc ++++ b/src/vtegtk.cc +@@ -657,6 +657,7 @@ vte_terminal_class_init(VteTerminalClass *klass) + klass->child_exited = NULL; + klass->encoding_changed = NULL; + klass->char_size_changed = NULL; ++ klass->notification_received = NULL; + klass->window_title_changed = NULL; + klass->icon_title_changed = NULL; + klass->selection_changed = NULL; +@@ -733,6 +734,26 @@ vte_terminal_class_init(VteTerminalClass *klass) + 1, G_TYPE_INT); + + /** ++ * VteTerminal::notification-received: ++ * @vteterminal: the object which received the signal ++ * @summary: The summary ++ * @body: (allow-none): Extra optional text ++ * ++ * Emitted when a process running in the terminal wants to ++ * send a notification to the desktop environment. ++ */ ++ signals[SIGNAL_NOTIFICATION_RECEIVED] = ++ g_signal_new(I_("notification-received"), ++ G_OBJECT_CLASS_TYPE(klass), ++ G_SIGNAL_RUN_LAST, ++ G_STRUCT_OFFSET(VteTerminalClass, notification_received), ++ NULL, ++ NULL, ++ _vte_marshal_VOID__STRING_STRING, ++ G_TYPE_NONE, ++ 2, G_TYPE_STRING, G_TYPE_STRING); ++ ++ /** + * VteTerminal::window-title-changed: + * @vteterminal: the object which received the signal + * +diff --git a/src/vtegtk.hh b/src/vtegtk.hh +index 5340725d374c..f8a83525b18c 100644 +--- a/src/vtegtk.hh ++++ b/src/vtegtk.hh +@@ -55,6 +55,7 @@ enum { + SIGNAL_TEXT_INSERTED, + SIGNAL_TEXT_MODIFIED, + SIGNAL_TEXT_SCROLLED, ++ SIGNAL_NOTIFICATION_RECEIVED, + SIGNAL_WINDOW_TITLE_CHANGED, + LAST_SIGNAL + }; +diff --git a/src/vteinternal.hh b/src/vteinternal.hh +index cff2157cc0d0..31636f0bc56b 100644 +--- a/src/vteinternal.hh ++++ b/src/vteinternal.hh +@@ -493,6 +493,11 @@ public: + gboolean m_cursor_moved_pending; + gboolean m_contents_changed_pending; + ++ /* desktop notification */ ++ gboolean m_notification_received; ++ gchar *m_notification_summary; ++ gchar *m_notification_body; ++ + /* window name changes */ + char* m_window_title; + char* m_window_title_changed; +diff --git a/src/vteseq-n.gperf b/src/vteseq-n.gperf +index 573f045178ce..34fff99ccaca 100644 +--- a/src/vteseq-n.gperf ++++ b/src/vteseq-n.gperf +@@ -170,4 +170,5 @@ struct vteseq_n_struct { + "set-current-directory-uri", VTE_SEQUENCE_HANDLER(vte_sequence_handler_set_current_directory_uri) + "set-current-file-uri", VTE_SEQUENCE_HANDLER(vte_sequence_handler_set_current_file_uri) + "urxvt-777", VTE_SEQUENCE_HANDLER(vte_sequence_handler_urxvt_777) ++"send-notification", VTE_SEQUENCE_HANDLER(vte_sequence_handler_send_notification) + "iterm2-1337", VTE_SEQUENCE_HANDLER(vte_sequence_handler_iterm2_1337) +diff --git a/src/vteseq.cc b/src/vteseq.cc +index 25e697b8c1d8..d68605a2d843 100644 +--- a/src/vteseq.cc ++++ b/src/vteseq.cc +@@ -2322,6 +2322,96 @@ vte_sequence_handler_return_terminal_id (VteTerminalPrivate *that, GValueArray * + vte_sequence_handler_send_primary_device_attributes (that, params); + } + ++static void ++vte_sequence_handler_send_notification (VteTerminalPrivate *that, GValueArray *params) ++{ ++ GValue *value; ++ const char *end; ++ char *option = NULL; ++ char *str = NULL; ++ char *p, *validated; ++ ++ g_clear_pointer (&that->m_notification_summary, g_free); ++ g_clear_pointer (&that->m_notification_body, g_free); ++ ++ value = g_value_array_get_nth (params, 0); ++ if (value == NULL) { ++ goto out; ++ } ++ ++ if (G_VALUE_HOLDS_STRING (value)) { ++ option = g_value_dup_string (value); ++ } else if (G_VALUE_HOLDS_POINTER (value)) { ++ option = that->ucs4_to_utf8 ((const guchar *)g_value_get_pointer (value)); ++ } else { ++ goto out; ++ } ++ ++ if (g_strcmp0 (option, "notify") != 0) { ++ goto out; ++ } ++ ++ value = g_value_array_get_nth (params, 1); ++ if (value == NULL) { ++ goto out; ++ } ++ ++ if (G_VALUE_HOLDS_STRING (value)) { ++ str = g_value_dup_string (value); ++ } else if (G_VALUE_HOLDS_POINTER (value)) { ++ str = that->ucs4_to_utf8 ((const guchar *)g_value_get_pointer (value)); ++ } else { ++ goto out; ++ } ++ ++ g_utf8_validate (str, strlen (str), &end); ++ validated = g_strndup (str, end - str); ++ ++ /* No control characters allowed. */ ++ for (p = validated; *p != '\0'; p++) { ++ if ((*p & 0x1f) == *p) { ++ *p = ' '; ++ } ++ } ++ ++ that->m_notification_summary = validated; ++ g_free (str); ++ ++ that->m_notification_received = TRUE; ++ if (params->n_values == 2) { ++ goto out; ++ } ++ ++ value = g_value_array_get_nth (params, 2); ++ if (value == NULL) { ++ goto out; ++ } ++ ++ if (G_VALUE_HOLDS_STRING (value)) { ++ str = g_value_dup_string (value); ++ } else if (G_VALUE_HOLDS_POINTER (value)) { ++ str = that->ucs4_to_utf8 ((const guchar *)g_value_get_pointer (value)); ++ } else { ++ goto out; ++ } ++ ++ g_utf8_validate (str, strlen (str), &end); ++ validated = g_strndup (str, end - str); ++ ++ /* No control characters allowed. */ ++ for (p = validated; *p != '\0'; p++) { ++ if ((*p & 0x1f) == *p) { ++ *p = ' '; ++ } ++ } ++ ++ that->m_notification_body = validated; ++ g_free (str); ++ ++ out: ++ g_free (option); ++} ++ + /* Send secondary device attributes. */ + static void + vte_sequence_handler_send_secondary_device_attributes (VteTerminalPrivate *that, GValueArray *params) +-- +2.9.4 + + +From a450f736f9ebbb4bb617e72ec7a684d12ea6f155 Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Thu, 29 Jan 2015 13:09:17 +0100 +Subject: [PATCH 2/5] vte.sh: Emit OSC 777 from PROMPT_COMMAND + +https://bugzilla.gnome.org/show_bug.cgi?id=711059 +--- + src/vte.sh | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/vte.sh b/src/vte.sh +index 2d211caa2f17..1c0543bd9d26 100644 +--- a/src/vte.sh ++++ b/src/vte.sh +@@ -50,9 +50,11 @@ __vte_osc7 () { + } + + __vte_prompt_command() { ++ local command=$(HISTTIMEFORMAT= history 1 | sed 's/^ *[0-9]\+ *//') ++ command="${command//;/ }" + local pwd='~' + [ "$PWD" != "$HOME" ] && pwd=${PWD/#$HOME\//\~\/} +- printf "\033]0;%s@%s:%s\007%s" "${USER}" "${HOSTNAME%%.*}" "${pwd}" "$(__vte_osc7)" ++ printf "\033]777;notify;Command completed;%s\007\033]0;%s@%s:%s\007%s" "${command}" "${USER}" "${HOSTNAME%%.*}" "${pwd}" "$(__vte_osc7)" + } + + case "$TERM" in +-- +2.9.4 + + +From 9e302d1cc99c1c9e19f60007709711632e1c51a1 Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Thu, 22 Jan 2015 16:37:10 +0100 +Subject: [PATCH 3/5] vteapp: Add a test for the notification-received signal + +--- + src/app.vala | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/app.vala b/src/app.vala +index 58698f92fc10..464a02a00230 100644 +--- a/src/app.vala ++++ b/src/app.vala +@@ -309,6 +309,8 @@ class Window : Gtk.ApplicationWindow + if (App.Options.object_notifications) + terminal.notify.connect(notify_cb); + ++ terminal.notification_received.connect(notification_received_cb); ++ + /* Settings */ + if (App.Options.no_double_buffer) + terminal.set_double_buffered(false); +@@ -772,6 +774,11 @@ class Window : Gtk.ApplicationWindow + set_title(terminal.get_window_title()); + } + ++ private void notification_received_cb(Vte.Terminal terminal, string summary, string? body) ++ { ++ print ("[%s]: %s\n", summary, body); ++ } ++ + } /* class Window */ + + class App : Gtk.Application +-- +2.9.4 + + +From dd609e8f9514670dbe3ccc2ce9b21363f98d2950 Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Fri, 13 May 2016 17:53:54 +0200 +Subject: [PATCH 4/5] Add a property to configure the scroll speed + +By default, it is set to zero which gives the current behaviour of +moving the buffer by a function of the number of visible rows. + +https://bugzilla.redhat.com/show_bug.cgi?id=1103380 +--- + doc/reference/vte-sections.txt | 1 + + src/vte.cc | 19 +++++++++++++++++- + src/vte/vteterminal.h | 4 ++++ + src/vtegtk.cc | 45 ++++++++++++++++++++++++++++++++++++++++++ + src/vtegtk.hh | 1 + + src/vteinternal.hh | 2 ++ + 6 files changed, 71 insertions(+), 1 deletion(-) + +diff --git a/doc/reference/vte-sections.txt b/doc/reference/vte-sections.txt +index 56ae7754491d..58ce6c2c5c23 100644 +--- a/doc/reference/vte-sections.txt ++++ b/doc/reference/vte-sections.txt +@@ -41,6 +41,7 @@ vte_terminal_set_cursor_shape + vte_terminal_get_cursor_shape + vte_terminal_get_cursor_blink_mode + vte_terminal_set_cursor_blink_mode ++vte_terminal_set_scroll_speed + vte_terminal_set_scrollback_lines + vte_terminal_set_font + vte_terminal_get_font +diff --git a/src/vte.cc b/src/vte.cc +index 26832c0b326c..b35bb650d3e3 100644 +--- a/src/vte.cc ++++ b/src/vte.cc +@@ -9611,6 +9611,7 @@ void + VteTerminalPrivate::widget_scroll(GdkEventScroll *event) + { + gdouble delta_x, delta_y; ++ gdouble scroll_speed; + gdouble v; + gint cnt, i; + int button; +@@ -9664,7 +9665,13 @@ VteTerminalPrivate::widget_scroll(GdkEventScroll *event) + return; + } + +- v = MAX (1., ceil (gtk_adjustment_get_page_increment (m_vadjustment) / 10.)); ++ if (m_scroll_speed == 0) { ++ scroll_speed = ceil (gtk_adjustment_get_page_increment (m_vadjustment) / 10.); ++ } else { ++ scroll_speed = m_scroll_speed; ++ } ++ ++ v = MAX (1., scroll_speed); + _vte_debug_print(VTE_DEBUG_EVENTS, + "Scroll speed is %d lines per non-smooth scroll unit\n", + (int) v); +@@ -9881,6 +9888,16 @@ VteTerminalPrivate::decscusr_cursor_shape() + } + + bool ++VteTerminalPrivate::set_scroll_speed(unsigned int scroll_speed) ++{ ++ if (scroll_speed == m_scroll_speed) ++ return false; ++ ++ m_scroll_speed = scroll_speed; ++ return true; ++} ++ ++bool + VteTerminalPrivate::set_scrollback_lines(long lines) + { + glong low, high, next; +diff --git a/src/vte/vteterminal.h b/src/vte/vteterminal.h +index f514c3b227f9..89c267555cf9 100644 +--- a/src/vte/vteterminal.h ++++ b/src/vte/vteterminal.h +@@ -267,6 +267,10 @@ void vte_terminal_set_cursor_shape(VteTerminal *terminal, + _VTE_PUBLIC + VteCursorShape vte_terminal_get_cursor_shape(VteTerminal *terminal) _VTE_GNUC_NONNULL(1); + ++_VTE_PUBLIC ++void vte_terminal_set_scroll_speed(VteTerminal *terminal, ++ guint scroll_speed) _VTE_GNUC_NONNULL(1); ++ + /* Set the number of scrollback lines, above or at an internal minimum. */ + _VTE_PUBLIC + void vte_terminal_set_scrollback_lines(VteTerminal *terminal, +diff --git a/src/vtegtk.cc b/src/vtegtk.cc +index a65a2a98b44a..20d36449368c 100644 +--- a/src/vtegtk.cc ++++ b/src/vtegtk.cc +@@ -464,6 +464,9 @@ vte_terminal_get_property (GObject *object, + case PROP_REWRAP_ON_RESIZE: + g_value_set_boolean (value, vte_terminal_get_rewrap_on_resize (terminal)); + break; ++ case PROP_SCROLL_SPEED: ++ g_value_set_uint (value, impl->m_scroll_speed); ++ break; + case PROP_SCROLLBACK_LINES: + g_value_set_uint (value, impl->m_scrollback_lines); + break; +@@ -550,6 +553,9 @@ vte_terminal_set_property (GObject *object, + case PROP_REWRAP_ON_RESIZE: + vte_terminal_set_rewrap_on_resize (terminal, g_value_get_boolean (value)); + break; ++ case PROP_SCROLL_SPEED: ++ vte_terminal_set_scroll_speed (terminal, g_value_get_uint (value)); ++ break; + case PROP_SCROLLBACK_LINES: + vte_terminal_set_scrollback_lines (terminal, g_value_get_uint (value)); + break; +@@ -1406,6 +1412,21 @@ vte_terminal_class_init(VteTerminalClass *klass) + (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY)); + + /** ++ * VteTerminal:scroll-speed: ++ * ++ * The number of lines by which the buffer is moved when ++ * scrolling with a mouse wheel on top of the terminal ++ * Setting it to zero will cause the buffer to be moved by an ++ * amount depending on the number of visible rows the widget ++ * can display. ++ */ ++ pspecs[PROP_SCROLL_SPEED] = ++ g_param_spec_uint ("scroll-speed", NULL, NULL, ++ 0, G_MAXUINT, ++ 0, ++ (GParamFlags) (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY)); ++ ++ /** + * VteTerminal:scrollback-lines: + * + * The length of the scrollback buffer used by the terminal. The size of +@@ -3448,6 +3469,30 @@ vte_terminal_get_row_count(VteTerminal *terminal) + } + + /** ++ * vte_terminal_set_scroll_speed: ++ * @terminal: a #VteTerminal ++ * @scroll_speed: move the buffer by this number of lines while scrolling ++ * ++ * Sets the number of lines by which the buffer is moved when ++ * scrolling with a mouse wheel. Setting it to zero will cause the ++ * buffer to be moved by an amount depending on the number of visible ++ * rows the widget can display. ++ */ ++void ++vte_terminal_set_scroll_speed(VteTerminal *terminal, guint scroll_speed) ++{ ++ g_return_if_fail(VTE_IS_TERMINAL(terminal)); ++ ++ GObject *object = G_OBJECT(terminal); ++ g_object_freeze_notify(object); ++ ++ if (IMPL(terminal)->set_scroll_speed(scroll_speed)) ++ g_object_notify_by_pspec(object, pspecs[PROP_SCROLL_SPEED]); ++ ++ g_object_thaw_notify(object); ++} ++ ++/** + * vte_terminal_set_scrollback_lines: + * @terminal: a #VteTerminal + * @lines: the length of the history buffer +diff --git a/src/vtegtk.hh b/src/vtegtk.hh +index f8a83525b18c..98c616f54de6 100644 +--- a/src/vtegtk.hh ++++ b/src/vtegtk.hh +@@ -80,6 +80,7 @@ enum { + PROP_MOUSE_POINTER_AUTOHIDE, + PROP_PTY, + PROP_REWRAP_ON_RESIZE, ++ PROP_SCROLL_SPEED, + PROP_SCROLLBACK_LINES, + PROP_SCROLL_ON_KEYSTROKE, + PROP_SCROLL_ON_OUTPUT, +diff --git a/src/vteinternal.hh b/src/vteinternal.hh +index 31636f0bc56b..e38176cb3ff5 100644 +--- a/src/vteinternal.hh ++++ b/src/vteinternal.hh +@@ -385,6 +385,7 @@ public: + gboolean m_scroll_on_output; + gboolean m_scroll_on_keystroke; + gboolean m_alternate_screen_scroll; ++ guint m_scroll_speed; + vte::grid::row_t m_scrollback_lines; + + /* Restricted scrolling */ +@@ -1093,6 +1094,7 @@ public: + bool set_mouse_autohide(bool autohide); + bool set_pty(VtePty *pty); + bool set_rewrap_on_resize(bool rewrap); ++ bool set_scroll_speed(unsigned int scroll_speed); + bool set_scrollback_lines(long lines); + bool set_scroll_on_keystroke(bool scroll); + bool set_scroll_on_output(bool scroll); +-- +2.9.4 + + +From fe5f11c0abf05f95a7d6e329f55e93000b558b6f Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Fri, 13 May 2016 17:54:57 +0200 +Subject: [PATCH 5/5] vteapp: Add a test for the scroll-speed property + +https://bugzilla.redhat.com/show_bug.cgi?id=1103380 +--- + src/app.vala | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/app.vala b/src/app.vala +index 464a02a00230..31b10aef55d2 100644 +--- a/src/app.vala ++++ b/src/app.vala +@@ -334,6 +334,7 @@ class Window : Gtk.ApplicationWindow + terminal.set_rewrap_on_resize(!App.Options.no_rewrap); + terminal.set_scroll_on_output(false); + terminal.set_scroll_on_keystroke(true); ++ terminal.set_scroll_speed(App.Options.scroll_speed); + terminal.set_scrollback_lines(App.Options.scrollback_lines); + + /* Style */ +@@ -847,6 +848,7 @@ class App : Gtk.Application + public static bool object_notifications = false; + public static string? output_filename = null; + public static bool reverse = false; ++ public static uint scroll_speed = 0; + public static int scrollback_lines = 512; + public static int transparency_percent = 0; + public static bool version = false; +@@ -1038,6 +1040,8 @@ class App : Gtk.Application + "Save terminal contents to file at exit", null }, + { "reverse", 0, 0, OptionArg.NONE, ref reverse, + "Reverse foreground/background colors", null }, ++ { "scroll-speed", 0, 0, OptionArg.INT, ref scroll_speed, ++ "Specify the scroll speed", null }, + { "scrollback-lines", 'n', 0, OptionArg.INT, ref scrollback_lines, + "Specify the number of scrollback-lines", null }, + { "transparent", 'T', 0, OptionArg.INT, ref transparency_percent, +-- +2.9.4 + diff --git a/SOURCES/vte291-git.mk b/SOURCES/vte291-git.mk new file mode 100644 index 0000000..9d4bf25 --- /dev/null +++ b/SOURCES/vte291-git.mk @@ -0,0 +1,333 @@ +# git.mk, a small Makefile to autogenerate .gitignore files +# for autotools-based projects. +# +# Copyright 2009, Red Hat, Inc. +# Copyright 2010,2011,2012,2013 Behdad Esfahbod +# Written by Behdad Esfahbod +# +# Copying and distribution of this file, with or without modification, +# is permitted in any medium without royalty provided the copyright +# notice and this notice are preserved. +# +# The latest version of this file can be downloaded from: +GIT_MK_URL = https://raw.githubusercontent.com/behdad/git.mk/master/git.mk +# +# Bugs, etc, should be reported upstream at: +# https://github.com/behdad/git.mk +# +# To use in your project, import this file in your git repo's toplevel, +# then do "make -f git.mk". This modifies all Makefile.am files in +# your project to -include git.mk. Remember to add that line to new +# Makefile.am files you create in your project, or just rerun the +# "make -f git.mk". +# +# This enables automatic .gitignore generation. If you need to ignore +# more files, add them to the GITIGNOREFILES variable in your Makefile.am. +# But think twice before doing that. If a file has to be in .gitignore, +# chances are very high that it's a generated file and should be in one +# of MOSTLYCLEANFILES, CLEANFILES, DISTCLEANFILES, or MAINTAINERCLEANFILES. +# +# The only case that you need to manually add a file to GITIGNOREFILES is +# when remove files in one of mostlyclean-local, clean-local, distclean-local, +# or maintainer-clean-local make targets. +# +# Note that for files like editor backup, etc, there are better places to +# ignore them. See "man gitignore". +# +# If "make maintainer-clean" removes the files but they are not recognized +# by this script (that is, if "git status" shows untracked files still), send +# me the output of "git status" as well as your Makefile.am and Makefile for +# the directories involved and I'll diagnose. +# +# For a list of toplevel files that should be in MAINTAINERCLEANFILES, see +# Makefile.am.sample in the git.mk git repo. +# +# Don't EXTRA_DIST this file. It is supposed to only live in git clones, +# not tarballs. It serves no useful purpose in tarballs and clutters the +# build dir. +# +# This file knows how to handle autoconf, automake, libtool, gtk-doc, +# gnome-doc-utils, yelp.m4, mallard, intltool, gsettings, dejagnu, appdata, +# appstream. +# +# This makefile provides the following targets: +# +# - all: "make all" will build all gitignore files. +# - gitignore: makes all gitignore files in the current dir and subdirs. +# - .gitignore: make gitignore file for the current dir. +# - gitignore-recurse: makes all gitignore files in the subdirs. +# +# KNOWN ISSUES: +# +# - Recursive configure doesn't work as $(top_srcdir)/git.mk inside the +# submodule doesn't find us. If you have configure.{in,ac} files in +# subdirs, add a proxy git.mk file in those dirs that simply does: +# "include $(top_srcdir)/../git.mk". Add more ..'s to your taste. +# And add those files to git. See vte/gnome-pty-helper/git.mk for +# example. +# + + + +############################################################################### +# Variables user modules may want to add to toplevel MAINTAINERCLEANFILES: +############################################################################### + +# +# Most autotools-using modules should be fine including this variable in their +# toplevel MAINTAINERCLEANFILES: +GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL = \ + $(srcdir)/aclocal.m4 \ + $(srcdir)/autoscan.log \ + $(srcdir)/configure.scan \ + `AUX_DIR=$(srcdir)/$$(cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_AUX_DIR:$$1' ./configure.ac); \ + test "x$$AUX_DIR" = "x$(srcdir)/" && AUX_DIR=$(srcdir); \ + for x in \ + ar-lib \ + compile \ + config.guess \ + config.sub \ + depcomp \ + install-sh \ + ltmain.sh \ + missing \ + mkinstalldirs \ + test-driver \ + ylwrap \ + ; do echo "$$AUX_DIR/$$x"; done` \ + `cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_HEADERS:$$1' ./configure.ac | \ + head -n 1 | while read f; do echo "$(srcdir)/$$f.in"; done` +# +# All modules should also be fine including the following variable, which +# removes automake-generated Makefile.in files: +GITIGNORE_MAINTAINERCLEANFILES_MAKEFILE_IN = \ + `cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_FILES:$$1' ./configure.ac | \ + while read f; do \ + case $$f in Makefile|*/Makefile) \ + test -f "$(srcdir)/$$f.am" && echo "$(srcdir)/$$f.in";; esac; \ + done` +# +# Modules that use libtool and use AC_CONFIG_MACRO_DIR() may also include this, +# though it's harmless to include regardless. +GITIGNORE_MAINTAINERCLEANFILES_M4_LIBTOOL = \ + `MACRO_DIR=$(srcdir)/$$(cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_MACRO_DIR:$$1' ./configure.ac); \ + if test "x$$MACRO_DIR" != "x$(srcdir)/"; then \ + for x in \ + libtool.m4 \ + ltoptions.m4 \ + ltsugar.m4 \ + ltversion.m4 \ + lt~obsolete.m4 \ + ; do echo "$$MACRO_DIR/$$x"; done; \ + fi` + + + +############################################################################### +# Default rule is to install ourselves in all Makefile.am files: +############################################################################### + +git-all: git-mk-install + +git-mk-install: + @echo "Installing git makefile" + @any_failed=; \ + find "`test -z "$(top_srcdir)" && echo . || echo "$(top_srcdir)"`" -name Makefile.am | while read x; do \ + if grep 'include .*/git.mk' $$x >/dev/null; then \ + echo "$$x already includes git.mk"; \ + else \ + failed=; \ + echo "Updating $$x"; \ + { cat $$x; \ + echo ''; \ + echo '-include $$(top_srcdir)/git.mk'; \ + } > $$x.tmp || failed=1; \ + if test x$$failed = x; then \ + mv $$x.tmp $$x || failed=1; \ + fi; \ + if test x$$failed = x; then : else \ + echo "Failed updating $$x"; >&2 \ + any_failed=1; \ + fi; \ + fi; done; test -z "$$any_failed" + +git-mk-update: + wget $(GIT_MK_URL) -O $(top_srcdir)/git.mk + +.PHONY: git-all git-mk-install git-mk-update + + + +############################################################################### +# Actual .gitignore generation: +############################################################################### + +$(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk + @echo "git.mk: Generating $@" + @{ \ + if test "x$(DOC_MODULE)" = x -o "x$(DOC_MAIN_SGML_FILE)" = x; then :; else \ + for x in \ + $(DOC_MODULE)-decl-list.txt \ + $(DOC_MODULE)-decl.txt \ + tmpl/$(DOC_MODULE)-unused.sgml \ + "tmpl/*.bak" \ + xml html \ + ; do echo "/$$x"; done; \ + FLAVOR=$$(cd $(top_srcdir); $(AUTOCONF) --trace 'GTK_DOC_CHECK:$$2' ./configure.ac); \ + case $$FLAVOR in *no-tmpl*) echo /tmpl;; esac; \ + fi; \ + if test "x$(DOC_MODULE)$(DOC_ID)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \ + for lc in $(DOC_LINGUAS); do \ + for x in \ + $(if $(DOC_MODULE),$(DOC_MODULE).xml) \ + $(DOC_PAGES) \ + $(DOC_INCLUDES) \ + ; do echo "/$$lc/$$x"; done; \ + done; \ + for x in \ + $(_DOC_OMF_ALL) \ + $(_DOC_DSK_ALL) \ + $(_DOC_HTML_ALL) \ + $(_DOC_MOFILES) \ + $(DOC_H_FILE) \ + "*/.xml2po.mo" \ + "*/*.omf.out" \ + ; do echo /$$x; done; \ + fi; \ + if test "x$(HELP_ID)" = x -o "x$(HELP_LINGUAS)" = x; then :; else \ + for lc in $(HELP_LINGUAS); do \ + for x in \ + $(HELP_FILES) \ + "$$lc.stamp" \ + "$$lc.mo" \ + ; do echo "/$$lc/$$x"; done; \ + done; \ + fi; \ + if test "x$(gsettings_SCHEMAS)" = x; then :; else \ + for x in \ + $(gsettings_SCHEMAS:.xml=.valid) \ + $(gsettings__enum_file) \ + ; do echo "/$$x"; done; \ + fi; \ + if test "x$(appdata_XML)" = x; then :; else \ + for x in \ + $(appdata_XML:.xml=.valid) \ + ; do echo "/$$x"; done; \ + fi; \ + if test "x$(appstream_XML)" = x; then :; else \ + for x in \ + $(appstream_XML:.xml=.valid) \ + ; do echo "/$$x"; done; \ + fi; \ + if test -f $(srcdir)/po/Makefile.in.in; then \ + for x in \ + po/Makefile.in.in \ + po/Makefile.in.in~ \ + po/Makefile.in \ + po/Makefile \ + po/Makevars.template \ + po/POTFILES \ + po/Rules-quot \ + po/stamp-it \ + po/.intltool-merge-cache \ + "po/*.gmo" \ + "po/*.header" \ + "po/*.mo" \ + "po/*.sed" \ + "po/*.sin" \ + po/$(GETTEXT_PACKAGE).pot \ + intltool-extract.in \ + intltool-merge.in \ + intltool-update.in \ + ; do echo "/$$x"; done; \ + fi; \ + if test -f $(srcdir)/configure; then \ + for x in \ + autom4te.cache \ + configure \ + config.h \ + stamp-h1 \ + libtool \ + config.lt \ + ; do echo "/$$x"; done; \ + fi; \ + if test "x$(DEJATOOL)" = x; then :; else \ + for x in \ + $(DEJATOOL) \ + ; do echo "/$$x.sum"; echo "/$$x.log"; done; \ + echo /site.exp; \ + fi; \ + if test "x$(am__dirstamp)" = x; then :; else \ + echo "$(am__dirstamp)"; \ + fi; \ + if test "x$(LTCOMPILE)" = x -a "x$(LTCXXCOMPILE)" = x -a "x$(GTKDOC_RUN)" = x; then :; else \ + for x in \ + "*.lo" \ + ".libs" "_libs" \ + ; do echo "$$x"; done; \ + fi; \ + for x in \ + .gitignore \ + $(GITIGNOREFILES) \ + $(CLEANFILES) \ + $(PROGRAMS) $(check_PROGRAMS) $(EXTRA_PROGRAMS) \ + $(LIBRARIES) $(check_LIBRARIES) $(EXTRA_LIBRARIES) \ + $(LTLIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LTLIBRARIES) \ + so_locations \ + $(MOSTLYCLEANFILES) \ + $(TEST_LOGS) \ + $(TEST_LOGS:.log=.trs) \ + $(TEST_SUITE_LOG) \ + $(TESTS:=.test) \ + "*.gcda" \ + "*.gcno" \ + $(DISTCLEANFILES) \ + $(am__CONFIG_DISTCLEAN_FILES) \ + $(CONFIG_CLEAN_FILES) \ + TAGS ID GTAGS GRTAGS GSYMS GPATH tags \ + "*.tab.c" \ + $(MAINTAINERCLEANFILES) \ + $(BUILT_SOURCES) \ + $(patsubst %.vala,%.c,$(filter %.vala,$(SOURCES))) \ + $(filter %_vala.stamp,$(DIST_COMMON)) \ + $(filter %.vapi,$(DIST_COMMON)) \ + $(filter $(addprefix %,$(notdir $(patsubst %.vapi,%.h,$(filter %.vapi,$(DIST_COMMON))))),$(DIST_COMMON)) \ + Makefile \ + Makefile.in \ + "*.orig" \ + "*.rej" \ + "*.bak" \ + "*~" \ + ".*.sw[nop]" \ + ".dirstamp" \ + ; do echo "/$$x"; done; \ + for x in \ + "*.$(OBJEXT)" \ + $(DEPDIR) \ + ; do echo "$$x"; done; \ + } | \ + sed "s@^/`echo "$(srcdir)" | sed 's/\(.\)/[\1]/g'`/@/@" | \ + sed 's@/[.]/@/@g' | \ + LC_ALL=C sort | uniq > $@.tmp && \ + mv $@.tmp $@; + +all: $(srcdir)/.gitignore gitignore-recurse-maybe +gitignore: $(srcdir)/.gitignore gitignore-recurse + +gitignore-recurse-maybe: + @for subdir in $(DIST_SUBDIRS); do \ + case " $(SUBDIRS) " in \ + *" $$subdir "*) :;; \ + *) test "$$subdir" = . -o -e "$$subdir/.git" || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) gitignore || echo "Skipping $$subdir");; \ + esac; \ + done +gitignore-recurse: + @for subdir in $(DIST_SUBDIRS); do \ + test "$$subdir" = . -o -e "$$subdir/.git" || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) gitignore || echo "Skipping $$subdir"); \ + done + +maintainer-clean: gitignore-clean +gitignore-clean: + -rm -f $(srcdir)/.gitignore + +.PHONY: gitignore-clean gitignore gitignore-recurse gitignore-recurse-maybe diff --git a/SOURCES/vte291-pty-remove-unused-variable.patch b/SOURCES/vte291-pty-remove-unused-variable.patch new file mode 100644 index 0000000..0a381f5 --- /dev/null +++ b/SOURCES/vte291-pty-remove-unused-variable.patch @@ -0,0 +1,28 @@ +From 23cd7c699bb011c55ce12994b60673d676a71829 Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Tue, 23 May 2017 09:56:24 +0200 +Subject: [PATCH] pty: Removed unused variable + +Fallout from b59d76a5073d789f2f948cf928e883cb70cc8a75 + +https://bugzilla.gnome.org/show_bug.cgi?id=782977 +(cherry picked from commit 965ac9144b5989859230cd859e675fd5dfb29eac) +--- + src/pty.cc | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/pty.cc b/src/pty.cc +index a615e4168d2f..745735891516 100644 +--- a/src/pty.cc ++++ b/src/pty.cc +@@ -101,7 +101,6 @@ struct _VtePty { + struct _VtePtyPrivate { + VtePtyFlags flags; + int pty_fd; +- char *pty_name; + + VtePtyChildSetupData child_setup_data; + +-- +2.9.4 + diff --git a/SOURCES/vte291-restore-gnome-pty-helper.patch b/SOURCES/vte291-restore-gnome-pty-helper.patch new file mode 100644 index 0000000..5141a09 --- /dev/null +++ b/SOURCES/vte291-restore-gnome-pty-helper.patch @@ -0,0 +1,3243 @@ +From 5c3ac3bf7d681fe04516ad7d701693c4a0e7e48f Mon Sep 17 00:00:00 2001 +From: Debarshi Ray +Date: Tue, 25 Apr 2017 17:15:36 +0200 +Subject: [PATCH] Restore gnome-pty-helper + +https://bugzilla.redhat.com/show_bug.cgi?id=1443504 +--- + Makefile.am | 5 + + configure.ac | 32 +- + gnome-pty-helper/AUTHORS | 4 + + gnome-pty-helper/COPYING | 502 ++++++++++++++++++++++ + gnome-pty-helper/Makefile.am | 32 ++ + gnome-pty-helper/README | 9 + + gnome-pty-helper/acinclude.m4 | 244 +++++++++++ + gnome-pty-helper/configure.ac | 33 ++ + gnome-pty-helper/git.mk | 1 + + gnome-pty-helper/gnome-login-support.c | 380 +++++++++++++++++ + gnome-pty-helper/gnome-login-support.h | 39 ++ + gnome-pty-helper/gnome-pty-helper.c | 751 +++++++++++++++++++++++++++++++++ + gnome-pty-helper/gnome-pty.h | 22 + + gnome-pty-helper/gnome-utmp.c | 374 ++++++++++++++++ + src/pty.cc | 526 ++++++++++++++++++++++- + src/vte.cc | 2 + + src/vte/vteenums.h | 15 +- + 17 files changed, 2953 insertions(+), 18 deletions(-) + create mode 100644 gnome-pty-helper/AUTHORS + create mode 100644 gnome-pty-helper/COPYING + create mode 100644 gnome-pty-helper/Makefile.am + create mode 100644 gnome-pty-helper/README + create mode 100644 gnome-pty-helper/acinclude.m4 + create mode 100644 gnome-pty-helper/configure.ac + create mode 100644 gnome-pty-helper/git.mk + create mode 100644 gnome-pty-helper/gnome-login-support.c + create mode 100644 gnome-pty-helper/gnome-login-support.h + create mode 100644 gnome-pty-helper/gnome-pty-helper.c + create mode 100644 gnome-pty-helper/gnome-pty.h + create mode 100644 gnome-pty-helper/gnome-utmp.c + +diff --git a/Makefile.am b/Makefile.am +index 8a1649d331e3..3cc528dbc354 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -12,6 +12,10 @@ EXTRA_DIST = \ + + DISTCLEANFILES = + ++if BUILD_GNOME_PTY_HELPER ++SUBDIRS += gnome-pty-helper ++endif ++ + if ENABLE_GLADE_CATALOGUE + SUBDIRS += glade + endif +@@ -24,6 +28,7 @@ DISTCHECK_CONFIGURE_FLAGS = \ + --enable-introspection \ + --enable-vala \ + --enable-test-application \ ++ --enable-gnome-pty-helper \ + --disable-silent-rules \ + --with-gtk=3.0 + +diff --git a/configure.ac b/configure.ac +index b72e3563dc8b..45818a54321a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -242,9 +242,22 @@ VTE_DEFAULT_TERM=xterm-256color + AC_DEFINE_UNQUOTED(VTE_DEFAULT_TERM,"$VTE_DEFAULT_TERM",[The default value $TERM is set to.]) + + # Check for headers. +-AC_CHECK_HEADERS([sys/select.h sys/syslimits.h sys/termios.h sys/wait.h stropts.h termios.h util.h wchar.h pty.h]) ++AC_CHECK_HEADERS([sys/select.h sys/syslimits.h sys/termios.h sys/un.h sys/wait.h stropts.h termios.h util.h wchar.h pty.h]) + AC_HEADER_TIOCGWINSZ + ++AC_CHECK_FUNC(socket,[have_socket=1],AC_CHECK_LIB(socket,socket,[have_socket=1; LIBS="$LIBS -lsocket"])) ++AC_CHECK_FUNC(socketpair,[have_socketpair=1],AC_CHECK_LIB(socket,socketpair,[have_socketpair=1; LIBS="$LIBS -lsocket"])) ++AC_CHECK_FUNC(recvmsg,[have_recvmsg=1],AC_CHECK_LIB(socket,recvmsg,[have_recvmsg=1; LIBS="$LIBS -lsocket -lnsl"])) ++if test x$have_socket = x1 ; then ++ AC_DEFINE(HAVE_SOCKET,1,[Define if you have the socket function.]) ++fi ++if test x$have_socketpair = x1 ; then ++ AC_DEFINE(HAVE_SOCKETPAIR,1,[Define if you have the socketpair function.]) ++fi ++if test x$have_recvmsg = x1 ; then ++ AC_DEFINE(HAVE_RECVMSG,1,[Define if you have the recvmsg function.]) ++fi ++ + # Check for how to open a new PTY. We support posix_openpt and BSDs openpty + + AC_CHECK_FUNCS([posix_openpt grantpt unlockpt ptsname],[], +@@ -289,6 +302,22 @@ wcs_funcs_includes=" + AC_CHECK_TYPES(wint_t, AC_DEFINE(HAVE_WINT_T, , [Defined when the wint_t type is supported]), ,$wcs_funcs_includes) + + ################################################################################ ++# GNOME PTY Helper ++################################################################################ ++ ++AC_MSG_CHECKING([whether to build the PTY helper binary]) ++AC_ARG_ENABLE(gnome-pty-helper, ++ [AS_HELP_STRING([--disable-gnome-pty-helper], ++ [Build a setuid helper for opening ptys])], ++ [],[enable_gnome_pty_helper=no]) ++AC_MSG_RESULT([$enable_gnome_pty_helper]) ++if test "$enable_gnome_pty_helper" != no; then ++ AC_DEFINE(VTE_USE_GNOME_PTY_HELPER,1,[Define if you intend to use gnome-pty-helper.]) ++ AC_CONFIG_SUBDIRS(gnome-pty-helper) ++fi ++AM_CONDITIONAL(BUILD_GNOME_PTY_HELPER,[test "$enable_gnome_pty_helper" != no]) ++ ++################################################################################ + # Glade catalogue + ################################################################################ + +@@ -434,4 +463,5 @@ Configuration for libvte $VERSION for gtk+-$GTK_API_VERSION + Introspection: $enable_introspection + Vala bindings: $enable_vala + Test application: $enable_test_application ++ PTY helper: $enable_gnome_pty_helper + EOF +diff --git a/gnome-pty-helper/AUTHORS b/gnome-pty-helper/AUTHORS +new file mode 100644 +index 000000000000..99a686ffedff +--- /dev/null ++++ b/gnome-pty-helper/AUTHORS +@@ -0,0 +1,4 @@ ++Michael Zucchi ++Dugan Porter ++Miguel de Icaza ++Timur Bakeyev +diff --git a/gnome-pty-helper/COPYING b/gnome-pty-helper/COPYING +new file mode 100644 +index 000000000000..4362b49151d7 +--- /dev/null ++++ b/gnome-pty-helper/COPYING +@@ -0,0 +1,502 @@ ++ GNU LESSER GENERAL PUBLIC LICENSE ++ Version 2.1, February 1999 ++ ++ Copyright (C) 1991, 1999 Free Software Foundation, Inc. ++ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ Everyone is permitted to copy and distribute verbatim copies ++ of this license document, but changing it is not allowed. ++ ++[This is the first released version of the Lesser GPL. It also counts ++ as the successor of the GNU Library Public License, version 2, hence ++ the version number 2.1.] ++ ++ Preamble ++ ++ The licenses for most software are designed to take away your ++freedom to share and change it. By contrast, the GNU General Public ++Licenses are intended to guarantee your freedom to share and change ++free software--to make sure the software is free for all its users. ++ ++ This license, the Lesser General Public License, applies to some ++specially designated software packages--typically libraries--of the ++Free Software Foundation and other authors who decide to use it. You ++can use it too, but we suggest you first think carefully about whether ++this license or the ordinary General Public License is the better ++strategy to use in any particular case, based on the explanations below. ++ ++ When we speak of free software, we are referring to freedom of use, ++not price. Our General Public Licenses are designed to make sure that ++you have the freedom to distribute copies of free software (and charge ++for this service if you wish); that you receive source code or can get ++it if you want it; that you can change the software and use pieces of ++it in new free programs; and that you are informed that you can do ++these things. ++ ++ To protect your rights, we need to make restrictions that forbid ++distributors to deny you these rights or to ask you to surrender these ++rights. These restrictions translate to certain responsibilities for ++you if you distribute copies of the library or if you modify it. ++ ++ For example, if you distribute copies of the library, whether gratis ++or for a fee, you must give the recipients all the rights that we gave ++you. You must make sure that they, too, receive or can get the source ++code. If you link other code with the library, you must provide ++complete object files to the recipients, so that they can relink them ++with the library after making changes to the library and recompiling ++it. And you must show them these terms so they know their rights. ++ ++ We protect your rights with a two-step method: (1) we copyright the ++library, and (2) we offer you this license, which gives you legal ++permission to copy, distribute and/or modify the library. ++ ++ To protect each distributor, we want to make it very clear that ++there is no warranty for the free library. Also, if the library is ++modified by someone else and passed on, the recipients should know ++that what they have is not the original version, so that the original ++author's reputation will not be affected by problems that might be ++introduced by others. ++ ++ Finally, software patents pose a constant threat to the existence of ++any free program. We wish to make sure that a company cannot ++effectively restrict the users of a free program by obtaining a ++restrictive license from a patent holder. Therefore, we insist that ++any patent license obtained for a version of the library must be ++consistent with the full freedom of use specified in this license. ++ ++ Most GNU software, including some libraries, is covered by the ++ordinary GNU General Public License. This license, the GNU Lesser ++General Public License, applies to certain designated libraries, and ++is quite different from the ordinary General Public License. We use ++this license for certain libraries in order to permit linking those ++libraries into non-free programs. ++ ++ When a program is linked with a library, whether statically or using ++a shared library, the combination of the two is legally speaking a ++combined work, a derivative of the original library. The ordinary ++General Public License therefore permits such linking only if the ++entire combination fits its criteria of freedom. The Lesser General ++Public License permits more lax criteria for linking other code with ++the library. ++ ++ We call this license the "Lesser" General Public License because it ++does Less to protect the user's freedom than the ordinary General ++Public License. It also provides other free software developers Less ++of an advantage over competing non-free programs. These disadvantages ++are the reason we use the ordinary General Public License for many ++libraries. However, the Lesser license provides advantages in certain ++special circumstances. ++ ++ For example, on rare occasions, there may be a special need to ++encourage the widest possible use of a certain library, so that it becomes ++a de-facto standard. To achieve this, non-free programs must be ++allowed to use the library. A more frequent case is that a free ++library does the same job as widely used non-free libraries. In this ++case, there is little to gain by limiting the free library to free ++software only, so we use the Lesser General Public License. ++ ++ In other cases, permission to use a particular library in non-free ++programs enables a greater number of people to use a large body of ++free software. For example, permission to use the GNU C Library in ++non-free programs enables many more people to use the whole GNU ++operating system, as well as its variant, the GNU/Linux operating ++system. ++ ++ Although the Lesser General Public License is Less protective of the ++users' freedom, it does ensure that the user of a program that is ++linked with the Library has the freedom and the wherewithal to run ++that program using a modified version of the Library. ++ ++ The precise terms and conditions for copying, distribution and ++modification follow. Pay close attention to the difference between a ++"work based on the library" and a "work that uses the library". The ++former contains code derived from the library, whereas the latter must ++be combined with the library in order to run. ++ ++ GNU LESSER GENERAL PUBLIC LICENSE ++ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION ++ ++ 0. This License Agreement applies to any software library or other ++program which contains a notice placed by the copyright holder or ++other authorized party saying it may be distributed under the terms of ++this Lesser General Public License (also called "this License"). ++Each licensee is addressed as "you". ++ ++ A "library" means a collection of software functions and/or data ++prepared so as to be conveniently linked with application programs ++(which use some of those functions and data) to form executables. ++ ++ The "Library", below, refers to any such software library or work ++which has been distributed under these terms. A "work based on the ++Library" means either the Library or any derivative work under ++copyright law: that is to say, a work containing the Library or a ++portion of it, either verbatim or with modifications and/or translated ++straightforwardly into another language. (Hereinafter, translation is ++included without limitation in the term "modification".) ++ ++ "Source code" for a work means the preferred form of the work for ++making modifications to it. For a library, complete source code means ++all the source code for all modules it contains, plus any associated ++interface definition files, plus the scripts used to control compilation ++and installation of the library. ++ ++ Activities other than copying, distribution and modification are not ++covered by this License; they are outside its scope. The act of ++running a program using the Library is not restricted, and output from ++such a program is covered only if its contents constitute a work based ++on the Library (independent of the use of the Library in a tool for ++writing it). Whether that is true depends on what the Library does ++and what the program that uses the Library does. ++ ++ 1. You may copy and distribute verbatim copies of the Library's ++complete source code as you receive it, in any medium, provided that ++you conspicuously and appropriately publish on each copy an ++appropriate copyright notice and disclaimer of warranty; keep intact ++all the notices that refer to this License and to the absence of any ++warranty; and distribute a copy of this License along with the ++Library. ++ ++ You may charge a fee for the physical act of transferring a copy, ++and you may at your option offer warranty protection in exchange for a ++fee. ++ ++ 2. You may modify your copy or copies of the Library or any portion ++of it, thus forming a work based on the Library, and copy and ++distribute such modifications or work under the terms of Section 1 ++above, provided that you also meet all of these conditions: ++ ++ a) The modified work must itself be a software library. ++ ++ b) You must cause the files modified to carry prominent notices ++ stating that you changed the files and the date of any change. ++ ++ c) You must cause the whole of the work to be licensed at no ++ charge to all third parties under the terms of this License. ++ ++ d) If a facility in the modified Library refers to a function or a ++ table of data to be supplied by an application program that uses ++ the facility, other than as an argument passed when the facility ++ is invoked, then you must make a good faith effort to ensure that, ++ in the event an application does not supply such function or ++ table, the facility still operates, and performs whatever part of ++ its purpose remains meaningful. ++ ++ (For example, a function in a library to compute square roots has ++ a purpose that is entirely well-defined independent of the ++ application. Therefore, Subsection 2d requires that any ++ application-supplied function or table used by this function must ++ be optional: if the application does not supply it, the square ++ root function must still compute square roots.) ++ ++These requirements apply to the modified work as a whole. If ++identifiable sections of that work are not derived from the Library, ++and can be reasonably considered independent and separate works in ++themselves, then this License, and its terms, do not apply to those ++sections when you distribute them as separate works. But when you ++distribute the same sections as part of a whole which is a work based ++on the Library, the distribution of the whole must be on the terms of ++this License, whose permissions for other licensees extend to the ++entire whole, and thus to each and every part regardless of who wrote ++it. ++ ++Thus, it is not the intent of this section to claim rights or contest ++your rights to work written entirely by you; rather, the intent is to ++exercise the right to control the distribution of derivative or ++collective works based on the Library. ++ ++In addition, mere aggregation of another work not based on the Library ++with the Library (or with a work based on the Library) on a volume of ++a storage or distribution medium does not bring the other work under ++the scope of this License. ++ ++ 3. You may opt to apply the terms of the ordinary GNU General Public ++License instead of this License to a given copy of the Library. To do ++this, you must alter all the notices that refer to this License, so ++that they refer to the ordinary GNU General Public License, version 2, ++instead of to this License. (If a newer version than version 2 of the ++ordinary GNU General Public License has appeared, then you can specify ++that version instead if you wish.) Do not make any other change in ++these notices. ++ ++ Once this change is made in a given copy, it is irreversible for ++that copy, so the ordinary GNU General Public License applies to all ++subsequent copies and derivative works made from that copy. ++ ++ This option is useful when you wish to copy part of the code of ++the Library into a program that is not a library. ++ ++ 4. You may copy and distribute the Library (or a portion or ++derivative of it, under Section 2) in object code or executable form ++under the terms of Sections 1 and 2 above provided that you accompany ++it with the complete corresponding machine-readable source code, which ++must be distributed under the terms of Sections 1 and 2 above on a ++medium customarily used for software interchange. ++ ++ If distribution of object code is made by offering access to copy ++from a designated place, then offering equivalent access to copy the ++source code from the same place satisfies the requirement to ++distribute the source code, even though third parties are not ++compelled to copy the source along with the object code. ++ ++ 5. A program that contains no derivative of any portion of the ++Library, but is designed to work with the Library by being compiled or ++linked with it, is called a "work that uses the Library". Such a ++work, in isolation, is not a derivative work of the Library, and ++therefore falls outside the scope of this License. ++ ++ However, linking a "work that uses the Library" with the Library ++creates an executable that is a derivative of the Library (because it ++contains portions of the Library), rather than a "work that uses the ++library". The executable is therefore covered by this License. ++Section 6 states terms for distribution of such executables. ++ ++ When a "work that uses the Library" uses material from a header file ++that is part of the Library, the object code for the work may be a ++derivative work of the Library even though the source code is not. ++Whether this is true is especially significant if the work can be ++linked without the Library, or if the work is itself a library. The ++threshold for this to be true is not precisely defined by law. ++ ++ If such an object file uses only numerical parameters, data ++structure layouts and accessors, and small macros and small inline ++functions (ten lines or less in length), then the use of the object ++file is unrestricted, regardless of whether it is legally a derivative ++work. (Executables containing this object code plus portions of the ++Library will still fall under Section 6.) ++ ++ Otherwise, if the work is a derivative of the Library, you may ++distribute the object code for the work under the terms of Section 6. ++Any executables containing that work also fall under Section 6, ++whether or not they are linked directly with the Library itself. ++ ++ 6. As an exception to the Sections above, you may also combine or ++link a "work that uses the Library" with the Library to produce a ++work containing portions of the Library, and distribute that work ++under terms of your choice, provided that the terms permit ++modification of the work for the customer's own use and reverse ++engineering for debugging such modifications. ++ ++ You must give prominent notice with each copy of the work that the ++Library is used in it and that the Library and its use are covered by ++this License. You must supply a copy of this License. If the work ++during execution displays copyright notices, you must include the ++copyright notice for the Library among them, as well as a reference ++directing the user to the copy of this License. Also, you must do one ++of these things: ++ ++ a) Accompany the work with the complete corresponding ++ machine-readable source code for the Library including whatever ++ changes were used in the work (which must be distributed under ++ Sections 1 and 2 above); and, if the work is an executable linked ++ with the Library, with the complete machine-readable "work that ++ uses the Library", as object code and/or source code, so that the ++ user can modify the Library and then relink to produce a modified ++ executable containing the modified Library. (It is understood ++ that the user who changes the contents of definitions files in the ++ Library will not necessarily be able to recompile the application ++ to use the modified definitions.) ++ ++ b) Use a suitable shared library mechanism for linking with the ++ Library. A suitable mechanism is one that (1) uses at run time a ++ copy of the library already present on the user's computer system, ++ rather than copying library functions into the executable, and (2) ++ will operate properly with a modified version of the library, if ++ the user installs one, as long as the modified version is ++ interface-compatible with the version that the work was made with. ++ ++ c) Accompany the work with a written offer, valid for at ++ least three years, to give the same user the materials ++ specified in Subsection 6a, above, for a charge no more ++ than the cost of performing this distribution. ++ ++ d) If distribution of the work is made by offering access to copy ++ from a designated place, offer equivalent access to copy the above ++ specified materials from the same place. ++ ++ e) Verify that the user has already received a copy of these ++ materials or that you have already sent this user a copy. ++ ++ For an executable, the required form of the "work that uses the ++Library" must include any data and utility programs needed for ++reproducing the executable from it. However, as a special exception, ++the materials to be distributed need not include anything that is ++normally distributed (in either source or binary form) with the major ++components (compiler, kernel, and so on) of the operating system on ++which the executable runs, unless that component itself accompanies ++the executable. ++ ++ It may happen that this requirement contradicts the license ++restrictions of other proprietary libraries that do not normally ++accompany the operating system. Such a contradiction means you cannot ++use both them and the Library together in an executable that you ++distribute. ++ ++ 7. You may place library facilities that are a work based on the ++Library side-by-side in a single library together with other library ++facilities not covered by this License, and distribute such a combined ++library, provided that the separate distribution of the work based on ++the Library and of the other library facilities is otherwise ++permitted, and provided that you do these two things: ++ ++ a) Accompany the combined library with a copy of the same work ++ based on the Library, uncombined with any other library ++ facilities. This must be distributed under the terms of the ++ Sections above. ++ ++ b) Give prominent notice with the combined library of the fact ++ that part of it is a work based on the Library, and explaining ++ where to find the accompanying uncombined form of the same work. ++ ++ 8. You may not copy, modify, sublicense, link with, or distribute ++the Library except as expressly provided under this License. Any ++attempt otherwise to copy, modify, sublicense, link with, or ++distribute the Library is void, and will automatically terminate your ++rights under this License. However, parties who have received copies, ++or rights, from you under this License will not have their licenses ++terminated so long as such parties remain in full compliance. ++ ++ 9. You are not required to accept this License, since you have not ++signed it. However, nothing else grants you permission to modify or ++distribute the Library or its derivative works. These actions are ++prohibited by law if you do not accept this License. Therefore, by ++modifying or distributing the Library (or any work based on the ++Library), you indicate your acceptance of this License to do so, and ++all its terms and conditions for copying, distributing or modifying ++the Library or works based on it. ++ ++ 10. Each time you redistribute the Library (or any work based on the ++Library), the recipient automatically receives a license from the ++original licensor to copy, distribute, link with or modify the Library ++subject to these terms and conditions. You may not impose any further ++restrictions on the recipients' exercise of the rights granted herein. ++You are not responsible for enforcing compliance by third parties with ++this License. ++ ++ 11. If, as a consequence of a court judgment or allegation of patent ++infringement or for any other reason (not limited to patent issues), ++conditions are imposed on you (whether by court order, agreement or ++otherwise) that contradict the conditions of this License, they do not ++excuse you from the conditions of this License. If you cannot ++distribute so as to satisfy simultaneously your obligations under this ++License and any other pertinent obligations, then as a consequence you ++may not distribute the Library at all. For example, if a patent ++license would not permit royalty-free redistribution of the Library by ++all those who receive copies directly or indirectly through you, then ++the only way you could satisfy both it and this License would be to ++refrain entirely from distribution of the Library. ++ ++If any portion of this section is held invalid or unenforceable under any ++particular circumstance, the balance of the section is intended to apply, ++and the section as a whole is intended to apply in other circumstances. ++ ++It is not the purpose of this section to induce you to infringe any ++patents or other property right claims or to contest validity of any ++such claims; this section has the sole purpose of protecting the ++integrity of the free software distribution system which is ++implemented by public license practices. Many people have made ++generous contributions to the wide range of software distributed ++through that system in reliance on consistent application of that ++system; it is up to the author/donor to decide if he or she is willing ++to distribute software through any other system and a licensee cannot ++impose that choice. ++ ++This section is intended to make thoroughly clear what is believed to ++be a consequence of the rest of this License. ++ ++ 12. If the distribution and/or use of the Library is restricted in ++certain countries either by patents or by copyrighted interfaces, the ++original copyright holder who places the Library under this License may add ++an explicit geographical distribution limitation excluding those countries, ++so that distribution is permitted only in or among countries not thus ++excluded. In such case, this License incorporates the limitation as if ++written in the body of this License. ++ ++ 13. The Free Software Foundation may publish revised and/or new ++versions of the Lesser General Public License from time to time. ++Such new versions will be similar in spirit to the present version, ++but may differ in detail to address new problems or concerns. ++ ++Each version is given a distinguishing version number. If the Library ++specifies a version number of this License which applies to it and ++"any later version", you have the option of following the terms and ++conditions either of that version or of any later version published by ++the Free Software Foundation. If the Library does not specify a ++license version number, you may choose any version ever published by ++the Free Software Foundation. ++ ++ 14. If you wish to incorporate parts of the Library into other free ++programs whose distribution conditions are incompatible with these, ++write to the author to ask for permission. For software which is ++copyrighted by the Free Software Foundation, write to the Free ++Software Foundation; we sometimes make exceptions for this. Our ++decision will be guided by the two goals of preserving the free status ++of all derivatives of our free software and of promoting the sharing ++and reuse of software generally. ++ ++ NO WARRANTY ++ ++ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO ++WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. ++EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR ++OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY ++KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE ++IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR ++PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE ++LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME ++THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. ++ ++ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN ++WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY ++AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU ++FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR ++CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE ++LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING ++RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A ++FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF ++SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH ++DAMAGES. ++ ++ END OF TERMS AND CONDITIONS ++ ++ How to Apply These Terms to Your New Libraries ++ ++ If you develop a new library, and you want it to be of the greatest ++possible use to the public, we recommend making it free software that ++everyone can redistribute and change. You can do so by permitting ++redistribution under these terms (or, alternatively, under the terms of the ++ordinary General Public License). ++ ++ To apply these terms, attach the following notices to the library. It is ++safest to attach them to the start of each source file to most effectively ++convey the exclusion of warranty; and each file should have at least the ++"copyright" line and a pointer to where the full notice is found. ++ ++ ++ Copyright (C) ++ ++ This library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ This library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with this library; if not, write to the Free Software ++ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ ++Also add information on how to contact you by electronic and paper mail. ++ ++You should also get your employer (if you work as a programmer) or your ++school, if any, to sign a "copyright disclaimer" for the library, if ++necessary. Here is a sample; alter the names: ++ ++ Yoyodyne, Inc., hereby disclaims all copyright interest in the ++ library `Frob' (a library for tweaking knobs) written by James Random Hacker. ++ ++ , 1 April 1990 ++ Ty Coon, President of Vice ++ ++That's all there is to it! +diff --git a/gnome-pty-helper/Makefile.am b/gnome-pty-helper/Makefile.am +new file mode 100644 +index 000000000000..10a1c896e958 +--- /dev/null ++++ b/gnome-pty-helper/Makefile.am +@@ -0,0 +1,32 @@ ++libexec_PROGRAMS = gnome-pty-helper ++ ++gnome_pty_helper_SOURCES = \ ++ gnome-pty.h \ ++ gnome-login-support.c \ ++ gnome-login-support.h \ ++ gnome-pty-helper.c \ ++ gnome-utmp.c ++ ++gnome_pty_helper_CFLAGS = $(SUID_CFLAGS) $(AM_CFLAGS) ++gnome_pty_helper_LDFLAGS = $(SUID_LDFLAGS) $(AM_LDFLAGS) ++ ++install-exec-hook: ++ chown root.utmp $(DESTDIR)$(libexecdir)/gnome-pty-helper || true ++ chmod g+s $(DESTDIR)$(libexecdir)/gnome-pty-helper || true ++ ++MAINTAINERCLEANFILES = \ ++ $(srcdir)/INSTALL \ ++ $(srcdir)/aclocal.m4 \ ++ $(srcdir)/config.guess \ ++ $(srcdir)/config.h.in \ ++ $(srcdir)/config.sub \ ++ $(srcdir)/configure \ ++ $(srcdir)/depcomp \ ++ $(srcdir)/install-sh \ ++ $(srcdir)/mkinstalldirs \ ++ $(srcdir)/missing \ ++ $(srcdir)/omf.make \ ++ $(srcdir)/xmldocs.make \ ++ `find "$(srcdir)" -type f -name Makefile.in -print` ++ ++-include $(top_srcdir)/git.mk +diff --git a/gnome-pty-helper/README b/gnome-pty-helper/README +new file mode 100644 +index 000000000000..b760129a0dde +--- /dev/null ++++ b/gnome-pty-helper/README +@@ -0,0 +1,9 @@ ++This is some bits from libzvt CVS extracted to make a more-or-less standalone ++gnome-pty-helper kit. Presumably it is licensed under the LGPL, as libzvt ++itself is. ++ ++Note that for utmp/wtmp/lastlog logging to work properly, you *must* ensure ++that gnome-pty-helper is installed with the correct permissions. By default, ++gnome-pty-helper is installed setgid "utmp". If your system does not have a ++group named "utmp" (or if this group does not have write access to the ++corresponding log files), then it will probably need to be made setuid "root". +diff --git a/gnome-pty-helper/acinclude.m4 b/gnome-pty-helper/acinclude.m4 +new file mode 100644 +index 000000000000..6e8eadbc51f6 +--- /dev/null ++++ b/gnome-pty-helper/acinclude.m4 +@@ -0,0 +1,244 @@ ++# Checks for availability of various utmp fields ++# ++# Original code by Bernhard Rosenkraenzer (bero@linux.net.eu.org), 1998. ++# Modifications by Timur Bakeyev (timur@gnu.org), 1999. ++# Patched from http://bugzilla.gnome.org/show_bug.cgi?id=93774 ++# ++ ++dnl GPH_CHECK_UTMP() ++dnl Test for presence of the field and define HAVE_UT_UT_field macro ++dnl ++ ++AC_DEFUN([GPH_CHECK_UTMP],[ ++ ++AC_CHECK_HEADERS(sys/time.h utmp.h utmpx.h) ++AC_HEADER_TIME ++ ++if test "$ac_cv_header_utmpx_h" = "yes"; then ++ AC_DEFINE(UTMP,[struct utmpx],[Define to the name of a structure which holds utmp data.]) ++else ++ AC_DEFINE(UTMP,[struct utmp],[Define to the name of a structure which holds utmp data.]) ++fi ++ ++dnl some systems (BSD4.4-like) require time.h to be included before utmp.h :/ ++AC_MSG_CHECKING(for ut_host field in the utmp structure) ++AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME ++#include ++#include ++#else ++#ifdef HAVE_SYS_TIME_H ++#include ++#else ++#include ++#endif ++#endif ++#ifdef HAVE_UTMP_H ++#include ++#endif ++#ifdef HAVE_UTMPX_H ++#include ++#endif],[UTMP ut; char *p; p=ut.ut_host;],result=yes,result=no) ++if test "$result" = "yes"; then ++ AC_DEFINE(HAVE_UT_UT_HOST,1,[Define if your utmp struct contains a ut_host field.]) ++fi ++AC_MSG_RESULT($result) ++ ++AC_MSG_CHECKING(for ut_pid field in the utmp structure) ++AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME ++#include ++#include ++#else ++#ifdef HAVE_SYS_TIME_H ++#include ++#else ++#include ++#endif ++#endif ++#ifdef HAVE_UTMP_H ++#include ++#endif ++#ifdef HAVE_UTMPX_H ++#include ++#endif],[UTMP ut; int i; i=ut.ut_pid;],result=yes,result=no) ++if test "$result" = "yes"; then ++ AC_DEFINE(HAVE_UT_UT_PID,1,[Define if your utmp struct contains a ut_pid field.]) ++fi ++AC_MSG_RESULT($result) ++ ++AC_MSG_CHECKING(for ut_id field in the utmp structure) ++AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME ++#include ++#include ++#else ++#ifdef HAVE_SYS_TIME_H ++#include ++#else ++#include ++#endif ++#endif ++#ifdef HAVE_UTMP_H ++#include ++#endif ++#ifdef HAVE_UTMPX_H ++#include ++#endif],[UTMP ut; char *p; p=ut.ut_id;],result=yes,result=no) ++if test "$result" = "yes"; then ++ AC_DEFINE(HAVE_UT_UT_ID,1,[Define if your utmp struct contains a ut_id field.]) ++fi ++AC_MSG_RESULT($result) ++ ++AC_MSG_CHECKING(for ut_name field in the utmp structure) ++AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME ++#include ++#include ++#else ++#ifdef HAVE_SYS_TIME_H ++#include ++#else ++#include ++#endif ++#endif ++#ifdef HAVE_UTMP_H ++#include ++#endif ++#ifdef HAVE_UTMPX_H ++#include ++#endif],[UTMP ut; char *p; p=ut.ut_name;],result=yes,result=no) ++if test "$result" = "yes"; then ++ AC_DEFINE(HAVE_UT_UT_NAME,1,[Define if your utmp struct contains a ut_name field.]) ++fi ++AC_MSG_RESULT($result) ++ ++AC_MSG_CHECKING(for ut_type field in the utmp structure) ++AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME ++#include ++#include ++#else ++#ifdef HAVE_SYS_TIME_H ++#include ++#else ++#include ++#endif ++#endif ++#ifdef HAVE_UTMP_H ++#include ++#endif ++#ifdef HAVE_UTMPX_H ++#include ++#endif],[UTMP ut; int i; i=(int) ut.ut_type;],result=yes,result=no) ++if test "$result" = "yes"; then ++ AC_DEFINE(HAVE_UT_UT_TYPE,1,[Define if your utmp struct contains a ut_type field.]) ++fi ++AC_MSG_RESULT($result) ++ ++AC_MSG_CHECKING(for ut_exit.e_termination field in the utmp structure) ++AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME ++#include ++#include ++#else ++#ifdef HAVE_SYS_TIME_H ++#include ++#else ++#include ++#endif ++#endif ++#ifdef HAVE_UTMP_H ++#include ++#endif ++#ifdef HAVE_UTMPX_H ++#include ++#endif],[UTMP ut; ut.ut_exit.e_termination=0;],result=yes,result=no) ++if test "$result" = "yes"; then ++ AC_DEFINE(HAVE_UT_UT_EXIT_E_TERMINATION,1,[Define if your utmp struct contains a ut_exit.e_termination field.]) ++fi ++AC_MSG_RESULT($result) ++ ++AC_MSG_CHECKING(for ut_user field in the utmp structure) ++AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME ++#include ++#include ++#else ++#ifdef HAVE_SYS_TIME_H ++#include ++#else ++#include ++#endif ++#endif ++#ifdef HAVE_UTMP_H ++#include ++#endif ++#ifdef HAVE_UTMPX_H ++#include ++#endif],[UTMP ut; char *p; p=ut.ut_user;],result=yes,result=no) ++if test "$result" = "yes"; then ++ AC_DEFINE(HAVE_UT_UT_USER,1,[Define if your utmp struct contains a ut_user field.]) ++fi ++AC_MSG_RESULT($result) ++ ++AC_MSG_CHECKING(for ut_time field in the utmp structure) ++AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME ++#include ++#include ++#else ++#ifdef HAVE_SYS_TIME_H ++#include ++#else ++#include ++#endif ++#endif ++#ifdef HAVE_UTMP_H ++#include ++#endif ++#ifdef HAVE_UTMPX_H ++#include ++#endif],[UTMP ut; ut.ut_time=0;],result=yes,result=no) ++if test "$result" = "yes"; then ++ AC_DEFINE(HAVE_UT_UT_TIME,1,[Define if your utmp struct contains a ut_time field.]) ++fi ++AC_MSG_RESULT($result) ++ ++AC_MSG_CHECKING(for ut_tv field in the utmp structure) ++AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME ++#include ++#include ++#else ++#ifdef HAVE_SYS_TIME_H ++#include ++#else ++#include ++#endif ++#endif ++#ifdef HAVE_UTMP_H ++#include ++#endif ++#ifdef HAVE_UTMPX_H ++#include ++#endif],[UTMP ut; ut.ut_tv.tv_sec=0; ut.ut_tv.tv_usec=0; ],result=yes,result=no) ++if test "$result" = "yes"; then ++ AC_DEFINE(HAVE_UT_UT_TV,1,[Define if your utmp struct contains a ut_tv field.]) ++fi ++AC_MSG_RESULT($result) ++ ++AC_MSG_CHECKING(for ut_syslen field in the utmp structure) ++AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME ++#include ++#include ++#else ++#ifdef HAVE_SYS_TIME_H ++#include ++#else ++#include ++#endif ++#endif ++#ifdef HAVE_UTMP_H ++#include ++#endif ++#ifdef HAVE_UTMPX_H ++#include ++#endif],[UTMP ut; ut.ut_syslen=0;],result=yes,result=no) ++if test "$result" = "yes"; then ++ AC_DEFINE(HAVE_UT_UT_SYSLEN,1,[Define if your utmp struct contains a ut_syslen field.]) ++fi ++AC_MSG_RESULT($result) ++ ++]) +diff --git a/gnome-pty-helper/configure.ac b/gnome-pty-helper/configure.ac +new file mode 100644 +index 000000000000..c9f0aa460029 +--- /dev/null ++++ b/gnome-pty-helper/configure.ac +@@ -0,0 +1,33 @@ ++AC_INIT([gnome-pty-helper],[1.95.0],[http://bugzilla.gnome.org/enter_bug.cgi?product=vte]) ++ ++AM_INIT_AUTOMAKE([1.9 foreign no-dist-gzip dist-bzip2]) ++ ++AC_CONFIG_HEADERS([config.h]) ++AC_CONFIG_SRCDIR([gnome-pty.h]) ++ ++AC_PROG_CC ++AC_USE_SYSTEM_EXTENSIONS ++AC_ISC_POSIX ++AC_PROG_CC ++AC_STDC_HEADERS ++ ++AM_MAINTAINER_MODE([enable]) ++ ++AC_CHECK_HEADERS(sys/syslimits.h sys/time.h sys/types.h sys/un.h alloca.h lastlog.h libutil.h paths.h pty.h stropts.h termios.h ttyent.h util.h utmp.h utmpx.h pty.h util.h libutil.h ttyent.h) ++have_openpty=0 ++AC_CHECK_LIB(c,grantpt,true,[AC_CHECK_LIB(pt,grantpt)]) ++AC_CHECK_LIB(c,openpty,true,[AC_CHECK_LIB(util,openpty)]) ++AC_CHECK_LIB(c,sendmsg,true,[AC_CHECK_LIB(socket,sendmsg,LIBS="$LIBS -lsocket -lnsl",,-lnsl)]) ++AC_CHECK_FUNCS(endutent fcntl forkpty getttyent getutent getutmpx grantpt flock login_tty openpty revoke sendmsg seteuid setreuid setutent strrchr updwtmp updwtmpx utmpname utmpxname) ++GPH_CHECK_UTMP ++ ++AC_CHECK_HEADERS(stropts.h) ++ ++AC_ARG_VAR([SUID_CFLAGS], ++ [CFLAGS used for binaries which are usually with the suid bit]) ++AC_ARG_VAR([SUID_LDFLAGS], ++ [LDFLAGS used for binaries which are usually with the suid bit]) ++ ++AC_CONFIG_FILES([Makefile]) ++ ++AC_OUTPUT +diff --git a/gnome-pty-helper/git.mk b/gnome-pty-helper/git.mk +new file mode 100644 +index 000000000000..9e5123cf4490 +--- /dev/null ++++ b/gnome-pty-helper/git.mk +@@ -0,0 +1 @@ ++include $(top_srcdir)/../git.mk +diff --git a/gnome-pty-helper/gnome-login-support.c b/gnome-pty-helper/gnome-login-support.c +new file mode 100644 +index 000000000000..c1a3ac67f1f5 +--- /dev/null ++++ b/gnome-pty-helper/gnome-login-support.c +@@ -0,0 +1,380 @@ ++/* ++ * gnome-login-support.c: ++ * Replacement for systems that lack login_tty, open_pty and forkpty ++ * ++ * Author: ++ * Miguel de Icaza (miguel@gnu.org) ++ * ++ * ++ */ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "gnome-login-support.h" ++ ++/* ++ * HAVE_OPENPTY => HAVE_FORKPTY ++ */ ++ ++#ifndef HAVE_LOGIN_TTY ++int ++login_tty (int fd) ++{ ++ pid_t pid = getpid (); ++ ++ /* Create the session */ ++ setsid (); ++ ++#ifdef TIOCSCTTY ++ if (ioctl (fd, TIOCSCTTY, 0) == -1) ++ return -1; ++#else /* !TIOCSTTY */ ++ /* Hackery to set controlling tty on SVR4 - ++ on SVR4 the first terminal we open after sesid() ++ becomes our controlling terminal, thus we must ++ find the name of, open, and re-close the tty ++ since we already have it open at this point. */ ++ { ++ char *ctty; ++ int ct_fdes; ++ ++ ctty = ttyname(fd); ++ ct_fdes = open(ctty, O_RDWR); ++ close(ct_fdes); ++ } ++#endif /* !TIOCSTTY */ ++ ++#if defined (_POSIX_VERSION) || defined (__svr4__) ++ tcsetpgrp (0, pid); ++#elif defined (TIOCSPGRP) ++ ioctl (0, TIOCSPGRP, &pid); ++#endif ++ ++ dup2 (fd, 0); ++ dup2 (fd, 1); ++ dup2 (fd, 2); ++ if (fd > 2) ++ close (fd); ++ ++ return 0; ++} ++#endif ++ ++#ifndef HAVE_OPENPTY ++static int ++pty_open_master_bsd (char *pty_name, int *used_bsd) ++{ ++ int pty_master; ++ char *ptr1, *ptr2; ++ ++ *used_bsd = 1; ++ ++ strcpy (pty_name, "/dev/ptyXX"); ++ for (ptr1 = "pqrstuvwxyzPQRST"; *ptr1; ++ptr1) ++ { ++ pty_name [8] = *ptr1; ++ for (ptr2 = "0123456789abcdef"; *ptr2; ++ptr2) ++ { ++ pty_name [9] = *ptr2; ++ ++ /* Try to open master */ ++ if ((pty_master = open (pty_name, O_RDWR)) == -1) { ++ if (errno == ENOENT) /* Different from EIO */ ++ return -1; /* Out of pty devices */ ++ else ++ continue; /* Try next pty device */ ++ } ++ pty_name [5] = 't'; /* Change "pty" to "tty" */ ++ if (access (pty_name, (R_OK | W_OK))){ ++ close (pty_master); ++ pty_name [5] = 'p'; ++ continue; ++ } ++ return pty_master; ++ } ++ } ++ return -1; /* Ran out of pty devices */ ++} ++ ++static int ++pty_open_slave_bsd (const char *pty_name) ++{ ++ int pty_slave; ++ struct group *group_info = getgrnam ("tty"); ++ ++ if (group_info != NULL) ++ { ++ /* The following two calls will only succeed if we are root */ ++ ++ chown (pty_name, getuid (), group_info->gr_gid); ++ chmod (pty_name, S_IRUSR | S_IWUSR | S_IWGRP); ++ } ++ else ++ { ++ chown (pty_name, getuid (), -1); ++ chmod (pty_name, S_IRUSR | S_IWUSR | S_IWGRP); ++ } ++ ++#ifdef HAVE_REVOKE ++ revoke (pty_name); ++#endif ++ ++ if ((pty_slave = open (pty_name, O_RDWR)) == -1){ ++ return -1; ++ } ++ ++ return pty_slave; ++} ++ ++/* SystemVish pty opening */ ++#if defined (HAVE_GRANTPT) ++ ++#ifdef HAVE_STROPTS_H ++# include ++#endif ++ ++static int ++pty_open_slave (const char *pty_name) ++{ ++ int pty_slave = open (pty_name, O_RDWR); ++ ++ if (pty_slave == -1) ++ return -1; ++ ++#ifdef HAVE_STROPTS_H ++#if !defined(__osf__) ++ if (!ioctl (pty_slave, I_FIND, "ptem")) ++ if (ioctl (pty_slave, I_PUSH, "ptem") == -1){ ++ close (pty_slave); ++ return -1; ++ } ++ ++ if (!ioctl (pty_slave, I_FIND, "ldterm")) ++ if (ioctl (pty_slave, I_PUSH, "ldterm") == -1){ ++ close (pty_slave); ++ return -1; ++ } ++ ++#if !defined(sgi) && !defined(__sgi) ++ if (!ioctl (pty_slave, I_FIND, "ttcompat")) ++ if (ioctl (pty_slave, I_PUSH, "ttcompat") == -1) ++ { ++ perror ("ioctl (pty_slave, I_PUSH, \"ttcompat\")"); ++ close (pty_slave); ++ return -1; ++ } ++#endif /* sgi || __sgi */ ++#endif /* __osf__ */ ++#endif /* HAVE_STROPTS_H */ ++ ++ return pty_slave; ++} ++ ++static int ++pty_open_master (char *pty_name, int *used_bsd) ++{ ++ int pty_master; ++ char *slave_name; ++ ++ strcpy (pty_name, "/dev/ptmx"); ++ ++ pty_master = open (pty_name, O_RDWR); ++ ++ if ((pty_master == -1) && (errno == ENOENT)) { ++ strcpy (pty_name, "/dev/ptc"); /* AIX */ ++ pty_master = open (pty_name, O_RDWR); ++ } ++ ++ /* ++ * Try BSD open, this is needed for Linux which ++ * might have Unix98 devices but no kernel support ++ * for those. ++ */ ++ if (pty_master == -1) { ++ *used_bsd = 1; ++ return pty_open_master_bsd (pty_name, used_bsd); ++ } ++ *used_bsd = 0; ++ ++ if (grantpt (pty_master) == -1 || unlockpt (pty_master) == -1) { ++ close (pty_master); ++ return -1; ++ } ++ if ((slave_name = ptsname (pty_master)) == NULL){ ++ close (pty_master); ++ return -1; ++ } ++ strcpy (pty_name, slave_name); ++ return pty_master; ++} ++#else ++# define pty_open_master pty_open_master_bsd ++# define pty_open_slave pty_open_slave_bsd ++#endif ++ ++int ++openpty (int *master_fd, int *slave_fd, char *name, ++ struct termios *termp, struct winsize *winp) ++{ ++ int pty_master, pty_slave, used_bsd = 0; ++ struct group *group_info; ++ char line [256]; ++ ++ pty_master = pty_open_master (line, &used_bsd); ++ fcntl (pty_master, F_SETFD, FD_CLOEXEC); ++ ++ if (pty_master == -1) ++ return -1; ++ ++ group_info = getgrnam ("tty"); ++ ++ if (group_info != NULL){ ++ chown (line, getuid (), group_info->gr_gid); ++ chmod (line, S_IRUSR | S_IWUSR | S_IWGRP); ++ } else { ++ chown (line, getuid (), -1); ++ chmod (line, S_IRUSR | S_IWUSR | S_IWGRP); ++ } ++ ++#ifdef HAVE_REVOKE ++ revoke (line); ++#endif ++ ++ /* Open slave side */ ++ if (used_bsd) ++ pty_slave = pty_open_slave_bsd (line); ++ else ++ pty_slave = pty_open_slave (line); ++ ++ if (pty_slave == -1){ ++ close (pty_master); ++ ++ errno = ENOENT; ++ return -1; ++ } ++ fcntl (pty_slave, F_SETFD, FD_CLOEXEC); ++ ++ *master_fd = pty_master; ++ *slave_fd = pty_slave; ++ ++ if (termp) ++ tcsetattr (pty_slave, TCSAFLUSH, termp); ++ ++ if (winp) ++ ioctl (pty_slave, TIOCSWINSZ, winp); ++ ++ if (name) ++ strcpy (name, line); ++ ++ return 0; ++} ++ ++pid_t ++forkpty (int *master_fd, char *name, struct termios *termp, struct winsize *winp) ++{ ++ int master, slave; ++ pid_t pid; ++ ++ if (openpty (&master, &slave, name, termp, winp) == -1) ++ return -1; ++ ++ pid = fork (); ++ ++ if (pid == -1) ++ return -1; ++ ++ /* Child */ ++ if (pid == 0){ ++ close (master); ++ login_tty (slave); ++ } else { ++ *master_fd = master; ++ close (slave); ++ } ++ ++ return pid; ++} ++#endif /* HAVE_OPENPTY */ ++ ++int ++n_read (int fd, void *buf, int count) ++{ ++ int n = 0, i; ++ char *buffer; ++ ++ buffer = (char*) buf; ++ while (n < count) { ++ i = read (fd, buffer + n, count - n); ++ switch (i) { ++ case -1: ++ switch (errno) { ++ case EINTR: ++ case EAGAIN: ++#ifdef ERESTART ++ case ERESTART: ++#endif ++ /* suppress these errors */ ++ break; ++ default: ++ return -1; ++ break; ++ } ++ break; ++ case 0: ++ return n; ++ break; ++ default: ++ n += i; ++ break; ++ } ++ } ++ ++ return n; ++} ++ ++int ++n_write (int fd, const void *buf, int count) ++{ ++ int n = 0, i; ++ const char *buffer; ++ ++ buffer = (char*) buf; ++ while (n < count) { ++ i = write (fd, buffer + n, count - n); ++ switch (i) { ++ case -1: ++ switch (errno) { ++ case EINTR: ++ case EAGAIN: ++#ifdef ERESTART ++ case ERESTART: ++#endif ++ /* suppress these errors */ ++ break; ++ default: ++ return -1; ++ break; ++ } ++ break; ++ case 0: ++ return n; ++ break; ++ default: ++ n += i; ++ break; ++ } ++ } ++ ++ return n; ++} +diff --git a/gnome-pty-helper/gnome-login-support.h b/gnome-pty-helper/gnome-login-support.h +new file mode 100644 +index 000000000000..cc80a46ff3b1 +--- /dev/null ++++ b/gnome-pty-helper/gnome-login-support.h +@@ -0,0 +1,39 @@ ++#ifndef _GNOME_LOGIN_SUPPORT_H ++#define _GNOME_LOGIN_SUPPORT_H ++ ++#ifdef HAVE_OPENPTY ++#if defined(HAVE_PTY_H) ++# include ++#elif defined(HAVE_UTIL_H) /* OpenBSD */ ++# include ++#elif defined(HAVE_LIBUTIL_H) /* FreeBSD */ ++# include ++#elif defined(HAVE_LIBUTIL) /* BSDI has libutil, but no libutil.h */ ++/* Avoid pulling in all the include files for no need */ ++struct termios; ++struct winsize; ++struct utmp; ++ ++void login (struct utmp *ut); ++int login_tty (int fd); ++int logout (char *line); ++void logwtmp (const char *line, const char *name, const char *host); ++int openpty (int *amaster, int *aslave, char *name, struct termios *termp, struct winsize *winp); ++int forkpty (int *amaster, char *name, struct termios *termp, struct winsize *winp); ++#endif ++#else ++int openpty (int *master_fd, int *slavefd, char *name, struct termios *termp, struct winsize *winp); ++pid_t forkpty (int *master_fd, char *name, struct termios *termp, struct winsize *winp); ++#endif ++ ++#ifndef HAVE_LOGIN_TTY ++int login_tty (int fd); ++#elif defined(HAVE_UTMP_H) ++/* Get the prototype from utmp.h */ ++#include ++#endif ++ ++int n_read (int fd, void *buffer, int size); ++int n_write (int fd, const void *buffer, int size); ++ ++#endif /* _GNOME_LOGIN_SUPPORT_H */ +diff --git a/gnome-pty-helper/gnome-pty-helper.c b/gnome-pty-helper/gnome-pty-helper.c +new file mode 100644 +index 000000000000..2666bf4cd46d +--- /dev/null ++++ b/gnome-pty-helper/gnome-pty-helper.c +@@ -0,0 +1,751 @@ ++/* ++ * gnome-pty.c: Helper setuid application used to open a pseudo- ++ * terminal, set the permissions, ownership and record user login ++ * information ++ * ++ * Author: ++ * Miguel de Icaza (miguel@gnu.org) ++ * ++ * Parent application talks to us via a couple of sockets that are strategically ++ * placed on file descriptors 0 and 1 (STDIN_FILENO and STDOUT_FILENO). ++ * ++ * We use the STDIN_FILENO to read and write the protocol information and we use ++ * the STDOUT_FILENO to pass the file descriptors (we need two different file ++ * descriptors as using a socket for both data transfers and file descriptor ++ * passing crashes some BSD kernels according to Theo de Raadt) ++ * ++ * A sample protocol is used: ++ * ++ * OPEN_PTY => 1 ++ * => 0 ++ * ++ * CLOSE_PTY => void ++ * ++ * is a pointer. If tag is NULL, then the ptys were not allocated. ++ * ptys are passed using file descriptor passing on the stdin file descriptor ++ * ++ * We use as little as possible external libraries. ++ */ ++#include ++ ++/* Use this to pull SCM_RIGHTS definition on IRIX */ ++#if defined(irix) || defined (__irix__) || defined(sgi) || defined (__sgi__) ++# define _XOPEN_SOURCE 1 ++extern char *strdup(const char *); ++#endif ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "gnome-pty.h" ++#include "gnome-login-support.h" ++ ++/* For PATH_MAX on BSD-like systems. */ ++#ifdef HAVE_SYS_SYSLIMITS_H ++#include ++#endif ++ ++static struct passwd *pwent; ++static char login_name_buffer [48]; ++static char *login_name, *display_name; ++ ++struct pty_info { ++ char *login_name; ++ struct pty_info *next; ++ char *line; ++ void *data; ++ char utmp, wtmp, lastlog; ++}; ++ ++typedef struct pty_info pty_info; ++ ++static pty_info *pty_list; ++ ++#ifdef HAVE_SENDMSG ++#include ++#include ++ ++#ifdef HAVE_SYS_UN_H /* Linux libc5 */ ++#include ++#endif ++ ++#ifndef CMSG_DATA /* Linux libc5 */ ++/* Ancillary data object manipulation macros. */ ++#if !defined __STRICT_ANSI__ && defined __GNUC__ && __GNUC__ >= 2 ++# define CMSG_DATA(cmsg) ((cmsg)->cmsg_data) ++#else ++# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1)) ++#endif ++#endif /* CMSG_DATA */ ++ ++/* Solaris doesn't define these */ ++#ifndef CMSG_ALIGN ++#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) & (size_t) ~(sizeof (size_t) - 1)) ++#endif ++#ifndef CMSG_SPACE ++#define CMSG_SPACE(len) (CMSG_ALIGN (len) + CMSG_ALIGN (sizeof (struct cmsghdr))) ++#endif ++#ifndef CMSG_LEN ++#define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len)) ++#endif ++ ++static int ++pass_fd (int client_fd, int fd) ++{ ++ struct iovec iov[1]; ++ struct msghdr msg; ++ char buf [1]; ++ char cmsgbuf[CMSG_SPACE(sizeof(int))]; ++ struct cmsghdr *cmptr; ++ int *fdptr; ++ ++ iov [0].iov_base = buf; ++ iov [0].iov_len = 1; ++ ++ msg.msg_iov = iov; ++ msg.msg_iovlen = 1; ++ msg.msg_name = NULL; ++ msg.msg_namelen = 0; ++ msg.msg_control = (caddr_t) cmsgbuf; ++ msg.msg_controllen = sizeof(cmsgbuf); ++ ++ cmptr = CMSG_FIRSTHDR(&msg); ++ cmptr->cmsg_level = SOL_SOCKET; ++ cmptr->cmsg_type = SCM_RIGHTS; ++ cmptr->cmsg_len = CMSG_LEN(sizeof(int)); ++ fdptr = (int *) CMSG_DATA(cmptr); ++ memcpy (fdptr, &fd, sizeof(int)); ++ if (sendmsg (client_fd, &msg, 0) != 1) ++ return -1; ++ ++ return 0; ++} ++ ++#elif defined(__sgi) && !defined(HAVE_SENDMSG) ++ ++/* ++ * IRIX 6.2 is like 4.3BSD; it will not have HAVE_SENDMSG set, ++ * because msghdr used msg_accrights and msg_accrightslen rather ++ * than the newer msg_control and msg_controllen fields configure ++ * checks. The SVR4 code below doesn't work because pipe() ++ * semantics are controlled by the svr3pipe systune variable, ++ * which defaults to uni-directional pipes. Also sending ++ * file descriptors through pipes isn't implemented. ++ */ ++ ++#include ++#include ++ ++static int ++pass_fd (int client_fd, int fd) ++{ ++ struct iovec iov[1]; ++ struct msghdr msg; ++ char buf [1]; ++ ++ iov [0].iov_base = buf; ++ iov [0].iov_len = 1; ++ ++ msg.msg_iov = iov; ++ msg.msg_iovlen = 1; ++ msg.msg_name = NULL; ++ msg.msg_namelen = 0; ++ msg.msg_accrights = (caddr_t) &fd; ++ msg.msg_accrightslen = sizeof(fd); ++ ++ if (sendmsg (client_fd, &msg, 0) != 1) ++ return -1; ++ ++ return 0; ++} ++ ++#else ++#include ++#ifdef I_SENDFD ++ ++int ++pass_fd (int client_fd, int fd) ++{ ++ if (ioctl (client_fd, I_SENDFD, fd) < 0) ++ return -1; ++ return 0; ++} ++#endif ++#endif ++ ++static void ++pty_free (pty_info *pi) ++{ ++ free (pi); ++} ++ ++static void ++pty_remove (pty_info *pi) ++{ ++ pty_info *l, *last; ++ ++ last = (void *) 0; ++ ++ for (l = pty_list; l; l = l->next) { ++ if (l == pi) { ++ if (last == (void *) 0) ++ pty_list = pi->next; ++ else ++ last->next = pi->next; ++ free (pi->line); ++ free (pi->login_name); ++ pty_free (pi); ++ return; ++ } ++ last = l; ++ } ++ ++ exit (1); ++} ++ ++static void ++shutdown_pty (pty_info *pi) ++{ ++ if (pi->utmp || pi->wtmp || pi->lastlog) ++ if (pi->data) ++ write_logout_record (pi->login_name, pi->data, pi->utmp, pi->wtmp); ++ ++ pty_remove (pi); ++} ++ ++static void ++shutdown_helper (void) ++{ ++ pty_info *pi; ++ ++ for (pi = pty_list; pi; pi = pty_list) ++ shutdown_pty (pi); ++} ++ ++static pty_info * ++pty_add (int utmp, int wtmp, int lastlog, char *line, char *login_name) ++{ ++ pty_info *pi = malloc (sizeof (pty_info)); ++ ++ if (pi == NULL) { ++ shutdown_helper (); ++ exit (1); ++ } ++ ++ memset (pi, 0, sizeof (pty_info)); ++ ++ if (strncmp (line, "/dev/", 5)) ++ pi->line = strdup (line); ++ else ++ pi->line = strdup (line+5); ++ ++ if (pi->line == NULL) { ++ shutdown_helper (); ++ exit (1); ++ } ++ ++ pi->next = pty_list; ++ pi->utmp = utmp; ++ pi->wtmp = wtmp; ++ pi->lastlog = lastlog; ++ pi->login_name = strdup (login_name); ++ ++ pty_list = pi; ++ ++ return pi; ++} ++ ++static struct termios* ++init_term_with_defaults(struct termios* term) ++{ ++ /* ++ * openpty assumes POSIX termios so this should be portable. ++ * Don't change this to a structure init - POSIX doesn't say ++ * anything about field order. ++ */ ++ memset(term, 0, sizeof(struct termios)); ++ ++ term->c_iflag = 0 ++#ifdef BRKINT ++ | BRKINT ++#endif ++#ifdef ICRNL ++ | ICRNL ++#endif ++#ifdef IMAXBEL ++ | IMAXBEL ++#endif ++#ifdef IXON ++ | IXON ++#endif ++#ifdef IXANY ++ | IXANY ++#endif ++ ; ++ term->c_oflag = 0 ++#ifdef OPOST ++ | OPOST ++#endif ++#ifdef ONLCR ++ | ONLCR ++#endif ++#ifdef NL0 ++ | NL0 ++#endif ++#ifdef CR0 ++ | CR0 ++#endif ++#ifdef TAB0 ++ | TAB0 ++#endif ++#ifdef BS0 ++ | BS0 ++#endif ++#ifdef VT0 ++ | VT0 ++#endif ++#ifdef FF0 ++ | FF0 ++#endif ++ ; ++ term->c_cflag = 0 ++#ifdef CREAD ++ | CREAD ++#endif ++#ifdef CS8 ++ | CS8 ++#endif ++#ifdef HUPCL ++ | HUPCL ++#endif ++ ; ++#ifdef EXTB ++ cfsetispeed(term, EXTB); ++ cfsetospeed(term, EXTB); ++#else ++# ifdef B38400 ++ cfsetispeed(term, B38400); ++ cfsetospeed(term, B38400); ++# else ++# ifdef B9600 ++ cfsetispeed(term, B9600); ++ cfsetospeed(term, B9600); ++# endif ++# endif ++#endif /* EXTB */ ++ ++ term->c_lflag = 0 ++#ifdef ECHO ++ | ECHO ++#endif ++#ifdef ICANON ++ | ICANON ++#endif ++#ifdef ISIG ++ | ISIG ++#endif ++#ifdef IEXTEN ++ | IEXTEN ++#endif ++#ifdef ECHOE ++ | ECHOE ++#endif ++#ifdef ECHOKE ++ | ECHOKE ++#endif ++#ifdef ECHOK ++ | ECHOK ++#endif ++#ifdef ECHOCTL ++ | ECHOCTL ++#endif ++ ; ++ ++#ifdef N_TTY ++ /* should really be a check for c_line, but maybe this is good enough */ ++ term->c_line = N_TTY; ++#endif ++ ++ /* These two may overlap so set them first */ ++ /* That setup means, that read() will be blocked until */ ++ /* at least 1 symbol will be read. */ ++ term->c_cc[VMIN] = 1; ++ term->c_cc[VTIME] = 0; ++ ++ /* ++ * Now set the characters. This is of course a religious matter ++ * but we use the defaults, with erase bound to the key gnome-terminal ++ * maps. ++ * ++ * These are the ones set by "stty sane". ++ */ ++ ++ term->c_cc[VINTR] = 'C'-64; ++ term->c_cc[VQUIT] = '\\'-64; ++ term->c_cc[VERASE] = 127; ++ term->c_cc[VKILL] = 'U'-64; ++ term->c_cc[VEOF] = 'D'-64; ++#ifdef VSWTC ++ term->c_cc[VSWTC] = 255; ++#endif ++ term->c_cc[VSTART] = 'Q'-64; ++ term->c_cc[VSTOP] = 'S'-64; ++ term->c_cc[VSUSP] = 'Z'-64; ++ term->c_cc[VEOL] = 255; ++ ++ /* ++ * Extended stuff. ++ */ ++ ++#ifdef VREPRINT ++ term->c_cc[VREPRINT] = 'R'-64; ++#endif ++#ifdef VSTATUS ++ term->c_cc[VSTATUS] = 'T'-64; ++#endif ++#ifdef VDISCARD ++ term->c_cc[VDISCARD] = 'O'-64; ++#endif ++#ifdef VWERASE ++ term->c_cc[VWERASE] = 'W'-64; ++#endif ++#ifdef VLNEXT ++ term->c_cc[VLNEXT] = 'V'-64; ++#endif ++#ifdef VDSUSP ++ term->c_cc[VDSUSP] = 'Y'-64; ++#endif ++#ifdef VEOL2 ++ term->c_cc[VEOL2] = 255; ++#endif ++ return term; ++} ++ ++static int ++open_ptys (int utmp, int wtmp, int lastlog) ++{ ++ const char *term_name; ++ int status, master_pty, slave_pty; ++ pty_info *p; ++ int result; ++ uid_t savedUid; ++ gid_t savedGid; ++ struct group *group_info; ++ struct termios term; ++ ++ /* Initialize term */ ++ init_term_with_defaults(&term); ++ ++ /* root privileges */ ++ savedUid = geteuid(); ++ savedGid = getegid(); ++ ++ /* drop privileges to the user level */ ++#if defined(HAVE_SETEUID) ++ seteuid (pwent->pw_uid); ++ setegid (pwent->pw_gid); ++#elif defined(HAVE_SETREUID) ++ setreuid (savedUid, pwent->pw_uid); ++ setregid (savedGid, pwent->pw_gid); ++#else ++#error "No means to drop privileges! Huge security risk! Won't compile." ++#endif ++ /* Open pty with privileges of the user */ ++ status = openpty (&master_pty, &slave_pty, NULL, &term, NULL); ++ ++ /* Restore saved privileges to root */ ++#ifdef HAVE_SETEUID ++ seteuid (savedUid); ++ setegid (savedGid); ++#elif defined(HAVE_SETREUID) ++ setreuid (pwent->pw_uid, savedUid); ++ setregid (pwent->pw_gid, savedGid); ++#else ++#error "No means to raise privileges! Huge security risk! Won't compile." ++#endif ++ /* openpty() failed, reject request */ ++ if (status == -1 || (term_name = ttyname(slave_pty)) == NULL) { ++ result = 0; ++ n_write (STDIN_FILENO, &result, sizeof (result)); ++ return 0; ++ } ++ ++ /* a bit tricky, we re-do the part of the openpty() */ ++ /* that required root privileges, and, hence, failed */ ++ group_info = getgrnam ("tty"); ++ fchown (slave_pty, getuid (), group_info ? group_info->gr_gid : -1); ++ fchmod (slave_pty, S_IRUSR | S_IWUSR | S_IWGRP); ++ /* It's too late to call revoke at this time... */ ++ /* revoke(term_name); */ ++ ++ /* add pty to the list of allocated by us */ ++ p = pty_add (utmp, wtmp, lastlog, term_name, login_name); ++ result = 1; ++ ++ if (n_write (STDIN_FILENO, &result, sizeof (result)) != sizeof (result) || ++ n_write (STDIN_FILENO, &p, sizeof (p)) != sizeof (p) || ++ pass_fd (STDOUT_FILENO, master_pty) == -1 || ++ pass_fd (STDOUT_FILENO, slave_pty) == -1) { ++ exit (0); ++ } ++ ++ if (utmp || wtmp || lastlog) { ++ p->data = write_login_record (login_name, display_name, ++ term_name, utmp, wtmp, lastlog); ++ } ++ ++ close (master_pty); ++ close (slave_pty); ++ ++ return 1; ++} ++ ++static void ++close_pty_pair (void *tag) ++{ ++ pty_info *pi; ++ ++ for (pi = pty_list; pi; pi = pi->next) { ++ if (tag == pi) { ++ shutdown_pty (pi); ++ break; ++ } ++ } ++} ++ ++#define MB (1024*1024) ++ ++struct { ++ int limit; ++ int value; ++} sensible_limits [] = { ++ { RLIMIT_CPU, 120 }, ++ { RLIMIT_FSIZE, 1 * MB }, ++ { RLIMIT_DATA, 1 * MB }, ++ { RLIMIT_STACK, 1 * MB }, ++#ifdef RLIMIT_AS ++ { RLIMIT_AS, 1 * MB }, ++#endif ++ { RLIMIT_NOFILE, 10 }, ++#ifdef RLIMIT_NPROC ++ { RLIMIT_NPROC, 5 }, ++#endif ++ { -1, -1 } ++}; ++ ++static void ++sanity_checks (void) ++{ ++ int stderr_fd; ++ int i, open_max; ++ int flag; ++ ++ /* ++ * Make sure stdin/stdout are open. This is a requirement ++ * for our program to work and closes potential security holes. ++ */ ++ if ((fcntl (0, F_GETFL, &flag) == -1 && errno == EBADF) || ++ (fcntl (1, F_GETFL, &flag) == -1 && errno == EBADF)) { ++ exit (1); ++ } ++ ++ /* ++ * File descriptors 0 and 1 have been setup by the parent process ++ * to be used for the protocol exchange and for transfering ++ * file descriptors. ++ * ++ * Make stderr point to a terminal. ++ */ ++ if (fcntl (2, F_GETFL, &flag) == -1 && errno == EBADF) { ++ stderr_fd = open ("/dev/tty", O_RDWR); ++ if (stderr_fd == -1) { ++ stderr_fd = open ("/dev/null", O_RDWR); ++ if (stderr_fd == -1) ++ exit (1); ++ } ++ ++ if (stderr_fd != 2) ++ while (dup2 (stderr_fd, 2) == -1 && errno == EINTR) ++ ; ++ } ++ ++ /* Close any file descriptor we do not use */ ++ open_max = sysconf (_SC_OPEN_MAX); ++ for (i = 3; i < open_max; i++) { ++ close (i); ++ } ++ ++ /* Check sensible resource limits */ ++ for (i = 0; sensible_limits [i].value != -1; i++) { ++ struct rlimit rlim; ++ ++ if (getrlimit (sensible_limits [i].limit, &rlim) != 0) ++ continue; ++ ++ if (rlim.rlim_cur != RLIM_INFINITY && ++ rlim.rlim_cur < sensible_limits [i].value) { ++ if (setrlimit (sensible_limits [i].limit, &rlim) != 0) { ++ fprintf (stderr, "Living environment not ok\n"); ++ exit (1); ++ } ++ } ++ } ++ ++ /* Make sure SIGIO/SIGINT is SIG_IGN */ ++ { ++ struct sigaction sa; ++ sigset_t sigset; ++ ++ sa.sa_handler = SIG_IGN; ++ sigemptyset (&sa.sa_mask); ++ sa.sa_flags = 0; ++ ++ sigemptyset(&sigset); ++ sigaddset(&sigset, SIGIO); ++ sigaddset(&sigset, SIGINT); ++ sigprocmask(SIG_UNBLOCK, &sigset, NULL); ++ ++ sigaction (SIGIO, &sa, NULL); ++ sigaction (SIGINT, &sa, NULL); ++ } ++} ++ ++static volatile int done; ++ ++static void ++exit_handler (int signum) ++{ ++ done = 1; ++} ++ ++ ++int ++main (int argc, char *argv []) ++{ ++ int res, n; ++ void *tag; ++ GnomePtyOps op; ++ const char *logname; ++ ++ sanity_checks (); ++ ++ pwent = NULL; ++ ++ logname = getenv ("LOGNAME"); ++ if (logname != NULL) { ++ pwent = getpwnam (logname); ++ if (pwent != NULL && pwent->pw_uid != getuid ()) { ++ /* LOGNAME is lying, fall back to looking up the uid */ ++ pwent = NULL; ++ } ++ } ++ ++ if (pwent == NULL) ++ pwent = getpwuid (getuid ()); ++ ++ if (pwent) ++ login_name = pwent->pw_name; ++ else { ++ sprintf (login_name_buffer, "#%u", (unsigned int)getuid ()); ++ login_name = login_name_buffer; ++ } ++ ++ /* Change directory so we don't prevent unmounting in case the initial cwd ++ * is on an external device (see bug #574491). ++ */ ++ if (chdir ("/") < 0) ++ fprintf (stderr, "Failed to chdir to /: %s\n", strerror (errno)); ++ ++ display_name = getenv ("DISPLAY"); ++ if (!display_name) ++ display_name = "localhost"; ++ ++ done = 0; ++ ++ /* Make sure we clean up utmp/wtmp even under vncserver */ ++ signal (SIGHUP, exit_handler); ++ signal (SIGTERM, exit_handler); ++ ++ while (!done) { ++ res = n_read (STDIN_FILENO, &op, sizeof (op)); ++ ++ if (res != sizeof (op)) { ++ done = 1; ++ continue; ++ } ++ ++ switch (op) { ++ case GNOME_PTY_OPEN_PTY_UTMP: ++ open_ptys (1, 0, 0); ++ break; ++ ++ case GNOME_PTY_OPEN_PTY_UWTMP: ++ open_ptys (1, 1, 0); ++ break; ++ ++ case GNOME_PTY_OPEN_PTY_WTMP: ++ open_ptys (0, 1, 0); ++ break; ++ ++ case GNOME_PTY_OPEN_PTY_LASTLOG: ++ open_ptys (0, 0, 1); ++ break; ++ ++ case GNOME_PTY_OPEN_PTY_LASTLOGUTMP: ++ open_ptys (1, 0, 1); ++ break; ++ ++ case GNOME_PTY_OPEN_PTY_LASTLOGUWTMP: ++ open_ptys (1, 1, 1); ++ break; ++ ++ case GNOME_PTY_OPEN_PTY_LASTLOGWTMP: ++ open_ptys (0, 1, 1); ++ break; ++ ++ case GNOME_PTY_OPEN_NO_DB_UPDATE: ++ open_ptys (0, 0, 0); ++ break; ++ ++ case GNOME_PTY_RESET_TO_DEFAULTS: ++ break; ++ ++ case GNOME_PTY_CLOSE_PTY: ++ n = n_read (STDIN_FILENO, &tag, sizeof (tag)); ++ if (n != sizeof (tag)) { ++ shutdown_helper (); ++ exit (1); ++ } ++ close_pty_pair (tag); ++ break; ++ ++ case GNOME_PTY_SYNCH: ++ { ++ int result = 0; ++ n_write (STDIN_FILENO, &result, 1); ++ } ++ break; ++ } ++ ++ } ++ ++ shutdown_helper (); ++ return 0; ++} ++ +diff --git a/gnome-pty-helper/gnome-pty.h b/gnome-pty-helper/gnome-pty.h +new file mode 100644 +index 000000000000..94f94f95e248 +--- /dev/null ++++ b/gnome-pty-helper/gnome-pty.h +@@ -0,0 +1,22 @@ ++#ifndef GNOME_PTY_H ++#define GNOME_PTY_H ++ ++typedef enum { ++ GNOME_PTY_OPEN_PTY_UTMP = 1, ++ GNOME_PTY_OPEN_PTY_UWTMP, ++ GNOME_PTY_OPEN_PTY_WTMP, ++ GNOME_PTY_OPEN_PTY_LASTLOG, ++ GNOME_PTY_OPEN_PTY_LASTLOGUTMP, ++ GNOME_PTY_OPEN_PTY_LASTLOGUWTMP, ++ GNOME_PTY_OPEN_PTY_LASTLOGWTMP, ++ GNOME_PTY_OPEN_NO_DB_UPDATE, ++ GNOME_PTY_RESET_TO_DEFAULTS, ++ GNOME_PTY_CLOSE_PTY, ++ GNOME_PTY_SYNCH ++} GnomePtyOps; ++ ++void *update_dbs (int utmp, int wtmp, int lastlog, char *login_name, char *display_name, char *term_name); ++void *write_login_record (char *login_name, char *display_name, char *term_name, int utmp, int wtmp, int lastlog); ++void write_logout_record (char *login_name, void *data, int utmp, int wtmp); ++ ++#endif +diff --git a/gnome-pty-helper/gnome-utmp.c b/gnome-pty-helper/gnome-utmp.c +new file mode 100644 +index 000000000000..1a090ec8ee38 +--- /dev/null ++++ b/gnome-pty-helper/gnome-utmp.c +@@ -0,0 +1,374 @@ ++/* ++ * utmp/wtmp file updating ++ * ++ * Authors: ++ * Miguel de Icaza (miguel@gnu.org). ++ * Timur I. Bakeyev (timur@gnu.org). ++ * ++ * FIXME: Do we want to register the PID of the process running *under* the ++ * subshell or the PID of the parent process? (we are doing the latter now). ++ * ++ * FIXME: Solaris (utmpx) stuff need to be checked. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#if defined(TIME_WITH_SYS_TIME) ++# include ++#include ++#else ++# if defined(HAVE_SYS_TIME_H) ++# include ++# else ++# include ++# endif ++#endif ++ ++#if defined(HAVE_LASTLOG_H) ++# include ++#endif ++ ++#if defined(HAVE_PATHS_H) ++# include ++#endif ++ ++#if defined(HAVE_UTMP_H) ++# include ++#endif ++ ++#if defined(HAVE_UTMPX_H) ++# include ++#endif ++ ++#if defined(HAVE_TTYENT_H) ++# include ++#endif ++ ++#include "gnome-pty.h" ++#include "gnome-login-support.h" ++ ++ ++ ++#if !defined(UTMP_OUTPUT_FILENAME) ++# if defined(UTMP_FILE) ++# define UTMP_OUTPUT_FILENAME UTMP_FILE ++# elif defined(_PATH_UTMP) /* BSD systems */ ++# define UTMP_OUTPUT_FILENAME _PATH_UTMP ++# else ++# define UTMP_OUTPUT_FILENAME "/etc/utmp" ++# endif ++#endif ++ ++#if !defined(WTMP_OUTPUT_FILENAME) ++# if defined(WTMPX_FILE) ++# define WTMP_OUTPUT_FILENAME WTMPX_FILE ++# elif defined(_PATH_WTMPX) ++# define WTMP_OUTPUT_FILENAME _PATH_WTMPX ++# elif defined(WTMPX_FILENAME) ++# define WTMP_OUTPUT_FILENAME WTMPX_FILENAME ++# elif defined(WTMP_FILE) ++# define WTMP_OUTPUT_FILENAME WTMP_FILE ++# elif defined(_PATH_WTMP) /* BSD systems */ ++# define WTMP_OUTPUT_FILENAME _PATH_WTMP ++# else ++# define WTMP_OUTPUT_FILENAME "/etc/wtmp" ++# endif ++#endif ++ ++#if defined(_PATH_LASTLOG) /* BSD systems */ ++# define LASTLOG_OUTPUT_FILE _PATH_LASTLOG ++#else ++# define LASTLOG_OUTPUT_FILE "/var/log/lastlog" ++#endif ++ ++#if defined(HAVE_UPDWTMPX) ++#include ++#define update_wtmp updwtmpx ++#elif defined(HAVE_UPDWTMP) ++#define update_wtmp updwtmp ++#else /* !HAVE_UPDWTMPX && !HAVE_UPDWTMP */ ++static void ++update_wtmp (char *file, UTMP *putmp) ++{ ++ int fd, times = 3; ++#if defined(HAVE_FCNTL) ++ struct flock lck; ++ ++ lck.l_whence = SEEK_END; ++ lck.l_len = 0; ++ lck.l_start = 0; ++ lck.l_type = F_WRLCK; ++#endif ++ ++ if ((fd = open (file, O_WRONLY|O_APPEND, 0)) < 0) ++ return; ++ ++#if defined (HAVE_FCNTL) ++ while (times--) ++ if ((fcntl (fd, F_SETLK, &lck) < 0)) ++ { ++ if (errno != EAGAIN && errno != EACCES) { ++ close (fd); ++ return; ++ } ++ sleep (1); /*?!*/ ++ } else ++ break; ++#elif defined(HAVE_FLOCK) ++ while (times--) ++ if (flock (fd, LOCK_EX | LOCK_NB) < 0) ++ { ++ if (errno != EWOULDBLOCK) ++ { ++ close (fd); ++ return; ++ } ++ sleep (1); /*?!*/ ++ } else ++ break; ++#endif /* HAVE_FLOCK */ ++ ++ lseek (fd, 0, SEEK_END); ++ write (fd, putmp, sizeof(UTMP)); ++ ++ /* unlock the file */ ++#if defined(HAVE_FCNTL) ++ lck.l_type = F_UNLCK; ++ fcntl (fd, F_SETLK, &lck); ++#elif defined(HAVE_FLOCK) ++ flock (fd, LOCK_UN); ++#endif ++ close (fd); ++} ++#endif /* !HAVE_GETUTMPX */ ++ ++ ++#if defined(HAVE_GETUTMPX) ++static void ++update_utmp (UTMP *ut) ++{ ++ setutxent(); ++ pututxline (ut); ++ endutxent(); ++} ++#elif defined(HAVE_GETUTENT) ++static void ++update_utmp (UTMP *ut) ++{ ++ setutent(); ++ pututline (ut); ++ endutent(); ++} ++#elif defined(HAVE_GETTTYENT) ++/* This variant is sutable for most BSD */ ++static void ++update_utmp (UTMP *ut) ++{ ++ struct ttyent *ty; ++ int fd, pos = 0; ++ ++ if ((fd = open (UTMP_OUTPUT_FILENAME, O_RDWR|O_CREAT, 0644)) < 0) ++ return; ++ ++ setttyent (); ++ while ((ty = getttyent ()) != NULL) ++ { ++ ++pos; ++ if (strncmp (ty->ty_name, ut->ut_line, sizeof (ut->ut_line)) == 0) ++ { ++ lseek (fd, (off_t)(pos * sizeof(UTMP)), SEEK_SET); ++ write(fd, ut, sizeof(UTMP)); ++ } ++ } ++ endttyent (); ++ ++ close(fd); ++} ++#else ++#define update_utmp(ut) ++#endif ++ ++#if !defined(HAVE_LASTLOG) ++#define update_lastlog(login_name, ut) ++#else ++static void ++update_lastlog(char* login_name, UTMP *ut) ++{ ++ struct passwd *pwd; ++ struct lastlog ll; ++ int fd; ++ ++ if ((fd = open(LASTLOG_OUTPUT_FILE, O_WRONLY, 0)) < 0) ++ return; ++ ++ if ((pwd=getpwnam(login_name)) == NULL) ++ return; ++ ++ memset (&ll, 0, sizeof(ll)); ++ ++ lseek (fd, (off_t)pwd->pw_uid * sizeof (ll), SEEK_SET); ++ ++ time (&ll.ll_time); ++ ++ strncpy (ll.ll_line, ut->ut_line, sizeof (ll.ll_line)); ++ ++#if defined(HAVE_UT_UT_HOST) ++ if (ut->ut_host) ++ strncpy (ll.ll_host, ut->ut_host, sizeof (ll.ll_host)); ++#endif ++ ++ write (fd, (void *)&ll, sizeof (ll)); ++ close (fd); ++} ++#endif /* HAVE_LASTLOG */ ++ ++void ++write_logout_record (char *login_name, void *data, int utmp, int wtmp) ++{ ++ UTMP put, *ut = data; ++ struct timeval tv; ++ ++ memset (&put, 0, sizeof(UTMP)); ++ ++#if defined(HAVE_UT_UT_TYPE) ++ put.ut_type = DEAD_PROCESS; ++#endif ++#if defined(HAVE_UT_UT_ID) ++ strncpy (put.ut_id, ut->ut_id, sizeof (put.ut_id)); ++#endif ++ ++ strncpy (put.ut_line, ut->ut_line, sizeof (put.ut_line)); ++ ++#if defined(HAVE_UT_UT_TV) ++ gettimeofday(&tv, NULL); ++ put.ut_tv.tv_sec = tv.tv_sec; ++ put.ut_tv.tv_usec = tv.tv_usec; ++#elif defined(HAVE_UT_UT_TIME) ++ time (&put.ut_time); ++#endif ++ ++#if defined(HAVE_UT_UT_NAME) ++ strncpy (put.ut_name, login_name, sizeof (put.ut_name)); ++#elif defined(HAVE_UT_UT_USER) ++ strncpy (put.ut_user, login_name, sizeof (put.ut_user)); ++#endif ++ ++ if (utmp) ++ update_utmp (&put); ++ ++ if (wtmp) ++ update_wtmp (WTMP_OUTPUT_FILENAME, &put); ++ ++ free (ut); ++} ++ ++void * ++write_login_record (char *login_name, char *display_name, ++ char *term_name, int utmp, int wtmp, int lastlog) ++{ ++ UTMP *ut; ++ char *pty = term_name; ++ struct timeval tv; ++ ++ if ((ut=(UTMP *) malloc (sizeof (UTMP))) == NULL) ++ return NULL; ++ ++ memset (ut, 0, sizeof (UTMP)); ++ ++#if defined(HAVE_UT_UT_NAME) ++ strncpy (ut->ut_name, login_name, sizeof (ut->ut_name)); ++#elif defined(HAVE_UT_UT_USER) ++ strncpy (ut->ut_user, login_name, sizeof (ut->ut_user)); ++#endif ++ ++ /* This shouldn't happen */ ++ if (strncmp (pty, "/dev/", 5) == 0) ++ pty += 5; ++ ++#if defined(HAVE_STRRCHR) ++ { ++ char *p; ++ ++ if (strncmp (pty, "pts", 3) && ++ (p = strrchr (pty, '/')) != NULL) ++ pty = p + 1; ++ } ++#endif ++ ++#if defined(HAVE_UT_UT_ID) ++ /* Just a safe-guard */ ++ ut->ut_id [0] = '\0'; ++ ++ /* BSD-like terminal name */ ++ if (strncmp (pty, "pts", 3) == 0 || ++ strncmp (pty, "pty", 3) == 0 || ++ strncmp (pty, "tty", 3) == 0) { ++ strncpy (ut->ut_id, pty+3, sizeof (ut->ut_id)); ++ } else { ++ unsigned int num; ++ char buf[10]; ++ /* Try to get device number and convert it to gnome-terminal # */ ++ if (sscanf (pty, "%*[^0-9a-f]%x", &num) == 1) { ++ sprintf (buf, "gt%2.2x", num); ++ strncpy (ut->ut_id, buf, sizeof (ut->ut_id)); ++ } ++ } ++#endif ++ ++ /* For utmpx ut_line should be null terminated */ ++ /* We do that for both cases to be sure */ ++ strncpy (ut->ut_line, pty, sizeof (ut->ut_line)); ++ ut->ut_line[sizeof (ut->ut_line)-1] = '\0'; ++ ++ /* We want parent's pid, not our own */ ++#if defined(HAVE_UT_UT_PID) ++ ut->ut_pid = getppid (); ++#endif ++ ++#if defined(HAVE_UT_UT_TYPE) ++ ut->ut_type = USER_PROCESS; ++#endif ++ /* If structure has ut_tv it doesn't need ut_time */ ++#if defined(HAVE_UT_UT_TV) ++ gettimeofday(&tv, NULL); ++ ut->ut_tv.tv_sec = tv.tv_sec; ++ ut->ut_tv.tv_usec = tv.tv_usec; ++#elif defined(HAVE_UT_UT_TIME) ++ time (&ut->ut_time); ++#endif ++ /* ut_ host supposed to be null terminated or len should */ ++ /* be specifid in additional field. We do both :) */ ++#if defined(HAVE_UT_UT_HOST) ++ strncpy (ut->ut_host, display_name, sizeof (ut->ut_host)); ++ ut->ut_host [sizeof (ut->ut_host)-1] = '\0'; ++# if defined(HAVE_UT_UT_SYSLEN) ++ ut->ut_syslen = strlen (ut->ut_host); ++# endif ++#endif ++ if (utmp) ++ update_utmp (ut); ++ ++ if (wtmp) ++ update_wtmp (WTMP_OUTPUT_FILENAME, ut); ++ ++ if (lastlog) ++ update_lastlog(login_name, ut); ++ ++ return ut; ++} ++ ++void * ++update_dbs (int utmp, int wtmp, int lastlog, char *login_name, char *display_name, char *term_name) ++{ ++ return write_login_record (login_name, display_name, ++ term_name, utmp, wtmp, lastlog); ++} +diff --git a/src/pty.cc b/src/pty.cc +index 745735891516..95e037aa491c 100644 +--- a/src/pty.cc ++++ b/src/pty.cc +@@ -66,8 +66,25 @@ + #include + #include "debug.h" + ++#ifdef MSG_NOSIGNAL ++#define PTY_RECVMSG_FLAGS MSG_NOSIGNAL ++#else ++#define PTY_RECVMSG_FLAGS 0 ++#endif ++ + #include + ++#ifdef VTE_USE_GNOME_PTY_HELPER ++#include ++#ifdef HAVE_SYS_UN_H ++#include ++#endif ++#include "../gnome-pty-helper/gnome-pty.h" ++static gboolean _vte_pty_helper_started = FALSE; ++static pid_t _vte_pty_helper_pid = -1; ++static int _vte_pty_helper_tunnel = -1; ++#endif ++ + /* NSIG isn't in POSIX, so if it doesn't exist use this here. See bug #759196 */ + #ifndef NSIG + #define NSIG (8 * sizeof(sigset_t)) +@@ -104,8 +121,11 @@ struct _VtePtyPrivate { + + VtePtyChildSetupData child_setup_data; + ++ gpointer helper_tag; /* only use when using_helper is TRUE */ ++ + guint utf8 : 1; + guint foreign : 1; ++ guint using_helper : 1; + }; + + struct _VtePtyClass { +@@ -145,14 +165,16 @@ vte_pty_child_setup (VtePty *pty) + if (masterfd == -1) + _exit(127); + +- if (grantpt(masterfd) != 0) { +- _vte_debug_print(VTE_DEBUG_PTY, "%s failed: %m", "grantpt"); +- _exit(127); +- } ++ if (!priv->using_helper) { ++ if (grantpt(masterfd) != 0) { ++ _vte_debug_print(VTE_DEBUG_PTY, "%s failed: %m", "grantpt"); ++ _exit(127); ++ } + +- if (unlockpt(masterfd) != 0) { +- _vte_debug_print(VTE_DEBUG_PTY, "%s failed: %m", "unlockpt"); +- _exit(127); ++ if (unlockpt(masterfd) != 0) { ++ _vte_debug_print(VTE_DEBUG_PTY, "%s failed: %m", "unlockpt"); ++ _exit(127); ++ } + } + + char *name = ptsname(masterfd); +@@ -664,6 +686,405 @@ _vte_pty_open_foreign(int masterfd /* consumed */) + return fd.steal(); + } + ++#ifdef VTE_USE_GNOME_PTY_HELPER ++#ifdef HAVE_RECVMSG ++static void ++_vte_pty_read_ptypair(int tunnel, int *parentfd, int *childfd) ++{ ++ int i, ret; ++ char control[LINE_MAX], iobuf[LINE_MAX]; ++ struct cmsghdr *cmsg; ++ struct msghdr msg; ++ struct iovec vec; ++ ++ for (i = 0; i < 2; i++) { ++ vec.iov_base = iobuf; ++ vec.iov_len = sizeof(iobuf); ++ msg.msg_name = NULL; ++ msg.msg_namelen = 0; ++ msg.msg_iov = &vec; ++ msg.msg_iovlen = 1; ++ msg.msg_control = control; ++ msg.msg_controllen = sizeof(control); ++ ret = recvmsg(tunnel, &msg, PTY_RECVMSG_FLAGS); ++ if (ret == -1) { ++ return; ++ } ++ for (cmsg = CMSG_FIRSTHDR(&msg); ++ cmsg != NULL; ++ cmsg = CMSG_NXTHDR(&msg, cmsg)) { ++ if (cmsg->cmsg_type == SCM_RIGHTS) { ++ memcpy(&ret, CMSG_DATA(cmsg), sizeof(ret)); ++ switch (i) { ++ case 0: ++ *parentfd = ret; ++ break; ++ case 1: ++ *childfd = ret; ++ break; ++ default: ++ g_assert_not_reached(); ++ break; ++ } ++ } ++ } ++ } ++} ++#elif defined (I_RECVFD) ++static void ++_vte_pty_read_ptypair(int tunnel, int *parentfd, int *childfd) ++{ ++ int i; ++ if (ioctl(tunnel, I_RECVFD, &i) == -1) { ++ return; ++ } ++ *parentfd = i; ++ if (ioctl(tunnel, I_RECVFD, &i) == -1) { ++ return; ++ } ++ *childfd = i; ++} ++#endif ++ ++#ifdef HAVE_SOCKETPAIR ++static int ++_vte_pty_pipe_open(int *a, int *b) ++{ ++ int p[2], ret = -1; ++#ifdef PF_UNIX ++#ifdef SOCK_STREAM ++ ret = socketpair(PF_UNIX, SOCK_STREAM, 0, p); ++#else ++#ifdef SOCK_DGRAM ++ ret = socketpair(PF_UNIX, SOCK_DGRAM, 0, p); ++#endif ++#endif ++ if (ret == 0) { ++ *a = p[0]; ++ *b = p[1]; ++ return 0; ++ } ++#endif ++ return ret; ++} ++#else ++static int ++_vte_pty_pipe_open(int *a, int *b) ++{ ++ int p[2], ret = -1; ++ ++ ret = pipe(p); ++ ++ if (ret == 0) { ++ *a = p[0]; ++ *b = p[1]; ++ } ++ return ret; ++} ++#endif ++ ++/* Like read, but hide EINTR and EAGAIN. */ ++static ssize_t ++n_read(int fd, void *buffer, size_t count) ++{ ++ size_t n = 0; ++ char *buf = static_cast(buffer); ++ int i; ++ while (n < count) { ++ i = read(fd, buf + n, count - n); ++ switch (i) { ++ case 0: ++ return n; ++ case -1: ++ switch (errno) { ++ case EINTR: ++ case EAGAIN: ++#ifdef ERESTART ++ case ERESTART: ++#endif ++ break; ++ default: ++ return -1; ++ } ++ break; ++ default: ++ n += i; ++ break; ++ } ++ } ++ return n; ++} ++ ++/* Like write, but hide EINTR and EAGAIN. */ ++static ssize_t ++n_write(int fd, const void *buffer, size_t count) ++{ ++ size_t n = 0; ++ const char *buf = static_cast(buffer); ++ int i; ++ while (n < count) { ++ i = write(fd, buf + n, count - n); ++ switch (i) { ++ case 0: ++ return n; ++ case -1: ++ switch (errno) { ++ case EINTR: ++ case EAGAIN: ++#ifdef ERESTART ++ case ERESTART: ++#endif ++ break; ++ default: ++ return -1; ++ } ++ break; ++ default: ++ n += i; ++ break; ++ } ++ } ++ return n; ++} ++ ++/* ++ * _vte_pty_stop_helper: ++ * ++ * Terminates the running GNOME PTY helper. ++ */ ++static void ++_vte_pty_stop_helper(void) ++{ ++ if (_vte_pty_helper_started) { ++ close(_vte_pty_helper_tunnel); ++ _vte_pty_helper_tunnel = -1; ++ kill(_vte_pty_helper_pid, SIGTERM); ++ _vte_pty_helper_pid = -1; ++ _vte_pty_helper_started = FALSE; ++ } ++} ++ ++/* ++ * _vte_pty_start_helper: ++ * @error: a location to store a #GError, or %NULL ++ * ++ * Starts the GNOME PTY helper process, if it is not already running. ++ * ++ * Returns: %TRUE if the helper was already started, or starting it succeeded, ++ * %FALSE on failure with @error filled in ++ */ ++static gboolean ++_vte_pty_start_helper(GError **error) ++{ ++ int i, errsv; ++ int tunnel = -1; ++ int tmp[2] = { -1, -1 }; ++ ++ if (_vte_pty_helper_started) ++ return TRUE; ++ ++ /* Create a communication link for use with the helper. */ ++ tmp[0] = open("/dev/null", O_RDONLY); ++ if (tmp[0] == -1) { ++ goto failure; ++ } ++ tmp[1] = open("/dev/null", O_RDONLY); ++ if (tmp[1] == -1) { ++ goto failure; ++ } ++ if (_vte_pty_pipe_open(&_vte_pty_helper_tunnel, &tunnel) != 0) { ++ goto failure; ++ } ++ close(tmp[0]); ++ close(tmp[1]); ++ tmp[0] = tmp[1] = -1; ++ ++ /* Now fork and start the helper. */ ++ _vte_pty_helper_pid = fork(); ++ if (_vte_pty_helper_pid == -1) { ++ goto failure; ++ } ++ if (_vte_pty_helper_pid == 0) { ++ /* Child. Close descriptors. No need to close all, ++ * gnome-pty-helper does that anyway. */ ++ for (i = 0; i < 3; i++) { ++ close(i); ++ } ++ /* Reassign the socket pair to stdio. */ ++ dup2(tunnel, STDIN_FILENO); ++ dup2(tunnel, STDOUT_FILENO); ++ close(tunnel); ++ close(_vte_pty_helper_tunnel); ++ /* Exec our helper. */ ++ execl(LIBEXECDIR "/gnome-pty-helper", ++ "gnome-pty-helper", (char *) NULL); ++ /* Bail. */ ++ _exit(1); ++ } ++ close(tunnel); ++ atexit(_vte_pty_stop_helper); ++ ++ _vte_pty_helper_started = TRUE; ++ return TRUE; ++ ++failure: ++ errsv = errno; ++ ++ g_set_error(error, VTE_PTY_ERROR, ++ VTE_PTY_ERROR_PTY_HELPER_FAILED, ++ "Failed to start gnome-pty-helper: %s", ++ g_strerror (errsv)); ++ ++ if (tmp[0] != -1) ++ close(tmp[0]); ++ if (tmp[1] != -1) ++ close(tmp[1]); ++ if (tunnel != -1) ++ close(tunnel); ++ if (_vte_pty_helper_tunnel != -1) ++ close(_vte_pty_helper_tunnel); ++ ++ _vte_pty_helper_pid = -1; ++ _vte_pty_helper_tunnel = -1; ++ ++ errno = errsv; ++ return FALSE; ++} ++ ++/* ++ * _vte_pty_helper_ops_from_flags: ++ * @flags: flags from #VtePtyFlags ++ * ++ * Translates @flags into the corresponding op code for the ++ * GNOME PTY helper. ++ * ++ * Returns: the #GnomePtyOps corresponding to @flags ++ */ ++static int ++_vte_pty_helper_ops_from_flags (VtePtyFlags flags) ++{ ++ int op = 0; ++ static const int opmap[8] = { ++ GNOME_PTY_OPEN_NO_DB_UPDATE, /* 0 0 0 */ ++ GNOME_PTY_OPEN_PTY_LASTLOG, /* 0 0 1 */ ++ GNOME_PTY_OPEN_PTY_UTMP, /* 0 1 0 */ ++ GNOME_PTY_OPEN_PTY_LASTLOGUTMP, /* 0 1 1 */ ++ GNOME_PTY_OPEN_PTY_WTMP, /* 1 0 0 */ ++ GNOME_PTY_OPEN_PTY_LASTLOGWTMP, /* 1 0 1 */ ++ GNOME_PTY_OPEN_PTY_UWTMP, /* 1 1 0 */ ++ GNOME_PTY_OPEN_PTY_LASTLOGUWTMP, /* 1 1 1 */ ++ }; ++ if ((flags & VTE_PTY_NO_LASTLOG) == 0) { ++ op += 1; ++ } ++ if ((flags & VTE_PTY_NO_UTMP) == 0) { ++ op += 2; ++ } ++ if ((flags & VTE_PTY_NO_WTMP) == 0) { ++ op += 4; ++ } ++ g_assert(op >= 0 && op < (int) G_N_ELEMENTS(opmap)); ++ ++ return opmap[op]; ++} ++ ++/* ++ * _vte_pty_open_with_helper: ++ * @pty: a #VtePty ++ * @error: a location to store a #GError, or %NULL ++ * ++ * Opens a new file descriptor to a new PTY master using the ++ * GNOME PTY helper. ++ * ++ * Returns: %TRUE on success, %FALSE on failure with @error filled in ++ */ ++static gboolean ++_vte_pty_open_with_helper(VtePty *pty, ++ GError **error) ++{ ++ VtePtyPrivate *priv = pty->priv; ++ GnomePtyOps ops; ++ int ret; ++ int parentfd = -1, childfd = -1; ++ gpointer tag; ++ ++ /* We have to use the pty helper here. */ ++ if (!_vte_pty_start_helper(error)) ++ return FALSE; ++ ++ /* Try to open a new descriptor. */ ++ ++ ops = static_cast(_vte_pty_helper_ops_from_flags(priv->flags)); ++ /* Send our request. */ ++ if (n_write(_vte_pty_helper_tunnel, ++ &ops, sizeof(ops)) != sizeof(ops)) { ++ g_set_error (error, VTE_PTY_ERROR, ++ VTE_PTY_ERROR_PTY_HELPER_FAILED, ++ "Failed to send request to gnome-pty-helper: %s", ++ g_strerror(errno)); ++ return FALSE; ++ } ++ _vte_debug_print(VTE_DEBUG_PTY, "Sent request to helper.\n"); ++ /* Read back the response. */ ++ if (n_read(_vte_pty_helper_tunnel, ++ &ret, sizeof(ret)) != sizeof(ret)) { ++ g_set_error (error, VTE_PTY_ERROR, ++ VTE_PTY_ERROR_PTY_HELPER_FAILED, ++ "Failed to read response from gnome-pty-helper: %s", ++ g_strerror(errno)); ++ return FALSE; ++ } ++ _vte_debug_print(VTE_DEBUG_PTY, ++ "Received response from helper.\n"); ++ if (ret == 0) { ++ g_set_error_literal (error, VTE_PTY_ERROR, ++ VTE_PTY_ERROR_PTY_HELPER_FAILED, ++ "gnome-pty-helper failed to open pty"); ++ return FALSE; ++ } ++ _vte_debug_print(VTE_DEBUG_PTY, "Helper returns success.\n"); ++ /* Read back a tag. */ ++ if (n_read(_vte_pty_helper_tunnel, ++ &tag, sizeof(tag)) != sizeof(tag)) { ++ g_set_error (error, VTE_PTY_ERROR, ++ VTE_PTY_ERROR_PTY_HELPER_FAILED, ++ "Failed to read tag from gnome-pty-helper: %s", ++ g_strerror(errno)); ++ return FALSE; ++ } ++ _vte_debug_print(VTE_DEBUG_PTY, "Tag = %p.\n", tag); ++ /* Receive the master and slave ptys. */ ++ _vte_pty_read_ptypair(_vte_pty_helper_tunnel, ++ &parentfd, &childfd); ++ ++ _vte_debug_print(VTE_DEBUG_PTY, ++ "Got master pty %d and slave pty %d.\n", ++ parentfd, childfd); ++ close(childfd); ++ ++ if ((parentfd == -1) || ++ fd_set_nonblocking(parentfd) < 0 || fd_set_cpkt(parentfd) < 0) { ++ int errsv = errno; ++ ++ close(parentfd); ++ ++ g_set_error (error, VTE_PTY_ERROR, ++ VTE_PTY_ERROR_PTY_HELPER_FAILED, ++ "Failed to read and setup master pty from gnome-pty-helper: %s", ++ g_strerror(errsv)); ++ errno = errsv; ++ return FALSE; ++ } ++ ++ priv->using_helper = TRUE; ++ priv->helper_tag = tag; ++ priv->pty_fd = parentfd; ++ ++ return TRUE; ++} ++ ++#endif /* VTE_USE_GNOME_PTY_HELPER */ ++ + /** + * vte_pty_set_utf8: + * @pty: a #VtePty +@@ -722,13 +1143,45 @@ vte_pty_set_utf8(VtePty *pty, + * vte_pty_close: + * @pty: a #VtePty + * +- * Since 0.42 this is a no-op. ++ * Cleans up the PTY, specifically any logging performed for the ++ * session. The file descriptor to the PTY master remains open. + * + * Deprecated: 0.42 + */ + void + vte_pty_close (VtePty *pty) + { ++#ifdef VTE_USE_GNOME_PTY_HELPER ++ VtePtyPrivate *priv = pty->priv; ++ gpointer tag; ++ GnomePtyOps ops; ++ ++ if (!priv->using_helper) ++ return; ++ ++ /* Signal the helper that it needs to close its connection. */ ++ tag = priv->helper_tag; ++ ++ ops = GNOME_PTY_CLOSE_PTY; ++ if (n_write(_vte_pty_helper_tunnel, ++ &ops, sizeof(ops)) != sizeof(ops)) { ++ return; ++ } ++ if (n_write(_vte_pty_helper_tunnel, ++ &tag, sizeof(tag)) != sizeof(tag)) { ++ return; ++ } ++ ++ ops = GNOME_PTY_SYNCH; ++ if (n_write(_vte_pty_helper_tunnel, ++ &ops, sizeof(ops)) != sizeof(ops)) { ++ return; ++ } ++ n_read(_vte_pty_helper_tunnel, &ops, 1); ++ ++ priv->helper_tag = NULL; ++ priv->using_helper = FALSE; ++#endif + } + + /* VTE PTY class */ +@@ -757,10 +1210,47 @@ vte_pty_initable_init (GInitable *initable, + + if (priv->foreign) { + priv->pty_fd = _vte_pty_open_foreign(priv->pty_fd); +- } else { +- priv->pty_fd = _vte_pty_open_posix(); ++ goto out; + } + ++#ifdef VTE_USE_GNOME_PTY_HELPER ++ if ((priv->flags & VTE_PTY_NO_HELPER) == 0) { ++ GError *err = NULL; ++ gboolean ret = FALSE; ++ ++ ret = _vte_pty_open_with_helper(pty, &err); ++ g_assert(ret || err != NULL); ++ ++ if (ret) ++ return TRUE; ++ ++ _vte_debug_print(VTE_DEBUG_PTY, ++ "_vte_pty_open_with_helper failed: %s\n", ++ err->message); ++ ++ /* Only do fallback if gnome-pty-helper failed! */ ++ if ((priv->flags & VTE_PTY_NO_FALLBACK) || ++ !g_error_matches(err, ++ VTE_PTY_ERROR, ++ VTE_PTY_ERROR_PTY_HELPER_FAILED)) { ++ g_propagate_error (error, err); ++ return FALSE; ++ } ++ ++ g_error_free(err); ++ /* Fall back to unix98 or bsd PTY */ ++ } ++#else ++ if (priv->flags & VTE_PTY_NO_FALLBACK) { ++ g_set_error_literal(error, VTE_PTY_ERROR, VTE_PTY_ERROR_PTY_HELPER_FAILED, ++ "VTE compiled without GNOME PTY helper"); ++ return FALSE; ++ } ++#endif /* VTE_USE_GNOME_PTY_HELPER */ ++ ++ priv->pty_fd = _vte_pty_open_posix(); ++ ++ out: + if (priv->pty_fd == -1) { + vte::util::restore_errno errsv; + g_set_error(error, G_IO_ERROR, g_io_error_from_errno(errsv), +@@ -801,6 +1291,8 @@ vte_pty_finalize (GObject *object) + VtePty *pty = VTE_PTY (object); + VtePtyPrivate *priv = pty->priv; + ++ vte_pty_close(pty); ++ + /* Close the master FD */ + if (priv->pty_fd != -1) { + close(priv->pty_fd); +@@ -868,7 +1360,8 @@ vte_pty_class_init (VtePtyClass *klass) + /** + * VtePty:flags: + * +- * Flags. ++ * Controls how the session is recorded in lastlog, utmp, and ++ * wtmp, and whether to use the GNOME PTY helper. + */ + g_object_class_install_property + (object_class, +@@ -939,6 +1432,17 @@ vte_pty_error_quark(void) + * + * Also, you MUST pass the %G_SPAWN_DO_NOT_REAP_CHILD flag. + * ++ * If GNOME PTY Helper is available and ++ * unless some of the %VTE_PTY_NO_LASTLOG, %VTE_PTY_NO_UTMP or ++ * %VTE_PTY_NO_WTMP flags are passed in @flags, the ++ * session is logged in the corresponding lastlog, utmp or wtmp ++ * system files. When passing %VTE_PTY_NO_HELPER in @flags, the ++ * GNOME PTY Helper is bypassed entirely. ++ * ++ * When passing %VTE_PTY_NO_FALLBACK in @flags, ++ * and opening a PTY using the PTY helper fails, there will ++ * be no fallback to allocate a PTY using POSIX PTY functions. ++ * + * Returns: (transfer full): a new #VtePty, or %NULL on error with @error filled in + */ + VtePty * +diff --git a/src/vte.cc b/src/vte.cc +index b35bb650d3e3..69723d0af800 100644 +--- a/src/vte.cc ++++ b/src/vte.cc +@@ -8277,6 +8277,7 @@ VteTerminalPrivate::~VteTerminalPrivate() + g_io_channel_unref (m_pty_channel); + } + if (m_pty != NULL) { ++ vte_pty_close(m_pty); + g_object_unref(m_pty); + } + +@@ -10155,6 +10156,7 @@ VteTerminalPrivate::set_pty(VtePty *new_pty) + /* Clear the outgoing buffer as well. */ + _vte_byte_array_clear(m_outgoing); + ++ vte_pty_close(m_pty); + g_object_unref(m_pty); + m_pty = NULL; + } +diff --git a/src/vte/vteenums.h b/src/vte/vteenums.h +index 10069633731b..70d989cc5699 100644 +--- a/src/vte/vteenums.h ++++ b/src/vte/vteenums.h +@@ -80,7 +80,8 @@ typedef enum { + + /** + * VtePtyError: +- * @VTE_PTY_ERROR_PTY_HELPER_FAILED: Obsolete. Deprecated: 0.42 ++ * @VTE_PTY_ERROR_PTY_HELPER_FAILED: failure when using the GNOME PTY ++ * helper to allocate the PTY. Deprecated: 0.42 + * @VTE_PTY_ERROR_PTY98_FAILED: failure when using PTY98 to allocate the PTY + */ + typedef enum { +@@ -90,11 +91,13 @@ typedef enum { + + /** + * VtePtyFlags: +- * @VTE_PTY_NO_LASTLOG: Unused. Deprecated: 0.38 +- * @VTE_PTY_NO_UTMP: Unused. Deprecated: 0.38 +- * @VTE_PTY_NO_WTMP: Unused. Deprecated: 0.38 +- * @VTE_PTY_NO_HELPER: Unused. Deprecated: 0.38 +- * @VTE_PTY_NO_FALLBACK: Unused. Deprecated: 0.38 ++ * @VTE_PTY_NO_LASTLOG: don't record the session in lastlog. Deprecated: 0.38 ++ * @VTE_PTY_NO_UTMP: don't record the session in utmp. Deprecated: 0.38 ++ * @VTE_PTY_NO_WTMP: don't record the session in wtmp. Deprecated: 0.38 ++ * @VTE_PTY_NO_HELPER: don't use the GNOME PTY helper to allocate the ++ * PTY. Deprecated: 0.38 ++ * @VTE_PTY_NO_FALLBACK: when allocating the PTY with the PTY helper ++ * fails, don't fall back to try using POSIX. Deprecated: 0.38 + * @VTE_PTY_DEFAULT: the default flags + */ + typedef enum { +-- +2.9.4 + diff --git a/SPECS/vte291.spec b/SPECS/vte291.spec index 388c03a..9465a1b 100644 --- a/SPECS/vte291.spec +++ b/SPECS/vte291.spec @@ -1,32 +1,44 @@ %global apiver 2.91 Name: vte291 -Version: 0.38.4 -Release: 2%{?dist} +Version: 0.46.2 +Release: 1%{?dist} Summary: Terminal emulator library License: LGPLv2+ URL: http://www.gnome.org/ -Source0: http://download.gnome.org/sources/vte/0.38/vte-%{version}.tar.xz -# https://bugzilla.gnome.org/show_bug.cgi?id=688456 -Patch0: 0001-widget-Only-show-the-cursor-on-motion-if-moved.patch -# https://bugzilla.gnome.org/show_bug.cgi?id=725342 -Patch1: 0001-widget-Don-t-hide-the-mouse-pointer.patch -# https://bugzilla.gnome.org/show_bug.cgi?id=678042 -Patch2: 0001-emulation-Support-CSI-3J-clear-scrollback.patch + +Source0: http://download.gnome.org/sources/vte/0.46/vte-%{version}.tar.xz +Source1: %{name}-git.mk + +# https://bugzilla.gnome.org/show_bug.cgi?id=782977 +Patch0: %{name}-pty-remove-unused-variable.patch + +# https://bugzilla.gnome.org/show_bug.cgi?id=711059 # https://bugzilla.redhat.com/show_bug.cgi?id=1103380 -Patch3: vte-scroll-speed.patch +Patch100: %{name}-command-notify-scroll-speed.patch + +# https://bugzilla.redhat.com/show_bug.cgi?id=1443504 +Patch101: %{name}-restore-gnome-pty-helper.patch +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: libtool BuildRequires: gettext +BuildRequires: pkgconfig(gnutls) BuildRequires: gobject-introspection-devel +BuildRequires: gperf BuildRequires: gtk3-devel +BuildRequires: pkgconfig(libpcre2-8) BuildRequires: intltool -BuildRequires: vala-tools +BuildRequires: vala # initscripts creates the utmp group Requires: initscripts Requires: vte-profile +Conflicts: gnome-terminal < 3.20.1-2 + %description VTE is a library implementing a terminal emulator widget for GTK+. VTE is mainly used in gnome-terminal, but can also be used to embed a @@ -56,20 +68,19 @@ emulator library. %prep %setup -q -n vte-%{version} -%patch0 -p1 -b .motion -%patch1 -p1 -b .auto-hide -%patch2 -p1 -b .clear-csi3j -%patch3 -p1 -b .scroll-speed - -sed -i 's/VTE_DEFAULT_TERM=xterm/\0-256color/' configure +%patch0 -p1 -b .pty-remove-unused-variable +%patch100 -p1 -b .command-notify-scroll-speed +%patch101 -p1 -b .restore-gnome-pty-helper %build +install -m 0644 %{SOURCE1} ./git.mk +autoreconf --force --install + CFLAGS="%optflags -fPIE -DPIE" \ CXXFLAGS="$CFLAGS" \ LDFLAGS="$LDFLAGS -Wl,-z,relro -Wl,-z,now -pie" \ %configure \ --disable-static \ - --with-gtk=3.0 \ --libexecdir=%{_libdir}/vte-%{apiver} \ --disable-gtk-doc \ --enable-gnome-pty-helper \ @@ -88,7 +99,8 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/*.la %postun -p /sbin/ldconfig %files -f vte-%{apiver}.lang -%doc COPYING NEWS README +%license COPYING +%doc NEWS README %{_libdir}/libvte-%{apiver}.so.0* %dir %{_libdir}/vte-%{apiver} %attr(2711,root,utmp) %{_libdir}/vte-%{apiver}/gnome-pty-helper @@ -107,6 +119,23 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/*.la %{_sysconfdir}/profile.d/vte.sh %changelog +* Tue May 23 2017 Debarshi Ray - 0.46.2-1 +- Update to 0.46.2 +- Backport upstream patch to remove an unused variable +Resolves: #1387056 + +* Mon May 22 2017 Debarshi Ray - 0.46.1-2 +- Restore gnome-pty-helper +- Add git.mk and other dependencies to regenerate the build scripts +Resolves: #1443504 + +* Fri Feb 24 2017 Debarshi Ray - 0.46.1-1 +- Update to 0.46.1 +- Drop upstreamed patches +- Drop workaround for old GTK+ bug (#1238315) +- Rebase downstream patches +Resolves: #1387056 + * Fri May 13 2016 Debarshi Ray - 0.38.4-2 - Add a property to configure the scroll speed Resolves: #1103380