SHA256
1
0
forked from pool/helix

- Add 0001-fix-ub-in-diff-gutter.patch.

* This fixes issues when building helix with Rust >1.71. In the future,
  This will be removed once a fix lands on the `ropey` crate which was the
  cause of the issue.
- Reenable usage of cargo-packaging macros
- Remove explicit dependency declaration of cargo1.66 to use latest Rust.

OBS-URL: https://build.opensuse.org/package/show/editors/helix?expand=0&rev=80
This commit is contained in:
Soc Virnyl Estela 2023-08-31 23:44:52 +00:00 committed by Git OBS Bridge
parent 6cf1e49dbb
commit 2aafa4f410
3 changed files with 81 additions and 4 deletions

View File

@ -0,0 +1,68 @@
From 269f637847140ddb9537efde4968bd92c91c9e1e Mon Sep 17 00:00:00 2001
From: Pascal Kuthe <pascal.kuthe@semimod.de>
Date: Sun, 4 Jun 2023 16:59:01 +0200
Subject: [PATCH] fix UB in diff gutter
---
helix-vcs/src/diff/line_cache.rs | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/helix-vcs/src/diff/line_cache.rs b/helix-vcs/src/diff/line_cache.rs
index 8e48250f157e..460a2065e8ed 100644
--- a/helix-vcs/src/diff/line_cache.rs
+++ b/helix-vcs/src/diff/line_cache.rs
@@ -20,8 +20,8 @@ use super::{MAX_DIFF_BYTES, MAX_DIFF_LINES};
/// A cache that stores the `lines` of a rope as a vector.
/// It allows safely reusing the allocation of the vec when updating the rope
pub(crate) struct InternedRopeLines {
- diff_base: Rope,
- doc: Rope,
+ diff_base: Box<Rope>,
+ doc: Box<Rope>,
num_tokens_diff_base: u32,
interned: InternedInput<RopeSlice<'static>>,
}
@@ -34,8 +34,8 @@ impl InternedRopeLines {
after: Vec::with_capacity(doc.len_lines()),
interner: Interner::new(diff_base.len_lines() + doc.len_lines()),
},
- diff_base,
- doc,
+ diff_base: Box::new(diff_base),
+ doc: Box::new(doc),
// will be populated by update_diff_base_impl
num_tokens_diff_base: 0,
};
@@ -44,19 +44,19 @@ impl InternedRopeLines {
}
pub fn doc(&self) -> Rope {
- self.doc.clone()
+ Rope::clone(&*self.doc)
}
pub fn diff_base(&self) -> Rope {
- self.diff_base.clone()
+ Rope::clone(&*self.diff_base)
}
/// Updates the `diff_base` and optionally the document if `doc` is not None
pub fn update_diff_base(&mut self, diff_base: Rope, doc: Option<Rope>) {
self.interned.clear();
- self.diff_base = diff_base;
+ self.diff_base = Box::new(diff_base);
if let Some(doc) = doc {
- self.doc = doc
+ self.doc = Box::new(doc)
}
if !self.is_too_large() {
self.update_diff_base_impl();
@@ -74,7 +74,7 @@ impl InternedRopeLines {
.interner
.erase_tokens_after(self.num_tokens_diff_base.into());
- self.doc = doc;
+ self.doc = Box::new(doc);
if self.is_too_large() {
self.interned.after.clear();
} else {

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Thu Aug 31 23:40:52 UTC 2023 - Soc Virnyl Estela <socvirnyl.estela@gmail.com>
- Add 0001-fix-ub-in-diff-gutter.patch.
* This fixes issues when building helix with Rust >1.71. In the future,
This will be removed once a fix lands on the `ropey` crate which was the
cause of the issue.
- Reenable usage of cargo-packaging macros
- Remove explicit dependency declaration of cargo1.66 to use latest Rust.
-------------------------------------------------------------------
Wed Aug 30 12:51:00 UTC 2023 - Soc Virnyl Estela <socvirnyl.estela@gmail.com>

View File

@ -34,11 +34,10 @@ Source1: vendor.tar.xz
Source2: cargo_config
Source3: README-suse-maint.md
Source4: helix-rpmlintrc
Patch1: https://github.com/helix-editor/helix/pull/7227.patch#/0001-fix-ub-in-diff-gutter.patch
BuildRequires: c++_compiler
BuildRequires: c_compiler
# Cargo packaging seems to only want the latest version of rust+cargo
# BuildRequires: cargo-packaging
BuildRequires: cargo1.66
BuildRequires: cargo-packaging
BuildRequires: hicolor-icon-theme
BuildRequires: update-desktop-files
Recommends: %{name}-runtime = %{version}
@ -97,7 +96,7 @@ sed -e '/^\#\!\/usr\/bin\/env .*/d' -i contrib/completion/hx.*
%build
export HELIX_DISABLE_AUTO_GRAMMAR_BUILD=true
export TARGET="%_arch"
cargo build --release --offline
%{cargo_build}
cargo run --release --offline -- --grammar build
# Shell completions