Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] cgdb: fix escape sequences
@ 2021-06-17 20:46 meator
  2021-06-18  3:02 ` ericonr
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: meator @ 2021-06-17 20:46 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2065 bytes --]

There is a new pull request by meator against master on the void-packages repository

https://github.com/meator/void-packages cgdb-patch
https://github.com/void-linux/void-packages/pull/31548

cgdb: fix escape sequences
<!-- Mark items with [x] where applicable -->

#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [x] I built this PR locally for my native architecture, (x86_64-glibc)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl

The current version of cgdb has broken escape sequences (its prompt is `[?2004h(gdb) `). This is already fixed in their Github repo, but the latest official release does not contain the fix. The issue mentioning this is [here](https://github.com/cgdb/cgdb/issues/256). I have created the `fixescape.patch` patch from [these](https://github.com/cgdb/cgdb/issues/239#issuecomment-706249589) patches and from [this](https://github.com/cgdb/cgdb/issues/255#issuecomment-820546156) patch.

A patch file from https://github.com/void-linux/void-packages/pull/31548.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-cgdb-patch-31548.patch --]
[-- Type: text/x-diff, Size: 3418 bytes --]

From 87bab8c0c3924e2e82633c7e8f263eb39a895aaf Mon Sep 17 00:00:00 2001
From: meator <coder64@protonmail.com>
Date: Thu, 17 Jun 2021 22:22:41 +0200
Subject: [PATCH] cgdb: fix escape sequences

This commit adds a patch that fixes bad escape sequences in prompt. This
should be fixed in next release of cgdb.
---
 srcpkgs/cgdb/patches/fixescape.patch | 48 ++++++++++++++++++++++++++++
 srcpkgs/cgdb/template                |  2 +-
 2 files changed, 49 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/cgdb/patches/fixescape.patch

diff --git a/srcpkgs/cgdb/patches/fixescape.patch b/srcpkgs/cgdb/patches/fixescape.patch
new file mode 100644
index 000000000000..a581288dba64
--- /dev/null
+++ b/srcpkgs/cgdb/patches/fixescape.patch
@@ -0,0 +1,48 @@
+From 242ea26b6f4aa7ce2ce56cbb1b50cd93a3126a57 Mon Sep 17 00:00:00 2001
+From: meator <coder64@protonmail.com>
+Date: Thu, 17 Jun 2021 21:30:06 +0200
+Subject: [PATCH] Patch
+
+This is a patch for v0.7.1 of cgdb. It fixes bad escape sequences in prompt string. Based of https://github.com/cgdb/cgdb/issues/239#issuecomment-706249589 and https://github.com/cgdb/cgdb/issues/255#issuecomment-820546156.
+
+---
+ cgdb/scroller.cpp | 17 +++++++++++++++--
+ 1 file changed, 15 insertions(+), 2 deletions(-)
+
+diff --git cgdb/scroller.cpp cgdb/scroller.cpp
+index 2d01e82..d2d36ca 100644
+--- cgdb/scroller.cpp
++++ cgdb/scroller.cpp
+@@ -106,14 +106,27 @@ static char *parse(struct scroller *scr, struct hl_line_attr **attrs,
+                 /* Carriage return -> Move back to the beginning of the line */
+             case '\r':
+                 i = 0;
+-                if (buf[j + 1] != '\n') {
++                if ((buflen - j) >= 1 && buf[j + 1] != '\n') {
+                     sbfree(*attrs);
+                     *attrs = NULL;
+                 }
+                 break;
+             case '\033':
+                 /* Handle ansi escape characters */
+-                if (hl_ansi_color_support(hl_groups_instance) &&
++                /* see https://conemu.github.io/en/AnsiEscapeCodes.html#SGR_Select_Graphic_Rendition_parameters
++                 */
++                if ((buflen - j) >= 6
++                    && buf[j + 1] == '[' && buf[j + 2] == '?' && buf[j + 3] == '2'
++                    && buf[j + 4] == '0' && buf[j + 5] == '0' && buf[j + 6] == '4') {
++                    /* simply ignore these escape sequences like e.g. "[?2004h" */
++                    j += 7;
++                } else if ((buflen - j) >= 2 && buf[j + 1] == '[' && buf[j + 2] == '?') {
++                    /* simply ignore these escape sequences like e.g. "[?1h" */
++                    j += 4;
++                } else if ((buflen - j) >= 1 && (buf[j + 1] == '=' || buf[j + 1] == '>')) {
++                    /* simply ignore these escape sequences */
++                    j += 1;
++                } else if (hl_ansi_color_support(hl_groups_instance) &&
+                     debugwincolor) {
+                     int attr;
+                     int ansi_count = hl_ansi_get_color_attrs(
+-- 
+2.32.0
+
diff --git a/srcpkgs/cgdb/template b/srcpkgs/cgdb/template
index bf75df74a341..86ce9b0b8dd0 100644
--- a/srcpkgs/cgdb/template
+++ b/srcpkgs/cgdb/template
@@ -1,7 +1,7 @@
 # Template file for 'cgdb'
 pkgname=cgdb
 version=0.7.1
-revision=1
+revision=2
 build_style=gnu-configure
 configure_args="ac_cv_rl_version=6.3
  ac_cv_file__proc_self_status=yes"

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: cgdb: fix escape sequences
  2021-06-17 20:46 [PR PATCH] cgdb: fix escape sequences meator
@ 2021-06-18  3:02 ` ericonr
  2021-06-20 18:43 ` [PR PATCH] [Updated] " meator
  2021-06-21 11:56 ` [PR PATCH] [Merged]: " ericonr
  2 siblings, 0 replies; 4+ messages in thread
From: ericonr @ 2021-06-18  3:02 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 225 bytes --]

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/31548#issuecomment-863718413

Comment:
Please include the same information about patch origins into the commit message ;)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PR PATCH] [Updated] cgdb: fix escape sequences
  2021-06-17 20:46 [PR PATCH] cgdb: fix escape sequences meator
  2021-06-18  3:02 ` ericonr
@ 2021-06-20 18:43 ` meator
  2021-06-21 11:56 ` [PR PATCH] [Merged]: " ericonr
  2 siblings, 0 replies; 4+ messages in thread
From: meator @ 2021-06-20 18:43 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2070 bytes --]

There is an updated pull request by meator against master on the void-packages repository

https://github.com/meator/void-packages cgdb-patch
https://github.com/void-linux/void-packages/pull/31548

cgdb: fix escape sequences
<!-- Mark items with [x] where applicable -->

#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [x] I built this PR locally for my native architecture, (x86_64-glibc)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl

The current version of cgdb has broken escape sequences (its prompt is `[?2004h(gdb) `). This is already fixed in their Github repo, but the latest official release does not contain the fix. The issue mentioning this is [here](https://github.com/cgdb/cgdb/issues/256). I have created the `fixescape.patch` patch from [these](https://github.com/cgdb/cgdb/issues/239#issuecomment-706249589) patches and from [this](https://github.com/cgdb/cgdb/issues/255#issuecomment-820546156) patch.

A patch file from https://github.com/void-linux/void-packages/pull/31548.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-cgdb-patch-31548.patch --]
[-- Type: text/x-diff, Size: 3579 bytes --]

From df2e700cd5231c2174c0a5c860cb099e117badb8 Mon Sep 17 00:00:00 2001
From: meator <coder64@protonmail.com>
Date: Thu, 17 Jun 2021 22:22:41 +0200
Subject: [PATCH] cgdb: fix escape sequences

This commit adds a patch that fixes bad escape sequences in prompt. This
should be fixed in next release of cgdb. The patch is based of
https://github.com/cgdb/cgdb/issues/239#issuecomment-706249589 and
https://github.com/cgdb/cgdb/issues/255#issuecomment-820546156.
---
 srcpkgs/cgdb/patches/fixescape.patch | 48 ++++++++++++++++++++++++++++
 srcpkgs/cgdb/template                |  2 +-
 2 files changed, 49 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/cgdb/patches/fixescape.patch

diff --git a/srcpkgs/cgdb/patches/fixescape.patch b/srcpkgs/cgdb/patches/fixescape.patch
new file mode 100644
index 000000000000..529e832108d7
--- /dev/null
+++ b/srcpkgs/cgdb/patches/fixescape.patch
@@ -0,0 +1,48 @@
+From 242ea26b6f4aa7ce2ce56cbb1b50cd93a3126a57 Mon Sep 17 00:00:00 2001
+From: meator <coder64@protonmail.com>
+Date: Thu, 17 Jun 2021 21:30:06 +0200
+Subject: [PATCH] Patch
+
+This is a patch for v0.7.1 of cgdb. It fixes bad escape sequences in prompt string. Based of https://github.com/cgdb/cgdb/issues/239#issuecomment-706249589 and https://github.com/cgdb/cgdb/issues/255#issuecomment-820546156.
+
+---
+ cgdb/scroller.cpp | 17 +++++++++++++++--
+ 1 file changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/cgdb/scroller.cpp b/cgdb/scroller.cpp
+index 2d01e82..d2d36ca 100644
+--- a/cgdb/scroller.cpp
++++ b/cgdb/scroller.cpp
+@@ -106,14 +106,27 @@ static char *parse(struct scroller *scr, struct hl_line_attr **attrs,
+                 /* Carriage return -> Move back to the beginning of the line */
+             case '\r':
+                 i = 0;
+-                if (buf[j + 1] != '\n') {
++                if ((buflen - j) >= 1 && buf[j + 1] != '\n') {
+                     sbfree(*attrs);
+                     *attrs = NULL;
+                 }
+                 break;
+             case '\033':
+                 /* Handle ansi escape characters */
+-                if (hl_ansi_color_support(hl_groups_instance) &&
++                /* see https://conemu.github.io/en/AnsiEscapeCodes.html#SGR_Select_Graphic_Rendition_parameters
++                 */
++                if ((buflen - j) >= 6
++                    && buf[j + 1] == '[' && buf[j + 2] == '?' && buf[j + 3] == '2'
++                    && buf[j + 4] == '0' && buf[j + 5] == '0' && buf[j + 6] == '4') {
++                    /* simply ignore these escape sequences like e.g. "[?2004h" */
++                    j += 7;
++                } else if ((buflen - j) >= 2 && buf[j + 1] == '[' && buf[j + 2] == '?') {
++                    /* simply ignore these escape sequences like e.g. "[?1h" */
++                    j += 4;
++                } else if ((buflen - j) >= 1 && (buf[j + 1] == '=' || buf[j + 1] == '>')) {
++                    /* simply ignore these escape sequences */
++                    j += 1;
++                } else if (hl_ansi_color_support(hl_groups_instance) &&
+                     debugwincolor) {
+                     int attr;
+                     int ansi_count = hl_ansi_get_color_attrs(
+-- 
+2.32.0
+
diff --git a/srcpkgs/cgdb/template b/srcpkgs/cgdb/template
index bf75df74a341..86ce9b0b8dd0 100644
--- a/srcpkgs/cgdb/template
+++ b/srcpkgs/cgdb/template
@@ -1,7 +1,7 @@
 # Template file for 'cgdb'
 pkgname=cgdb
 version=0.7.1
-revision=1
+revision=2
 build_style=gnu-configure
 configure_args="ac_cv_rl_version=6.3
  ac_cv_file__proc_self_status=yes"

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PR PATCH] [Merged]: cgdb: fix escape sequences
  2021-06-17 20:46 [PR PATCH] cgdb: fix escape sequences meator
  2021-06-18  3:02 ` ericonr
  2021-06-20 18:43 ` [PR PATCH] [Updated] " meator
@ 2021-06-21 11:56 ` ericonr
  2 siblings, 0 replies; 4+ messages in thread
From: ericonr @ 2021-06-21 11:56 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1913 bytes --]

There's a merged pull request on the void-packages repository

cgdb: fix escape sequences
https://github.com/void-linux/void-packages/pull/31548

Description:
<!-- Mark items with [x] where applicable -->

#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [x] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [x] I built this PR locally for my native architecture, (x86_64-glibc)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl

The current version of cgdb has broken escape sequences (its prompt is `[?2004h(gdb) `). This is already fixed in their Github repo, but the latest official release does not contain the fix. The issue mentioning this is [here](https://github.com/cgdb/cgdb/issues/256). I have created the `fixescape.patch` patch from [these](https://github.com/cgdb/cgdb/issues/239#issuecomment-706249589) patches and from [this](https://github.com/cgdb/cgdb/issues/255#issuecomment-820546156) patch.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-21 11:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-17 20:46 [PR PATCH] cgdb: fix escape sequences meator
2021-06-18  3:02 ` ericonr
2021-06-20 18:43 ` [PR PATCH] [Updated] " meator
2021-06-21 11:56 ` [PR PATCH] [Merged]: " ericonr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).