commit:     1b7900f916ca8ac513c0393a5811d87e724646c8
Author:     Hans de Graaff <graaff <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 23 17:31:27 2021 +0000
Commit:     Hans de Graaff <graaff <AT> gentoo <DOT> org>
CommitDate: Mon Aug 23 17:38:12 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1b7900f9

dev-ruby/tty-screen: fix ioctl endian test failure

Closes: https://bugs.gentoo.org/808174
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Hans de Graaff <graaff <AT> gentoo.org>

 .../files/tty-screen-0.8.1-ioctl-test.patch        | 55 ++++++++++++++++++++++
 dev-ruby/tty-screen/tty-screen-0.8.1.ebuild        |  2 +
 2 files changed, 57 insertions(+)

diff --git a/dev-ruby/tty-screen/files/tty-screen-0.8.1-ioctl-test.patch 
b/dev-ruby/tty-screen/files/tty-screen-0.8.1-ioctl-test.patch
new file mode 100644
index 00000000000..0933f1f611b
--- /dev/null
+++ b/dev-ruby/tty-screen/files/tty-screen-0.8.1-ioctl-test.patch
@@ -0,0 +1,55 @@
+From dba351b178ae06b56985cc77a291918a0fc4aff4 Mon Sep 17 00:00:00 2001
+From: Piotr Murach <pmur...@gmail.com>
+Date: Mon, 16 Aug 2021 22:13:27 +0200
+Subject: [PATCH] Fix ioctl call test to stub terminal size encoding for
+ big-endian systems
+
+Fixes #13
+---
+ CHANGELOG.md             | 6 ++++++
+ spec/unit/screen_spec.rb | 8 +++++++-
+ 2 files changed, 13 insertions(+), 1 deletion(-)
+
+diff --git a/CHANGELOG.md b/CHANGELOG.md
+index 91dd6ab..0f369bd 100644
+--- a/CHANGELOG.md
++++ b/CHANGELOG.md
+@@ -1,5 +1,10 @@
+ # Change log
+ 
++## [v0.8.2] - unreleased
++
++### Fixed
++* Fix ioctl call test to stub terminal size encoding for big-endian systems
++
+ ## [v0.8.1] - 2020-07-17
+ 
+ ### Fixed
+@@ -136,6 +141,7 @@
+ ### Fixed
+ * Fix bug with screen detection from_io_console by @luxflux
+ 
++[v0.8.2]: https://github.com/piotrmurach/tty-screen/compare/v0.8.1...v0.8.2
+ [v0.8.1]: https://github.com/piotrmurach/tty-screen/compare/v0.8.0...v0.8.1
+ [v0.8.0]: https://github.com/piotrmurach/tty-screen/compare/v0.7.1...v0.8.0
+ [v0.7.1]: https://github.com/piotrmurach/tty-screen/compare/v0.7.0...v0.7.1
+diff --git a/spec/unit/screen_spec.rb b/spec/unit/screen_spec.rb
+index 3666a3c..de78ff3 100644
+--- a/spec/unit/screen_spec.rb
++++ b/spec/unit/screen_spec.rb
+@@ -6,8 +6,14 @@ def winsize
+       [100, 200]
+     end
+ 
++    def big_endian?
++      [1].pack("S") == [1].pack("n")
++    end
++
+     def ioctl(control, buf)
+-      buf.replace("3\x00\xD3\x00\xF2\x04\xCA\x02\x00")
++      little_endian = "3\x00\xD3\x00\xF2\x04\xCA\x02\x00"
++      big_endian = "\x003\x00\xD3\x04\xF2\x02\xCA"
++      buf.replace(big_endian? ? big_endian : little_endian)
+       0
+     end
+   end

diff --git a/dev-ruby/tty-screen/tty-screen-0.8.1.ebuild 
b/dev-ruby/tty-screen/tty-screen-0.8.1.ebuild
index 7f105f6ddd5..24ccfbc41f7 100644
--- a/dev-ruby/tty-screen/tty-screen-0.8.1.ebuild
+++ b/dev-ruby/tty-screen/tty-screen-0.8.1.ebuild
@@ -23,6 +23,8 @@ SLOT="0"
 KEYWORDS="~amd64 ~hppa ~riscv ~sparc"
 IUSE=""
 
+PATCHES=( "${FILESDIR}/${P}-ioctl-test.patch" )
+
 all_ruby_prepare() {
        echo '-rspec_helper' > .rspec || die
        sed -i -e 's:require_relative ":require "./:' ${RUBY_FAKEGEM_GEMSPEC} 
|| die

Reply via email to