Hi,
On Wed, Sep 11, 2024 at 04:50:20PM +0100, Simon McVittie wrote:
> Package: git-buildpackage
> Version: 0.9.34
> Severity: normal
> 
> gtk+3.0_3.24.43-3 contains a patch in the `git format-patch` dialect of
> DEP-3 format, whose long description contains a diff illustrating how
> to test the change (patch attached for reference).
> 
> The author of this patch clearly meant for the machine-readable part
> of the patch to apply changes to gtk/gtkmessagedialog.c only.
> `git apply` and `git am` have this behaviour, therefore so does `gbp pq`.
> 
> However, patch(1) and therefore dpkg-source looks for anything in the
> patch text that looks vaguely diff-like, even if it's indented (!), and
> applies it. The result is that in the uploaded gtk+3.0_3.24.43-3 package,
> both gtk/gtkmessagedialog.c and demos/gtk-demo/dialog.c have been edited
> (reported as #1081179).

Ouch. That's unexpected.

> 
> I could even imagine this becoming a security issue, if the long
> description of a patch contains instructions for changes to be made
> during testing that are not suitable for production (for example if the
> long description describes how to stub out authentication in order to
> test something).
> 
> I've reported a separate dpkg-source bug asking for it to refuse to apply
> the indented part of diffs like the attached.
> 
> To address this interop issue from both sides, I think that when
> `gbp-pq export` serializes patches into debian/patches to become input
> to dpkg-source, it should try to identify parts of the long commit
> message that patch(1) would consider to be the beginning of a diff (I
> think this means lines matching regexes r'^\s+-{3}' and r'^\s+[+]{3}',
> or something like that?) and escape them somehow, perhaps by prepending
> "#", ">" or ".".

That make sense to me. A patch would be welcome.
Cheers,
 -- Guido
`
> 
> Thanks,
>     smcv

> From: Michael Weghorn <m.wegh...@posteo.de>
> Date: Fri, 9 Aug 2024 18:37:11 +0200
> Subject: a11y: Use non-empty message dialog title as a11y name
> 
> If a `GtkMessageDialog` has a non-empty title set, use
> that for the accessible name instead of a generic name
> indicating the type of the message dialog, as the
> window title is generally more informative, if set.
> It also better matches the information presented
> visually on screen (in the window title, task switchers,...)
> and is in line with the handling for non-message-dialog
> windows.
> 
> This can easily be tested with the "Dialogs and
> Message Boxes" sample from gtk3-demo when setting
> a title for the message dialog in there like this:
> 
>     diff --git a/demos/gtk-demo/dialog.c b/demos/gtk-demo/dialog.c
>     index 0eb1c62397..53fb7f8b0e 100644
>     --- a/demos/gtk-demo/dialog.c
>     +++ b/demos/gtk-demo/dialog.c
>     @@ -25,6 +25,8 @@ message_dialog_clicked (GtkButton *button,
>                                         "number of times:");
>        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
>                                                  "%d", i);
>     +  gtk_window_set_title (GTK_WINDOW (dialog), "Some informative title");
>     +
>        gtk_dialog_run (GTK_DIALOG (dialog));
>        gtk_widget_destroy (dialog);
>        i++;
> 
> (cherry picked from commit 939737c3e72c2deaa0094f35838038df92f2a724)
> 
> Origin: upstream gtk-3-24 branch, after 3.24.43
> ---
>  gtk/gtkmessagedialog.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/gtk/gtkmessagedialog.c b/gtk/gtkmessagedialog.c
> index 1de3118..ee35b26 100644
> --- a/gtk/gtkmessagedialog.c
> +++ b/gtk/gtkmessagedialog.c
> @@ -373,7 +373,12 @@ update_accessible_name (GtkMessageDialog *dialog)
>    if (!GTK_IS_ACCESSIBLE (atk_obj))
>      return;
>  
> -  const char *name = NULL;
> +  const char *name = gtk_window_get_title (GTK_WINDOW (dialog));
> +  if (name && name[0])
> +  {
> +    atk_object_set_name (atk_obj, name);
> +    return;
> +  }
>  
>    switch (dialog->priv->message_type)
>    {
> @@ -438,6 +443,8 @@ update_title (GObject    *dialog,
>    title = gtk_window_get_title (GTK_WINDOW (dialog));
>    gtk_label_set_label (GTK_LABEL (label), title);
>    gtk_widget_set_visible (label, title && title[0]);
> +
> +  update_accessible_name (GTK_MESSAGE_DIALOG (dialog));
>  }
>  
>  static void

Reply via email to