"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Omar Polo <op@omarpolo.com>
Subject:
fix regress of diff.git
To:
gameoftrees@openbsd.org
Date:
Mon, 01 Aug 2022 19:29:53 +0200

Download raw body.

Thread
as per subject, this fixes most of the issues with the regress suite in
diff.git.  test 015 still fails because of a bug in patch(1).  I've sent
a diff to tech@: with that applied the regress suite should be all fine.

The diff is not really a pleasure to read.  I've adjusted after manual
inspection the expected output so that it's equal to the one produced by
the tool.  Comparing the diffs produced is moot, the same diff can be
expressed in different ways, but i think it's useful to keep it to avoid
surprises in the future.

ok?

diff /home/op/w/diff
commit - 3a15e1807a369c0a7827363eca22c9f1a8598d9c
path + /home/op/w/diff
blob - 52a26087ac130f45f285e35835bbe2e9f057e458
file + test/expect.arraylist_test
--- test/expect.arraylist_test
+++ test/expect.arraylist_test
@@ -1,3 +1,4 @@
+==== run-regress-arraylist_test ====
 (0 items)
 
 (1 items)
@@ -72,3 +73,4 @@ insert at [-42]:
 clear:
 (0 items)
 
+
blob - 9d083f161b0fd36d88753bff7631930a8bbf2e74
file + test/expect.results_test
--- test/expect.results_test
+++ test/expect.results_test
@@ -1,3 +1,4 @@
+==== run-regress-results_test ====
 
 --- test_minus_after_plus()
 [0] same lines L2 R2 @L 0 @R 0
@@ -10,3 +11,4 @@
 [1] minus lines L3 R0 @L 2 @R 2
 [2] plus lines L0 R3 @L 5 @R 2
 [3] same lines L2 R2 @L 5 @R 5
+
blob - 0260dddb49db5bd1e6042ecec6c939392ba07ae1
file + test/expect021.diff
--- test/expect021.diff
+++ test/expect021.diff
@@ -108,7 +108,7 @@
  		    sizeof(sd->mds.mdd_crypto.scr_maskkey));
  	} else if (bc->bc_key_disk != NODEV) {
  		/* Read the mask key from the key disk. */
-@@ -248,119 +249,71 @@
+@@ -248,117 +249,69 @@
  }
  
  struct sr_crypto_wu *
@@ -229,8 +229,8 @@
 -	crwu->cr_crp->crp_desc = NULL;
 -
 -	return (NULL);
- }
- 
+-}
+-
 -void
 -sr_crypto_wu_put(struct sr_crypto_wu *crwu)
 -{
@@ -247,11 +247,9 @@
 -	mtx_enter(&sd->mds.mdd_crypto.scr_mutex);
 -	TAILQ_INSERT_TAIL(&sd->mds.mdd_crypto.scr_wus, crwu, cr_link);
 -	mtx_leave(&sd->mds.mdd_crypto.scr_mutex);
--}
--
+ }
+ 
  int
- sr_crypto_get_kdf(struct bioc_createraid *bc, struct sr_discipline *sd)
- {
 @@ -386,9 +339,8 @@
  		if (sizeof(sd->mds.mdd_crypto.scr_meta->scm_kdfhint) <
  		    kdfinfo->genkdf.len)
@@ -300,10 +298,12 @@
  		    "softraid", alg);
  		rv = -1;
  		goto out;
-@@ -617,6 +569,17 @@
+@@ -615,6 +567,17 @@
+ 		sr_error(sd->sd_sc, "incorrect key or passphrase");
+ 		rv = EPERM;
  		goto out;
- 	}
- 
++	}
++
 +	/* Copy new KDF hint to metadata, if supplied. */
 +	if (kdfinfo2->flags & SR_CRYPTOKDF_HINT) {
 +		if (kdfinfo2->genkdf.len >
@@ -313,11 +313,9 @@
 +		    sizeof(sd->mds.mdd_crypto.scr_meta->scm_kdfhint));
 +		memcpy(sd->mds.mdd_crypto.scr_meta->scm_kdfhint,
 +		    &kdfinfo2->genkdf, kdfinfo2->genkdf.len);
-+	}
-+
+ 	}
+ 
  	/* Mask the disk keys. */
- 	c = (u_char *)sd->mds.mdd_crypto.scr_meta->scm_key;
- 	if (sr_crypto_encrypt(p, c, kdfinfo2->maskkey, ksz,
 @@ -630,7 +593,7 @@
  	    sizeof(sd->mds.mdd_crypto.scr_key), check_digest);
  
@@ -504,10 +502,12 @@
  
  	if (vn && open) {
  		VOP_CLOSE(vn, FREAD, NOCRED, curproc);
-@@ -952,16 +895,43 @@
+@@ -950,18 +893,45 @@
+ 	}
+ 
  	return key_disk;
- }
- 
++}
++
 +static void
 +sr_crypto_free_sessions(struct sr_discipline *sd)
 +{
@@ -519,8 +519,8 @@
 +			sd->mds.mdd_crypto.scr_sid[i] = (u_int64_t)-1;
 +		}
 +	}
-+}
-+
+ }
+ 
  int
  sr_crypto_alloc_resources(struct sr_discipline *sd)
  {
@@ -687,13 +687,14 @@
 +	DNPRINTF(SR_D_DIS, "%s: sr_crypto_rw wu %p\n",
  	    DEVNAME(wu->swu_dis->sd_sc), wu);
  
-+	if (sr_validate_io(wu, &blkno, "sr_crypto_rw"))
-+		return (1);
-+
- 	if (wu->swu_xs->flags & SCSI_DATA_OUT) {
+-	if (wu->swu_xs->flags & SCSI_DATA_OUT) {
 -		crwu = sr_crypto_wu_get(wu, 1);
 -		if (crwu == NULL)
 -			return (1);
++	if (sr_validate_io(wu, &blkno, "sr_crypto_rw"))
++		return (1);
++
++	if (wu->swu_xs->flags & SCSI_DATA_OUT) {
 +		crwu = sr_crypto_prepare(wu, 1);
  		crwu->cr_crp->crp_callback = sr_crypto_write;
 -		s = splvm();
blob - efe355d8849775313a336bb7da180981dcf500e5
file + test/expect104.diff
--- test/expect104.diff
+++ test/expect104.diff
@@ -1,25 +1,24 @@
 --- test104.left-P.txt
 +++ test104.right-P.txt
-@@ -1,14 +1,14 @@
--void Chunk_copy(Chunk *src, size_t src_start, Chunk *dst, size_t dst_start, size_t n)
--{
--    if (!Chunk_bounds_check(src, src_start, n)) return;
--    if (!Chunk_bounds_check(dst, dst_start, n)) return;
--
--    memcpy(dst->data + dst_start, src->data + src_start, n);
--}
--
- int Chunk_bounds_check(Chunk *chunk, size_t start, size_t n)
+@@ -1,3 +1,10 @@
++int Chunk_bounds_check(Chunk *chunk, size_t start, size_t n)
++{
++    if (chunk == NULL) return 0;
++
++    return start <= chunk->length && n <= chunk->length - start;
++}
++
+ void Chunk_copy(Chunk *src, size_t src_start, Chunk *dst, size_t dst_start, size_t n)
  {
-     if (chunk == NULL) return 0;
+     if (!Chunk_bounds_check(src, src_start, n)) return;
+@@ -5,10 +12,3 @@
  
-     return start <= chunk->length && n <= chunk->length - start;
+     memcpy(dst->data + dst_start, src->data + src_start, n);
  }
-+
-+void Chunk_copy(Chunk *src, size_t src_start, Chunk *dst, size_t dst_start, size_t n)
-+{
-+    if (!Chunk_bounds_check(src, src_start, n)) return;
-+    if (!Chunk_bounds_check(dst, dst_start, n)) return;
-+
-+    memcpy(dst->data + dst_start, src->data + src_start, n);
-+}
+-
+-int Chunk_bounds_check(Chunk *chunk, size_t start, size_t n)
+-{
+-    if (chunk == NULL) return 0;
+-
+-    return start <= chunk->length && n <= chunk->length - start;
+-}
blob - ef9e04582e1a7dafa426543c5fd8aa840f120230
file + test/expect105.diff
--- test/expect105.diff
+++ test/expect105.diff
@@ -1,13 +1,12 @@
 --- test105.left-P.txt
 +++ test105.right-P.txt
 @@ -1,7 +1,7 @@
--David Axelrod
--Electric Prunes
--Gil Scott Heron
- The Slits
++The Slits
 +Gil Scott Heron
-+David Axelrod
-+Electric Prunes
+ David Axelrod
+ Electric Prunes
+-Gil Scott Heron
+-The Slits
  Faust
  The Sonics
  The Sonics