Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] hexedit: file size 0 patch
@ 2022-04-21 22:03 zlice
  2022-04-22 12:49 ` zlice
  2022-04-22 12:49 ` [PR PATCH] [Closed]: " zlice
  0 siblings, 2 replies; 3+ messages in thread
From: zlice @ 2022-04-21 22:03 UTC (permalink / raw)
  To: ml

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

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

https://github.com/zlice/void-packages hexedit_filesize0
https://github.com/void-linux/void-packages/pull/36808

hexedit: file size 0 patch

#### Testing

- I tested the changes in this PR: **briefly**

#### Local build testing
- I built this PR locally for my native architecture, x86_64

#### Comments
Just annoying. See https://github.com/pixel/hexedit/issues/44

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

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

From 8be5cd178c97e19e2054da64eba7e4aa9b5af62b Mon Sep 17 00:00:00 2001
From: zlice <zlice555@gmail.com>
Date: Thu, 21 Apr 2022 17:56:50 -0400
Subject: [PATCH] hexedit: file size 0 patch

---
 ...vent-division-by-zero-on-empty-files.patch | 44 +++++++++++++++++++
 srcpkgs/hexedit/template                      |  2 +-
 2 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 srcpkgs/hexedit/patches/0001-Prevent-division-by-zero-on-empty-files.patch

diff --git a/srcpkgs/hexedit/patches/0001-Prevent-division-by-zero-on-empty-files.patch b/srcpkgs/hexedit/patches/0001-Prevent-division-by-zero-on-empty-files.patch
new file mode 100644
index 000000000000..e25000028924
--- /dev/null
+++ b/srcpkgs/hexedit/patches/0001-Prevent-division-by-zero-on-empty-files.patch
@@ -0,0 +1,44 @@
+From 41981645134d201151f1cea9fd964d892166e866 Mon Sep 17 00:00:00 2001
+From: Tobias Stoeckmann <tobias@stoeckmann.org>
+Date: Sun, 4 Oct 2020 20:18:00 +0200
+Subject: [PATCH] Prevent division by zero on empty files.
+
+Hexedit crashes with a floating point exception when an empty file is
+opened. This was introduced with percentage view in status line and
+released with version 1.5.
+
+How to reproduce:
+
+$ touch empty
+$ hexedit empty
+---
+ display.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/display.c b/display.c
+index 9b4df91..a012b27 100644
+--- a/display.c
++++ b/display.c
+@@ -182,6 +182,7 @@ void exitCurses(void)
+
+ void display(void)
+ {
++  long long fsize;
+   int i;
+
+   for (i = 0; i < nbBytes; i += lineLength) {
+@@ -204,8 +205,9 @@ void display(void)
+   else if (edited) i = '*';
+   else i = '-';
+   printw("-%c%c  %s       --0x%llX", i, i, baseName, (long long) base + cursor);
+-  if (MAX(fileSize, lastEditedLoc)) printw("/0x%llX", (long long) getfilesize());
+-  printw("--%i%%", 100 * (base + cursor + getfilesize()/200) / getfilesize() );
++  fsize = getfilesize();
++  if (MAX(fileSize, lastEditedLoc)) printw("/0x%llX", fsize);
++  printw("--%i%%", fsize == 0 ? 0 : 100 * (base + cursor + fsize/200) / fsize );
+   if (mode == bySector) printw("--sector %lld", (long long) ((base + cursor) / SECTOR_SIZE));
+
+   move(cursor / lineLength, computeCursorXCurrentPos());
+--
+2.35.3
+
diff --git a/srcpkgs/hexedit/template b/srcpkgs/hexedit/template
index a7840b7a3ddd..b6cbad564019 100644
--- a/srcpkgs/hexedit/template
+++ b/srcpkgs/hexedit/template
@@ -1,7 +1,7 @@
 # Template file for 'hexedit'
 pkgname=hexedit
 version=1.5
-revision=1
+revision=2
 build_style=gnu-configure
 hostmakedepends="automake"
 makedepends="ncurses-devel"

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

* Re: hexedit: file size 0 patch
  2022-04-21 22:03 [PR PATCH] hexedit: file size 0 patch zlice
@ 2022-04-22 12:49 ` zlice
  2022-04-22 12:49 ` [PR PATCH] [Closed]: " zlice
  1 sibling, 0 replies; 3+ messages in thread
From: zlice @ 2022-04-22 12:49 UTC (permalink / raw)
  To: ml

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

New comment by zlice on void-packages repository

https://github.com/void-linux/void-packages/pull/36808#issuecomment-1106481705

Comment:
Closing for #36813 1.6 release

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

* Re: [PR PATCH] [Closed]: hexedit: file size 0 patch
  2022-04-21 22:03 [PR PATCH] hexedit: file size 0 patch zlice
  2022-04-22 12:49 ` zlice
@ 2022-04-22 12:49 ` zlice
  1 sibling, 0 replies; 3+ messages in thread
From: zlice @ 2022-04-22 12:49 UTC (permalink / raw)
  To: ml

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

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

hexedit: file size 0 patch
https://github.com/void-linux/void-packages/pull/36808

Description:

#### Testing

- I tested the changes in this PR: **briefly**

#### Local build testing
- I built this PR locally for my native architecture, x86_64

#### Comments
Just annoying. See https://github.com/pixel/hexedit/issues/44

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

end of thread, other threads:[~2022-04-22 12:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21 22:03 [PR PATCH] hexedit: file size 0 patch zlice
2022-04-22 12:49 ` zlice
2022-04-22 12:49 ` [PR PATCH] [Closed]: " zlice

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).